function H_e(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 a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(t,i,a.get?a:{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 a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var _0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ka(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function q_e(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){var i=!1;try{i=this instanceof r}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var bO={exports:{}},Rx={};/**
 * @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 OW;function K_e(){if(OW)return Rx;OW=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,a){var o=null;if(a!==void 0&&(o=""+a),i.key!==void 0&&(o=""+i.key),"key"in i){a={};for(var s in i)s!=="key"&&(a[s]=i[s])}else a=i;return i=a.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:a}}return Rx.Fragment=e,Rx.jsx=n,Rx.jsxs=n,Rx}var DW;function Y_e(){return DW||(DW=1,bO.exports=K_e()),bO.exports}var w=Y_e(),SO={exports:{}},Ix={},CO={exports:{}},_O={};/**
 * @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 MW;function X_e(){return MW||(MW=1,(function(t){function e(U,Y){var J=U.length;U.push(Y);e:for(;0<J;){var ne=J-1>>>1,F=U[ne];if(0<i(F,Y))U[ne]=Y,U[J]=F,J=ne;else break e}}function n(U){return U.length===0?null:U[0]}function r(U){if(U.length===0)return null;var Y=U[0],J=U.pop();if(J!==Y){U[0]=J;e:for(var ne=0,F=U.length,ae=F>>>1;ne<ae;){var re=2*(ne+1)-1,te=U[re],ye=re+1,we=U[ye];if(0>i(te,J))ye<F&&0>i(we,te)?(U[ne]=we,U[ye]=J,ne=ye):(U[ne]=te,U[re]=J,ne=re);else if(ye<F&&0>i(we,J))U[ne]=we,U[ye]=J,ne=ye;else break e}}return Y}function i(U,Y){var J=U.sortIndex-Y.sortIndex;return J!==0?J:U.id-Y.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();t.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,f=null,d=3,h=!1,m=!1,p=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function _(U){for(var Y=n(l);Y!==null;){if(Y.callback===null)r(l);else if(Y.startTime<=U)r(l),Y.sortIndex=Y.expirationTime,e(c,Y);else break;Y=n(l)}}function T(U){if(p=!1,_(U),!m)if(n(c)!==null)m=!0,O||(O=!0,$());else{var Y=n(l);Y!==null&&oe(T,Y.startTime-U)}}var O=!1,M=-1,I=5,V=-1;function k(){return y?!0:!(t.unstable_now()-V<I)}function L(){if(y=!1,O){var U=t.unstable_now();V=U;var Y=!0;try{e:{m=!1,p&&(p=!1,S(M),M=-1),h=!0;var J=d;try{t:{for(_(U),f=n(c);f!==null&&!(f.expirationTime>U&&k());){var ne=f.callback;if(typeof ne=="function"){f.callback=null,d=f.priorityLevel;var F=ne(f.expirationTime<=U);if(U=t.unstable_now(),typeof F=="function"){f.callback=F,_(U),Y=!0;break t}f===n(c)&&r(c),_(U)}else r(c);f=n(c)}if(f!==null)Y=!0;else{var ae=n(l);ae!==null&&oe(T,ae.startTime-U),Y=!1}}break e}finally{f=null,d=J,h=!1}Y=void 0}}finally{Y?$():O=!1}}}var $;if(typeof C=="function")$=function(){C(L)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,G=W.port2;W.port1.onmessage=L,$=function(){G.postMessage(null)}}else $=function(){x(L,0)};function oe(U,Y){M=x(function(){U(t.unstable_now())},Y)}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(U){U.callback=null},t.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<U?Math.floor(1e3/U):5},t.unstable_getCurrentPriorityLevel=function(){return d},t.unstable_next=function(U){switch(d){case 1:case 2:case 3:var Y=3;break;default:Y=d}var J=d;d=Y;try{return U()}finally{d=J}},t.unstable_requestPaint=function(){y=!0},t.unstable_runWithPriority=function(U,Y){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var J=d;d=U;try{return Y()}finally{d=J}},t.unstable_scheduleCallback=function(U,Y,J){var ne=t.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?ne+J:ne):J=ne,U){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=J+F,U={id:u++,callback:Y,priorityLevel:U,startTime:J,expirationTime:F,sortIndex:-1},J>ne?(U.sortIndex=J,e(l,U),n(c)===null&&U===n(l)&&(p?(S(M),M=-1):p=!0,oe(T,J-ne))):(U.sortIndex=F,e(c,U),m||h||(m=!0,O||(O=!0,$()))),U},t.unstable_shouldYield=k,t.unstable_wrapCallback=function(U){var Y=d;return function(){var J=d;d=Y;try{return U.apply(this,arguments)}finally{d=J}}}})(_O)),_O}var RW;function Z_e(){return RW||(RW=1,CO.exports=X_e()),CO.exports}var TO={exports:{}},qn={};/**
 * @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 IW;function Q_e(){if(IW)return qn;IW=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"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),f=Symbol.iterator;function d(F){return F===null||typeof F!="object"?null:(F=f&&F[f]||F["@@iterator"],typeof F=="function"?F:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,p={};function y(F,ae,re){this.props=F,this.context=ae,this.refs=p,this.updater=re||h}y.prototype.isReactComponent={},y.prototype.setState=function(F,ae){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,ae,"setState")},y.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function x(){}x.prototype=y.prototype;function S(F,ae,re){this.props=F,this.context=ae,this.refs=p,this.updater=re||h}var C=S.prototype=new x;C.constructor=S,m(C,y.prototype),C.isPureReactComponent=!0;var _=Array.isArray,T={H:null,A:null,T:null,S:null,V:null},O=Object.prototype.hasOwnProperty;function M(F,ae,re,te,ye,we){return re=we.ref,{$$typeof:t,type:F,key:ae,ref:re!==void 0?re:null,props:we}}function I(F,ae){return M(F.type,ae,void 0,void 0,void 0,F.props)}function V(F){return typeof F=="object"&&F!==null&&F.$$typeof===t}function k(F){var ae={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(re){return ae[re]})}var L=/\/+/g;function $(F,ae){return typeof F=="object"&&F!==null&&F.key!=null?k(""+F.key):ae.toString(36)}function W(){}function G(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(W,W):(F.status="pending",F.then(function(ae){F.status==="pending"&&(F.status="fulfilled",F.value=ae)},function(ae){F.status==="pending"&&(F.status="rejected",F.reason=ae)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function oe(F,ae,re,te,ye){var we=typeof F;(we==="undefined"||we==="boolean")&&(F=null);var Oe=!1;if(F===null)Oe=!0;else switch(we){case"bigint":case"string":case"number":Oe=!0;break;case"object":switch(F.$$typeof){case t:case e:Oe=!0;break;case u:return Oe=F._init,oe(Oe(F._payload),ae,re,te,ye)}}if(Oe)return ye=ye(F),Oe=te===""?"."+$(F,0):te,_(ye)?(re="",Oe!=null&&(re=Oe.replace(L,"$&/")+"/"),oe(ye,ae,re,"",function(be){return be})):ye!=null&&(V(ye)&&(ye=I(ye,re+(ye.key==null||F&&F.key===ye.key?"":(""+ye.key).replace(L,"$&/")+"/")+Oe)),ae.push(ye)),1;Oe=0;var Te=te===""?".":te+":";if(_(F))for(var Me=0;Me<F.length;Me++)te=F[Me],we=Te+$(te,Me),Oe+=oe(te,ae,re,we,ye);else if(Me=d(F),typeof Me=="function")for(F=Me.call(F),Me=0;!(te=F.next()).done;)te=te.value,we=Te+$(te,Me++),Oe+=oe(te,ae,re,we,ye);else if(we==="object"){if(typeof F.then=="function")return oe(G(F),ae,re,te,ye);throw ae=String(F),Error("Objects are not valid as a React child (found: "+(ae==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":ae)+"). If you meant to render a collection of children, use an array instead.")}return Oe}function U(F,ae,re){if(F==null)return F;var te=[],ye=0;return oe(F,te,"","",function(we){return ae.call(re,we,ye++)}),te}function Y(F){if(F._status===-1){var ae=F._result;ae=ae(),ae.then(function(re){(F._status===0||F._status===-1)&&(F._status=1,F._result=re)},function(re){(F._status===0||F._status===-1)&&(F._status=2,F._result=re)}),F._status===-1&&(F._status=0,F._result=ae)}if(F._status===1)return F._result.default;throw F._result}var J=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ae=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(ae))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)};function ne(){}return qn.Children={map:U,forEach:function(F,ae,re){U(F,function(){ae.apply(this,arguments)},re)},count:function(F){var ae=0;return U(F,function(){ae++}),ae},toArray:function(F){return U(F,function(ae){return ae})||[]},only:function(F){if(!V(F))throw Error("React.Children.only expected to receive a single React element child.");return F}},qn.Component=y,qn.Fragment=n,qn.Profiler=i,qn.PureComponent=S,qn.StrictMode=r,qn.Suspense=c,qn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,qn.__COMPILER_RUNTIME={__proto__:null,c:function(F){return T.H.useMemoCache(F)}},qn.cache=function(F){return function(){return F.apply(null,arguments)}},qn.cloneElement=function(F,ae,re){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var te=m({},F.props),ye=F.key,we=void 0;if(ae!=null)for(Oe in ae.ref!==void 0&&(we=void 0),ae.key!==void 0&&(ye=""+ae.key),ae)!O.call(ae,Oe)||Oe==="key"||Oe==="__self"||Oe==="__source"||Oe==="ref"&&ae.ref===void 0||(te[Oe]=ae[Oe]);var Oe=arguments.length-2;if(Oe===1)te.children=re;else if(1<Oe){for(var Te=Array(Oe),Me=0;Me<Oe;Me++)Te[Me]=arguments[Me+2];te.children=Te}return M(F.type,ye,void 0,void 0,we,te)},qn.createContext=function(F){return F={$$typeof:o,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:a,_context:F},F},qn.createElement=function(F,ae,re){var te,ye={},we=null;if(ae!=null)for(te in ae.key!==void 0&&(we=""+ae.key),ae)O.call(ae,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(ye[te]=ae[te]);var Oe=arguments.length-2;if(Oe===1)ye.children=re;else if(1<Oe){for(var Te=Array(Oe),Me=0;Me<Oe;Me++)Te[Me]=arguments[Me+2];ye.children=Te}if(F&&F.defaultProps)for(te in Oe=F.defaultProps,Oe)ye[te]===void 0&&(ye[te]=Oe[te]);return M(F,we,void 0,void 0,null,ye)},qn.createRef=function(){return{current:null}},qn.forwardRef=function(F){return{$$typeof:s,render:F}},qn.isValidElement=V,qn.lazy=function(F){return{$$typeof:u,_payload:{_status:-1,_result:F},_init:Y}},qn.memo=function(F,ae){return{$$typeof:l,type:F,compare:ae===void 0?null:ae}},qn.startTransition=function(F){var ae=T.T,re={};T.T=re;try{var te=F(),ye=T.S;ye!==null&&ye(re,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(ne,J)}catch(we){J(we)}finally{T.T=ae}},qn.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},qn.use=function(F){return T.H.use(F)},qn.useActionState=function(F,ae,re){return T.H.useActionState(F,ae,re)},qn.useCallback=function(F,ae){return T.H.useCallback(F,ae)},qn.useContext=function(F){return T.H.useContext(F)},qn.useDebugValue=function(){},qn.useDeferredValue=function(F,ae){return T.H.useDeferredValue(F,ae)},qn.useEffect=function(F,ae,re){var te=T.H;if(typeof re=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return te.useEffect(F,ae)},qn.useId=function(){return T.H.useId()},qn.useImperativeHandle=function(F,ae,re){return T.H.useImperativeHandle(F,ae,re)},qn.useInsertionEffect=function(F,ae){return T.H.useInsertionEffect(F,ae)},qn.useLayoutEffect=function(F,ae){return T.H.useLayoutEffect(F,ae)},qn.useMemo=function(F,ae){return T.H.useMemo(F,ae)},qn.useOptimistic=function(F,ae){return T.H.useOptimistic(F,ae)},qn.useReducer=function(F,ae,re){return T.H.useReducer(F,ae,re)},qn.useRef=function(F){return T.H.useRef(F)},qn.useState=function(F){return T.H.useState(F)},qn.useSyncExternalStore=function(F,ae,re){return T.H.useSyncExternalStore(F,ae,re)},qn.useTransition=function(){return T.H.useTransition()},qn.version="19.1.1",qn}var NW;function Jy(){return NW||(NW=1,TO.exports=Q_e()),TO.exports}var EO={exports:{}},fs={};/**
 * @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 PW;function J_e(){if(PW)return fs;PW=1;var t=Jy();function e(c){var l="https://react.dev/errors/"+c;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)l+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+c+"; visit "+l+" 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 a(c,l,u){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:f==null?null:""+f,children:c,containerInfo:l,implementation:u}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function s(c,l){if(c==="font")return"";if(typeof l=="string")return l==="use-credentials"?l:""}return fs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,fs.createPortal=function(c,l){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)throw Error(e(299));return a(c,l,null,u)},fs.flushSync=function(c){var l=o.T,u=r.p;try{if(o.T=null,r.p=2,c)return c()}finally{o.T=l,r.p=u,r.d.f()}},fs.preconnect=function(c,l){typeof c=="string"&&(l?(l=l.crossOrigin,l=typeof l=="string"?l==="use-credentials"?l:"":void 0):l=null,r.d.C(c,l))},fs.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},fs.preinit=function(c,l){if(typeof c=="string"&&l&&typeof l.as=="string"){var u=l.as,f=s(u,l.crossOrigin),d=typeof l.integrity=="string"?l.integrity:void 0,h=typeof l.fetchPriority=="string"?l.fetchPriority:void 0;u==="style"?r.d.S(c,typeof l.precedence=="string"?l.precedence:void 0,{crossOrigin:f,integrity:d,fetchPriority:h}):u==="script"&&r.d.X(c,{crossOrigin:f,integrity:d,fetchPriority:h,nonce:typeof l.nonce=="string"?l.nonce:void 0})}},fs.preinitModule=function(c,l){if(typeof c=="string")if(typeof l=="object"&&l!==null){if(l.as==null||l.as==="script"){var u=s(l.as,l.crossOrigin);r.d.M(c,{crossOrigin:u,integrity:typeof l.integrity=="string"?l.integrity:void 0,nonce:typeof l.nonce=="string"?l.nonce:void 0})}}else l==null&&r.d.M(c)},fs.preload=function(c,l){if(typeof c=="string"&&typeof l=="object"&&l!==null&&typeof l.as=="string"){var u=l.as,f=s(u,l.crossOrigin);r.d.L(c,u,{crossOrigin:f,integrity:typeof l.integrity=="string"?l.integrity:void 0,nonce:typeof l.nonce=="string"?l.nonce:void 0,type:typeof l.type=="string"?l.type:void 0,fetchPriority:typeof l.fetchPriority=="string"?l.fetchPriority:void 0,referrerPolicy:typeof l.referrerPolicy=="string"?l.referrerPolicy:void 0,imageSrcSet:typeof l.imageSrcSet=="string"?l.imageSrcSet:void 0,imageSizes:typeof l.imageSizes=="string"?l.imageSizes:void 0,media:typeof l.media=="string"?l.media:void 0})}},fs.preloadModule=function(c,l){if(typeof c=="string")if(l){var u=s(l.as,l.crossOrigin);r.d.m(c,{as:typeof l.as=="string"&&l.as!=="script"?l.as:void 0,crossOrigin:u,integrity:typeof l.integrity=="string"?l.integrity:void 0})}else r.d.m(c)},fs.requestFormReset=function(c){r.d.r(c)},fs.unstable_batchedUpdates=function(c,l){return c(l)},fs.useFormState=function(c,l,u){return o.H.useFormState(c,l,u)},fs.useFormStatus=function(){return o.H.useHostTransitionStatus()},fs.version="19.1.1",fs}var kW;function Rre(){if(kW)return EO.exports;kW=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(),EO.exports=J_e(),EO.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 AW;function eTe(){if(AW)return Ix;AW=1;var t=Z_e(),e=Jy(),n=Rre();function r(g){var v="https://react.dev/errors/"+g;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)v+="&args[]="+encodeURIComponent(arguments[b])}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 i(g){return!(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)}function a(g){var v=g,b=g;if(g.alternate)for(;v.return;)v=v.return;else{g=v;do v=g,(v.flags&4098)!==0&&(b=v.return),g=v.return;while(g)}return v.tag===3?b:null}function o(g){if(g.tag===13){var v=g.memoizedState;if(v===null&&(g=g.alternate,g!==null&&(v=g.memoizedState)),v!==null)return v.dehydrated}return null}function s(g){if(a(g)!==g)throw Error(r(188))}function c(g){var v=g.alternate;if(!v){if(v=a(g),v===null)throw Error(r(188));return v!==g?null:g}for(var b=g,E=v;;){var R=b.return;if(R===null)break;var N=R.alternate;if(N===null){if(E=R.return,E!==null){b=E;continue}break}if(R.child===N.child){for(N=R.child;N;){if(N===b)return s(R),g;if(N===E)return s(R),v;N=N.sibling}throw Error(r(188))}if(b.return!==E.return)b=R,E=N;else{for(var Z=!1,ce=R.child;ce;){if(ce===b){Z=!0,b=R,E=N;break}if(ce===E){Z=!0,E=R,b=N;break}ce=ce.sibling}if(!Z){for(ce=N.child;ce;){if(ce===b){Z=!0,b=N,E=R;break}if(ce===E){Z=!0,E=N,b=R;break}ce=ce.sibling}if(!Z)throw Error(r(189))}}if(b.alternate!==E)throw Error(r(190))}if(b.tag!==3)throw Error(r(188));return b.stateNode.current===b?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}var u=Object.assign,f=Symbol.for("react.element"),d=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),S=Symbol.for("react.consumer"),C=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),k=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function $(g){return g===null||typeof g!="object"?null:(g=L&&g[L]||g["@@iterator"],typeof g=="function"?g:null)}var W=Symbol.for("react.client.reference");function G(g){if(g==null)return null;if(typeof g=="function")return g.$$typeof===W?null:g.displayName||g.name||null;if(typeof g=="string")return g;switch(g){case m:return"Fragment";case y:return"Profiler";case p:return"StrictMode";case T:return"Suspense";case O:return"SuspenseList";case V:return"Activity"}if(typeof g=="object")switch(g.$$typeof){case h:return"Portal";case C:return(g.displayName||"Context")+".Provider";case S:return(g._context.displayName||"Context")+".Consumer";case _:var v=g.render;return g=g.displayName,g||(g=v.displayName||v.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case M:return v=g.displayName||null,v!==null?v:G(g.type)||"Memo";case I:v=g._payload,g=g._init;try{return G(g(v))}catch{}}return null}var oe=Array.isArray,U=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},ne=[],F=-1;function ae(g){return{current:g}}function re(g){0>F||(g.current=ne[F],ne[F]=null,F--)}function te(g,v){F++,ne[F]=g.current,g.current=v}var ye=ae(null),we=ae(null),Oe=ae(null),Te=ae(null);function Me(g,v){switch(te(Oe,v),te(we,g),te(ye,null),v.nodeType){case 9:case 11:g=(g=v.documentElement)&&(g=g.namespaceURI)?tW(g):0;break;default:if(g=v.tagName,v=v.namespaceURI)v=tW(v),g=nW(v,g);else switch(g){case"svg":g=1;break;case"math":g=2;break;default:g=0}}re(ye),te(ye,g)}function be(){re(ye),re(we),re(Oe)}function Ye(g){g.memoizedState!==null&&te(Te,g);var v=ye.current,b=nW(v,g.type);v!==b&&(te(we,g),te(ye,b))}function ft(g){we.current===g&&(re(ye),re(we)),Te.current===g&&(re(Te),Tx._currentValue=J)}var je=Object.prototype.hasOwnProperty,It=t.unstable_scheduleCallback,Rt=t.unstable_cancelCallback,cn=t.unstable_shouldYield,ln=t.unstable_requestPaint,en=t.unstable_now,tr=t.unstable_getCurrentPriorityLevel,Ke=t.unstable_ImmediatePriority,ue=t.unstable_UserBlockingPriority,B=t.unstable_NormalPriority,K=t.unstable_LowPriority,fe=t.unstable_IdlePriority,ie=t.log,pe=t.unstable_setDisableYieldValue,Re=null,et=null;function wt(g){if(typeof ie=="function"&&pe(g),et&&typeof et.setStrictMode=="function")try{et.setStrictMode(Re,g)}catch{}}var Pt=Math.clz32?Math.clz32:Sr,Ln=Math.log,Sn=Math.LN2;function Sr(g){return g>>>=0,g===0?32:31-(Ln(g)/Sn|0)|0}var hn=256,kn=4194304;function Mn(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:case 262144:case 524288:case 1048576:case 2097152:return g&4194048;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 Ae(g,v,b){var E=g.pendingLanes;if(E===0)return 0;var R=0,N=g.suspendedLanes,Z=g.pingedLanes;g=g.warmLanes;var ce=E&134217727;return ce!==0?(E=ce&~N,E!==0?R=Mn(E):(Z&=ce,Z!==0?R=Mn(Z):b||(b=ce&~g,b!==0&&(R=Mn(b))))):(ce=E&~N,ce!==0?R=Mn(ce):Z!==0?R=Mn(Z):b||(b=E&~g,b!==0&&(R=Mn(b)))),R===0?0:v!==0&&v!==R&&(v&N)===0&&(N=R&-R,b=v&-v,N>=b||N===32&&(b&4194048)!==0)?v:R}function at(g,v){return(g.pendingLanes&~(g.suspendedLanes&~g.pingedLanes)&v)===0}function ct(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 kt(){var g=hn;return hn<<=1,(hn&4194048)===0&&(hn=256),g}function jt(){var g=kn;return kn<<=1,(kn&62914560)===0&&(kn=4194304),g}function gn(g){for(var v=[],b=0;31>b;b++)v.push(g);return v}function Kn(g,v){g.pendingLanes|=v,v!==268435456&&(g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0)}function rn(g,v,b,E,R,N){var Z=g.pendingLanes;g.pendingLanes=b,g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0,g.expiredLanes&=b,g.entangledLanes&=b,g.errorRecoveryDisabledLanes&=b,g.shellSuspendCounter=0;var ce=g.entanglements,Se=g.expirationTimes,$e=g.hiddenUpdates;for(b=Z&~b;0<b;){var nt=31-Pt(b),lt=1<<nt;ce[nt]=0,Se[nt]=-1;var Fe=$e[nt];if(Fe!==null)for($e[nt]=null,nt=0;nt<Fe.length;nt++){var ze=Fe[nt];ze!==null&&(ze.lane&=-536870913)}b&=~lt}E!==0&&Xt(g,E,0),N!==0&&R===0&&g.tag!==0&&(g.suspendedLanes|=N&~(Z&~v))}function Xt(g,v,b){g.pendingLanes|=v,g.suspendedLanes&=~v;var E=31-Pt(v);g.entangledLanes|=v,g.entanglements[E]=g.entanglements[E]|1073741824|b&4194090}function Un(g,v){var b=g.entangledLanes|=v;for(g=g.entanglements;b;){var E=31-Pt(b),R=1<<E;R&v|g[E]&v&&(g[E]|=v),b&=~R}}function Bn(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 pr(g){return g&=-g,2<g?8<g?(g&134217727)!==0?32:268435456:8:2}function wi(){var g=Y.p;return g!==0?g:(g=window.event,g===void 0?32:bW(g.type))}function Vn(g,v){var b=Y.p;try{return Y.p=g,v()}finally{Y.p=b}}var mr=Math.random().toString(36).slice(2),Dt="__reactFiber$"+mr,Gt="__reactProps$"+mr,Ut="__reactContainer$"+mr,un="__reactEvents$"+mr,Zr="__reactListeners$"+mr,xo="__reactHandles$"+mr,Pl="__reactResources$"+mr,os="__reactMarker$"+mr;function Uo(g){delete g[Dt],delete g[Gt],delete g[un],delete g[Zr],delete g[xo]}function wo(g){var v=g[Dt];if(v)return v;for(var b=g.parentNode;b;){if(v=b[Ut]||b[Dt]){if(b=v.alternate,v.child!==null||b!==null&&b.child!==null)for(g=oW(g);g!==null;){if(b=g[Dt])return b;g=oW(g)}return v}g=b,b=g.parentNode}return null}function Fo(g){if(g=g[Dt]||g[Ut]){var v=g.tag;if(v===5||v===6||v===13||v===26||v===27||v===3)return g}return null}function zr(g){var v=g.tag;if(v===5||v===26||v===27||v===6)return g.stateNode;throw Error(r(33))}function ba(g){var v=g[Pl];return v||(v=g[Pl]={hoistableStyles:new Map,hoistableScripts:new Map}),v}function Zt(g){g[os]=!0}var Ui=new Set,kl={};function Fi(g,v){Va(g,v),Va(g+"Capture",v)}function Va(g,v){for(kl[g]=v,g=0;g<v.length;g++)Ui.add(v[g])}var Bo=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]*$"),$a={},Mu={};function Gc(g){return je.call(Mu,g)?!0:je.call($a,g)?!1:Bo.test(g)?Mu[g]=!0:($a[g]=!0,!1)}function ja(g,v,b){if(Gc(v))if(b===null)g.removeAttribute(v);else{switch(typeof b){case"undefined":case"function":case"symbol":g.removeAttribute(v);return;case"boolean":var E=v.toLowerCase().slice(0,5);if(E!=="data-"&&E!=="aria-"){g.removeAttribute(v);return}}g.setAttribute(v,""+b)}}function Wc(g,v,b){if(b===null)g.removeAttribute(v);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":g.removeAttribute(v);return}g.setAttribute(v,""+b)}}function bi(g,v,b,E){if(E===null)g.removeAttribute(b);else{switch(typeof E){case"undefined":case"function":case"symbol":case"boolean":g.removeAttribute(b);return}g.setAttributeNS(v,b,""+E)}}var cc,lc;function ia(g){if(cc===void 0)try{throw Error()}catch(b){var v=b.stack.trim().match(/\n( *(at )?)/);cc=v&&v[1]||"",lc=-1<b.stack.indexOf(`
    at`)?" (<anonymous>)":-1<b.stack.indexOf("@")?"@unknown:0:0":""}return`
`+cc+g+lc}var Hc=!1;function Ns(g,v){if(!g||Hc)return"";Hc=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var E={DetermineComponentFrameRoot:function(){try{if(v){var lt=function(){throw Error()};if(Object.defineProperty(lt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(lt,[])}catch(ze){var Fe=ze}Reflect.construct(g,[],lt)}else{try{lt.call()}catch(ze){Fe=ze}g.call(lt.prototype)}}else{try{throw Error()}catch(ze){Fe=ze}(lt=g())&&typeof lt.catch=="function"&&lt.catch(function(){})}}catch(ze){if(ze&&Fe&&typeof ze.stack=="string")return[ze.stack,Fe.stack]}return[null,null]}};E.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var R=Object.getOwnPropertyDescriptor(E.DetermineComponentFrameRoot,"name");R&&R.configurable&&Object.defineProperty(E.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var N=E.DetermineComponentFrameRoot(),Z=N[0],ce=N[1];if(Z&&ce){var Se=Z.split(`
`),$e=ce.split(`
`);for(R=E=0;E<Se.length&&!Se[E].includes("DetermineComponentFrameRoot");)E++;for(;R<$e.length&&!$e[R].includes("DetermineComponentFrameRoot");)R++;if(E===Se.length||R===$e.length)for(E=Se.length-1,R=$e.length-1;1<=E&&0<=R&&Se[E]!==$e[R];)R--;for(;1<=E&&0<=R;E--,R--)if(Se[E]!==$e[R]){if(E!==1||R!==1)do if(E--,R--,0>R||Se[E]!==$e[R]){var nt=`
`+Se[E].replace(" at new "," at ");return g.displayName&&nt.includes("<anonymous>")&&(nt=nt.replace("<anonymous>",g.displayName)),nt}while(1<=E&&0<=R);break}}}finally{Hc=!1,Error.prepareStackTrace=b}return(b=g?g.displayName||g.name:"")?ia(b):""}function ss(g){switch(g.tag){case 26:case 27:case 5:return ia(g.type);case 16:return ia("Lazy");case 13:return ia("Suspense");case 19:return ia("SuspenseList");case 0:case 15:return Ns(g.type,!1);case 11:return Ns(g.type.render,!1);case 1:return Ns(g.type,!0);case 31:return ia("Activity");default:return""}}function Ru(g){try{var v="";do v+=ss(g),g=g.return;while(g);return v}catch(b){return`
Error generating stack: `+b.message+`
`+b.stack}}function Er(g){switch(typeof g){case"bigint":case"boolean":case"number":case"string":case"undefined":return g;case"object":return g;default:return""}}function bo(g){var v=g.type;return(g=g.nodeName)&&g.toLowerCase()==="input"&&(v==="checkbox"||v==="radio")}function Al(g){var v=bo(g)?"checked":"value",b=Object.getOwnPropertyDescriptor(g.constructor.prototype,v),E=""+g[v];if(!g.hasOwnProperty(v)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var R=b.get,N=b.set;return Object.defineProperty(g,v,{configurable:!0,get:function(){return R.call(this)},set:function(Z){E=""+Z,N.call(this,Z)}}),Object.defineProperty(g,v,{enumerable:b.enumerable}),{getValue:function(){return E},setValue:function(Z){E=""+Z},stopTracking:function(){g._valueTracker=null,delete g[v]}}}}function Ps(g){g._valueTracker||(g._valueTracker=Al(g))}function Ll(g){if(!g)return!1;var v=g._valueTracker;if(!v)return!0;var b=v.getValue(),E="";return g&&(E=bo(g)?g.checked?"true":"false":g.value),g=E,g!==b?(v.setValue(g),!0):!1}function So(g){if(g=g||(typeof document<"u"?document:void 0),typeof g>"u")return null;try{return g.activeElement||g.body}catch{return g.body}}var Ud=/[\n"\\]/g;function Ua(g){return g.replace(Ud,function(v){return"\\"+v.charCodeAt(0).toString(16)+" "})}function Iu(g,v,b,E,R,N,Z,ce){g.name="",Z!=null&&typeof Z!="function"&&typeof Z!="symbol"&&typeof Z!="boolean"?g.type=Z:g.removeAttribute("type"),v!=null?Z==="number"?(v===0&&g.value===""||g.value!=v)&&(g.value=""+Er(v)):g.value!==""+Er(v)&&(g.value=""+Er(v)):Z!=="submit"&&Z!=="reset"||g.removeAttribute("value"),v!=null?eo(g,Z,Er(v)):b!=null?eo(g,Z,Er(b)):E!=null&&g.removeAttribute("value"),R==null&&N!=null&&(g.defaultChecked=!!N),R!=null&&(g.checked=R&&typeof R!="function"&&typeof R!="symbol"),ce!=null&&typeof ce!="function"&&typeof ce!="symbol"&&typeof ce!="boolean"?g.name=""+Er(ce):g.removeAttribute("name")}function Df(g,v,b,E,R,N,Z,ce){if(N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(g.type=N),v!=null||b!=null){if(!(N!=="submit"&&N!=="reset"||v!=null))return;b=b!=null?""+Er(b):"",v=v!=null?""+Er(v):b,ce||v===g.value||(g.value=v),g.defaultValue=v}E=E??R,E=typeof E!="function"&&typeof E!="symbol"&&!!E,g.checked=ce?g.checked:!!E,g.defaultChecked=!!E,Z!=null&&typeof Z!="function"&&typeof Z!="symbol"&&typeof Z!="boolean"&&(g.name=Z)}function eo(g,v,b){v==="number"&&So(g.ownerDocument)===g||g.defaultValue===""+b||(g.defaultValue=""+b)}function aa(g,v,b,E){if(g=g.options,v){v={};for(var R=0;R<b.length;R++)v["$"+b[R]]=!0;for(b=0;b<g.length;b++)R=v.hasOwnProperty("$"+g[b].value),g[b].selected!==R&&(g[b].selected=R),R&&E&&(g[b].defaultSelected=!0)}else{for(b=""+Er(b),v=null,R=0;R<g.length;R++){if(g[R].value===b){g[R].selected=!0,E&&(g[R].defaultSelected=!0);return}v!==null||g[R].disabled||(v=g[R])}v!==null&&(v.selected=!0)}}function to(g,v,b){if(v!=null&&(v=""+Er(v),v!==g.value&&(g.value=v),b==null)){g.defaultValue!==v&&(g.defaultValue=v);return}g.defaultValue=b!=null?""+Er(b):""}function oa(g,v,b,E){if(v==null){if(E!=null){if(b!=null)throw Error(r(92));if(oe(E)){if(1<E.length)throw Error(r(93));E=E[0]}b=E}b==null&&(b=""),v=b}b=Er(v),g.defaultValue=b,E=g.textContent,E===b&&E!==""&&E!==null&&(g.value=E)}function ks(g,v){if(v){var b=g.firstChild;if(b&&b===g.lastChild&&b.nodeType===3){b.nodeValue=v;return}}g.textContent=v}var uc=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 fc(g,v,b){var E=v.indexOf("--")===0;b==null||typeof b=="boolean"||b===""?E?g.setProperty(v,""):v==="float"?g.cssFloat="":g[v]="":E?g.setProperty(v,b):typeof b!="number"||b===0||uc.has(v)?v==="float"?g.cssFloat=b:g[v]=(""+b).trim():g[v]=b+"px"}function ui(g,v,b){if(v!=null&&typeof v!="object")throw Error(r(62));if(g=g.style,b!=null){for(var E in b)!b.hasOwnProperty(E)||v!=null&&v.hasOwnProperty(E)||(E.indexOf("--")===0?g.setProperty(E,""):E==="float"?g.cssFloat="":g[E]="");for(var R in v)E=v[R],v.hasOwnProperty(R)&&b[R]!==E&&fc(g,R,E)}else for(var N in v)v.hasOwnProperty(N)&&fc(g,N,v[N])}function Vl(g){if(g.indexOf("-")===-1)return!1;switch(g){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 no=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"]]),sa=/^[\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 dc(g){return sa.test(""+g)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":g}var cs=null;function Sa(g){return g=g.target||g.srcElement||window,g.correspondingUseElement&&(g=g.correspondingUseElement),g.nodeType===3?g.parentNode:g}var Co=null,As=null;function Nu(g){var v=Fo(g);if(v&&(g=v.stateNode)){var b=g[Gt]||null;e:switch(g=v.stateNode,v.type){case"input":if(Iu(g,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name),v=b.name,b.type==="radio"&&v!=null){for(b=g;b.parentNode;)b=b.parentNode;for(b=b.querySelectorAll('input[name="'+Ua(""+v)+'"][type="radio"]'),v=0;v<b.length;v++){var E=b[v];if(E!==g&&E.form===g.form){var R=E[Gt]||null;if(!R)throw Error(r(90));Iu(E,R.value,R.defaultValue,R.defaultValue,R.checked,R.defaultChecked,R.type,R.name)}}for(v=0;v<b.length;v++)E=b[v],E.form===g.form&&Ll(E)}break e;case"textarea":to(g,b.value,b.defaultValue);break e;case"select":v=b.value,v!=null&&aa(g,!!b.multiple,v,!1)}}}var hc=!1;function jr(g,v,b){if(hc)return g(v,b);hc=!0;try{var E=g(v);return E}finally{if(hc=!1,(Co!==null||As!==null)&&(u4(),Co&&(v=Co,g=As,As=Co=null,Nu(v),g)))for(v=0;v<g.length;v++)Nu(g[v])}}function zo(g,v){var b=g.stateNode;if(b===null)return null;var E=b[Gt]||null;if(E===null)return null;b=E[v];e:switch(v){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(E=!E.disabled)||(g=g.type,E=!(g==="button"||g==="input"||g==="select"||g==="textarea")),g=!E;break e;default:g=!1}if(g)return null;if(b&&typeof b!="function")throw Error(r(231,v,typeof b));return b}var Ur=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Si=!1;if(Ur)try{var gc={};Object.defineProperty(gc,"passive",{get:function(){Si=!0}}),window.addEventListener("test",gc,gc),window.removeEventListener("test",gc,gc)}catch{Si=!1}var Ci=null,Pu=null,Bi=null;function Go(){if(Bi)return Bi;var g,v=Pu,b=v.length,E,R="value"in Ci?Ci.value:Ci.textContent,N=R.length;for(g=0;g<b&&v[g]===R[g];g++);var Z=b-g;for(E=1;E<=Z&&v[b-E]===R[N-E];E++);return Bi=R.slice(g,1<E?1-E:void 0)}function pc(g){var v=g.keyCode;return"charCode"in g?(g=g.charCode,g===0&&v===13&&(g=13)):g=v,g===10&&(g=13),32<=g||g===13?g:0}function ls(){return!0}function Fa(){return!1}function zi(g){function v(b,E,R,N,Z){this._reactName=b,this._targetInst=R,this.type=E,this.nativeEvent=N,this.target=Z,this.currentTarget=null;for(var ce in g)g.hasOwnProperty(ce)&&(b=g[ce],this[ce]=b?b(N):N[ce]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?ls:Fa,this.isPropagationStopped=Fa,this}return u(v.prototype,{preventDefault:function(){this.defaultPrevented=!0;var b=this.nativeEvent;b&&(b.preventDefault?b.preventDefault():typeof b.returnValue!="unknown"&&(b.returnValue=!1),this.isDefaultPrevented=ls)},stopPropagation:function(){var b=this.nativeEvent;b&&(b.stopPropagation?b.stopPropagation():typeof b.cancelBubble!="unknown"&&(b.cancelBubble=!0),this.isPropagationStopped=ls)},persist:function(){},isPersistent:ls}),v}var Ls={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(g){return g.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$l=zi(Ls),mc=u({},Ls,{view:0,detail:0}),qc=zi(mc),jl,Kc,Yc,Ul=u({},mc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bl,button:0,buttons:0,relatedTarget:function(g){return g.relatedTarget===void 0?g.fromElement===g.srcElement?g.toElement:g.fromElement:g.relatedTarget},movementX:function(g){return"movementX"in g?g.movementX:(g!==Yc&&(Yc&&g.type==="mousemove"?(jl=g.screenX-Yc.screenX,Kc=g.screenY-Yc.screenY):Kc=jl=0,Yc=g),jl)},movementY:function(g){return"movementY"in g?g.movementY:Kc}}),Mf=zi(Ul),Fd=u({},Ul,{dataTransfer:0}),Bd=zi(Fd),zd=u({},mc,{relatedTarget:0}),ku=zi(zd),Rf=u({},Ls,{animationName:0,elapsedTime:0,pseudoElement:0}),Gd=zi(Rf),If=u({},Ls,{clipboardData:function(g){return"clipboardData"in g?g.clipboardData:window.clipboardData}}),Nf=zi(If),Wd=u({},Ls,{data:0}),Fl=zi(Wd),Pf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kf={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"},Au={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hd(g){var v=this.nativeEvent;return v.getModifierState?v.getModifierState(g):(g=Au[g])?!!v[g]:!1}function Bl(){return Hd}var qd=u({},mc,{key:function(g){if(g.key){var v=Pf[g.key]||g.key;if(v!=="Unidentified")return v}return g.type==="keypress"?(g=pc(g),g===13?"Enter":String.fromCharCode(g)):g.type==="keydown"||g.type==="keyup"?kf[g.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bl,charCode:function(g){return g.type==="keypress"?pc(g):0},keyCode:function(g){return g.type==="keydown"||g.type==="keyup"?g.keyCode:0},which:function(g){return g.type==="keypress"?pc(g):g.type==="keydown"||g.type==="keyup"?g.keyCode:0}}),Af=zi(qd),Kd=u({},Ul,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lf=zi(Kd),Yd=u({},mc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bl}),Xd=zi(Yd),Lu=u({},Ls,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vu=zi(Lu),Vs=u({},Ul,{deltaX:function(g){return"deltaX"in g?g.deltaX:"wheelDeltaX"in g?-g.wheelDeltaX:0},deltaY:function(g){return"deltaY"in g?g.deltaY:"wheelDeltaY"in g?-g.wheelDeltaY:"wheelDelta"in g?-g.wheelDelta:0},deltaZ:0,deltaMode:0}),vc=zi(Vs),Wo=u({},Ls,{newState:0,oldState:0}),Vf=zi(Wo),$f=[9,13,27,32],Xc=Ur&&"CompositionEvent"in window,yc=null;Ur&&"documentMode"in document&&(yc=document.documentMode);var zl=Ur&&"TextEvent"in window&&!yc,$u=Ur&&(!Xc||yc&&8<yc&&11>=yc),Q=" ",ee=!1;function me(g,v){switch(g){case"keyup":return $f.indexOf(v.keyCode)!==-1;case"keydown":return v.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pe(g){return g=g.detail,typeof g=="object"&&"data"in g?g.data:null}var Be=!1;function Qe(g,v){switch(g){case"compositionend":return Pe(v);case"keypress":return v.which!==32?null:(ee=!0,Q);case"textInput":return g=v.data,g===Q&&ee?null:g;default:return null}}function Je(g,v){if(Be)return g==="compositionend"||!Xc&&me(g,v)?(g=Go(),Bi=Pu=Ci=null,Be=!1,g):null;switch(g){case"paste":return null;case"keypress":if(!(v.ctrlKey||v.altKey||v.metaKey)||v.ctrlKey&&v.altKey){if(v.char&&1<v.char.length)return v.char;if(v.which)return String.fromCharCode(v.which)}return null;case"compositionend":return $u&&v.locale!=="ko"?null:v.data;default:return null}}var Ge={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 tt(g){var v=g&&g.nodeName&&g.nodeName.toLowerCase();return v==="input"?!!Ge[g.type]:v==="textarea"}function mt(g,v,b,E){Co?As?As.push(E):As=[E]:Co=E,v=m4(v,"onChange"),0<v.length&&(b=new $l("onChange","change",null,b,E),g.push({event:b,listeners:v}))}var At=null,Wt=null;function an(g){XG(g,0)}function X(g){var v=zr(g);if(Ll(v))return g}function q(g,v){if(g==="change")return v}var de=!1;if(Ur){var Ee;if(Ur){var Ue="oninput"in document;if(!Ue){var ot=document.createElement("div");ot.setAttribute("oninput","return;"),Ue=typeof ot.oninput=="function"}Ee=Ue}else Ee=!1;de=Ee&&(!document.documentMode||9<document.documentMode)}function Ze(){At&&(At.detachEvent("onpropertychange",qe),Wt=At=null)}function qe(g){if(g.propertyName==="value"&&X(Wt)){var v=[];mt(v,Wt,g,Sa(g)),jr(an,v)}}function j(g,v,b){g==="focusin"?(Ze(),At=v,Wt=b,At.attachEvent("onpropertychange",qe)):g==="focusout"&&Ze()}function z(g){if(g==="selectionchange"||g==="keyup"||g==="keydown")return X(Wt)}function P(g,v){if(g==="click")return X(v)}function A(g,v){if(g==="input"||g==="change")return X(v)}function H(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var le=typeof Object.is=="function"?Object.is:H;function he(g,v){if(le(g,v))return!0;if(typeof g!="object"||g===null||typeof v!="object"||v===null)return!1;var b=Object.keys(g),E=Object.keys(v);if(b.length!==E.length)return!1;for(E=0;E<b.length;E++){var R=b[E];if(!je.call(v,R)||!le(g[R],v[R]))return!1}return!0}function ve(g){for(;g&&g.firstChild;)g=g.firstChild;return g}function xe(g,v){var b=ve(g);g=0;for(var E;b;){if(b.nodeType===3){if(E=g+b.textContent.length,g<=v&&E>=v)return{node:b,offset:v-g};g=E}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=ve(b)}}function _e(g,v){return g&&v?g===v?!0:g&&g.nodeType===3?!1:v&&v.nodeType===3?_e(g,v.parentNode):"contains"in g?g.contains(v):g.compareDocumentPosition?!!(g.compareDocumentPosition(v)&16):!1:!1}function ke(g){g=g!=null&&g.ownerDocument!=null&&g.ownerDocument.defaultView!=null?g.ownerDocument.defaultView:window;for(var v=So(g.document);v instanceof g.HTMLIFrameElement;){try{var b=typeof v.contentWindow.location.href=="string"}catch{b=!1}if(b)g=v.contentWindow;else break;v=So(g.document)}return v}function Xe(g){var v=g&&g.nodeName&&g.nodeName.toLowerCase();return v&&(v==="input"&&(g.type==="text"||g.type==="search"||g.type==="tel"||g.type==="url"||g.type==="password")||v==="textarea"||g.contentEditable==="true")}var gt=Ur&&"documentMode"in document&&11>=document.documentMode,Nt=null,_t=null,dn=null,pn=!1;function lr(g,v,b){var E=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;pn||Nt==null||Nt!==So(E)||(E=Nt,"selectionStart"in E&&Xe(E)?E={start:E.selectionStart,end:E.selectionEnd}:(E=(E.ownerDocument&&E.ownerDocument.defaultView||window).getSelection(),E={anchorNode:E.anchorNode,anchorOffset:E.anchorOffset,focusNode:E.focusNode,focusOffset:E.focusOffset}),dn&&he(dn,E)||(dn=E,E=m4(_t,"onSelect"),0<E.length&&(v=new $l("onSelect","select",null,v,b),g.push({event:v,listeners:E}),v.target=Nt)))}function Gr(g,v){var b={};return b[g.toLowerCase()]=v.toLowerCase(),b["Webkit"+g]="webkit"+v,b["Moz"+g]="moz"+v,b}var ii={animationend:Gr("Animation","AnimationEnd"),animationiteration:Gr("Animation","AnimationIteration"),animationstart:Gr("Animation","AnimationStart"),transitionrun:Gr("Transition","TransitionRun"),transitionstart:Gr("Transition","TransitionStart"),transitioncancel:Gr("Transition","TransitionCancel"),transitionend:Gr("Transition","TransitionEnd")},ju={},$s={};Ur&&($s=document.createElement("div").style,"AnimationEvent"in window||(delete ii.animationend.animation,delete ii.animationiteration.animation,delete ii.animationstart.animation),"TransitionEvent"in window||delete ii.transitionend.transition);function Gl(g){if(ju[g])return ju[g];if(!ii[g])return g;var v=ii[g],b;for(b in v)if(v.hasOwnProperty(b)&&b in $s)return ju[g]=v[b];return g}var kh=Gl("animationend"),W2=Gl("animationiteration"),H2=Gl("animationstart"),DCe=Gl("transitionrun"),MCe=Gl("transitionstart"),RCe=Gl("transitioncancel"),IB=Gl("transitionend"),NB=new Map,V9="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(" ");V9.push("scrollEnd");function Uu(g,v){NB.set(g,v),Fi(v,[g])}var PB=new WeakMap;function Wl(g,v){if(typeof g=="object"&&g!==null){var b=PB.get(g);return b!==void 0?b:(v={value:g,source:v,stack:Ru(v)},PB.set(g,v),v)}return{value:g,source:v,stack:Ru(v)}}var Hl=[],P1=0,$9=0;function N3(){for(var g=P1,v=$9=P1=0;v<g;){var b=Hl[v];Hl[v++]=null;var E=Hl[v];Hl[v++]=null;var R=Hl[v];Hl[v++]=null;var N=Hl[v];if(Hl[v++]=null,E!==null&&R!==null){var Z=E.pending;Z===null?R.next=R:(R.next=Z.next,Z.next=R),E.pending=R}N!==0&&kB(b,R,N)}}function P3(g,v,b,E){Hl[P1++]=g,Hl[P1++]=v,Hl[P1++]=b,Hl[P1++]=E,$9|=E,g.lanes|=E,g=g.alternate,g!==null&&(g.lanes|=E)}function j9(g,v,b,E){return P3(g,v,b,E),k3(g)}function k1(g,v){return P3(g,null,null,v),k3(g)}function kB(g,v,b){g.lanes|=b;var E=g.alternate;E!==null&&(E.lanes|=b);for(var R=!1,N=g.return;N!==null;)N.childLanes|=b,E=N.alternate,E!==null&&(E.childLanes|=b),N.tag===22&&(g=N.stateNode,g===null||g._visibility&1||(R=!0)),g=N,N=N.return;return g.tag===3?(N=g.stateNode,R&&v!==null&&(R=31-Pt(b),g=N.hiddenUpdates,E=g[R],E===null?g[R]=[v]:E.push(v),v.lane=b|536870912),N):null}function k3(g){if(50<vx)throw vx=0,W7=null,Error(r(185));for(var v=g.return;v!==null;)g=v,v=g.return;return g.tag===3?g.stateNode:null}var A1={};function ICe(g,v,b,E){this.tag=g,this.key=b,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=E,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zc(g,v,b,E){return new ICe(g,v,b,E)}function U9(g){return g=g.prototype,!(!g||!g.isReactComponent)}function Zd(g,v){var b=g.alternate;return b===null?(b=Zc(g.tag,v,g.key,g.mode),b.elementType=g.elementType,b.type=g.type,b.stateNode=g.stateNode,b.alternate=g,g.alternate=b):(b.pendingProps=v,b.type=g.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=g.flags&65011712,b.childLanes=g.childLanes,b.lanes=g.lanes,b.child=g.child,b.memoizedProps=g.memoizedProps,b.memoizedState=g.memoizedState,b.updateQueue=g.updateQueue,v=g.dependencies,b.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext},b.sibling=g.sibling,b.index=g.index,b.ref=g.ref,b.refCleanup=g.refCleanup,b}function AB(g,v){g.flags&=65011714;var b=g.alternate;return b===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=b.childLanes,g.lanes=b.lanes,g.child=b.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=b.memoizedProps,g.memoizedState=b.memoizedState,g.updateQueue=b.updateQueue,g.type=b.type,v=b.dependencies,g.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext}),g}function A3(g,v,b,E,R,N){var Z=0;if(E=g,typeof g=="function")U9(g)&&(Z=1);else if(typeof g=="string")Z=P_e(g,b,ye.current)?26:g==="html"||g==="head"||g==="body"?27:5;else e:switch(g){case V:return g=Zc(31,b,v,R),g.elementType=V,g.lanes=N,g;case m:return Tp(b.children,R,N,v);case p:Z=8,R|=24;break;case y:return g=Zc(12,b,v,R|2),g.elementType=y,g.lanes=N,g;case T:return g=Zc(13,b,v,R),g.elementType=T,g.lanes=N,g;case O:return g=Zc(19,b,v,R),g.elementType=O,g.lanes=N,g;default:if(typeof g=="object"&&g!==null)switch(g.$$typeof){case x:case C:Z=10;break e;case S:Z=9;break e;case _:Z=11;break e;case M:Z=14;break e;case I:Z=16,E=null;break e}Z=29,b=Error(r(130,g===null?"null":typeof g,"")),E=null}return v=Zc(Z,b,v,R),v.elementType=g,v.type=E,v.lanes=N,v}function Tp(g,v,b,E){return g=Zc(7,g,E,v),g.lanes=b,g}function F9(g,v,b){return g=Zc(6,g,null,v),g.lanes=b,g}function B9(g,v,b){return v=Zc(4,g.children!==null?g.children:[],g.key,v),v.lanes=b,v.stateNode={containerInfo:g.containerInfo,pendingChildren:null,implementation:g.implementation},v}var L1=[],V1=0,L3=null,V3=0,ql=[],Kl=0,Ep=null,Qd=1,Jd="";function Op(g,v){L1[V1++]=V3,L1[V1++]=L3,L3=g,V3=v}function LB(g,v,b){ql[Kl++]=Qd,ql[Kl++]=Jd,ql[Kl++]=Ep,Ep=g;var E=Qd;g=Jd;var R=32-Pt(E)-1;E&=~(1<<R),b+=1;var N=32-Pt(v)+R;if(30<N){var Z=R-R%5;N=(E&(1<<Z)-1).toString(32),E>>=Z,R-=Z,Qd=1<<32-Pt(v)+R|b<<R|E,Jd=N+g}else Qd=1<<N|b<<R|E,Jd=g}function z9(g){g.return!==null&&(Op(g,1),LB(g,1,0))}function G9(g){for(;g===L3;)L3=L1[--V1],L1[V1]=null,V3=L1[--V1],L1[V1]=null;for(;g===Ep;)Ep=ql[--Kl],ql[Kl]=null,Jd=ql[--Kl],ql[Kl]=null,Qd=ql[--Kl],ql[Kl]=null}var js=null,ca=null,Pr=!1,Dp=null,jf=!1,W9=Error(r(519));function Mp(g){var v=Error(r(418,""));throw Y2(Wl(v,g)),W9}function VB(g){var v=g.stateNode,b=g.type,E=g.memoizedProps;switch(v[Dt]=g,v[Gt]=E,b){case"dialog":or("cancel",v),or("close",v);break;case"iframe":case"object":case"embed":or("load",v);break;case"video":case"audio":for(b=0;b<xx.length;b++)or(xx[b],v);break;case"source":or("error",v);break;case"img":case"image":case"link":or("error",v),or("load",v);break;case"details":or("toggle",v);break;case"input":or("invalid",v),Df(v,E.value,E.defaultValue,E.checked,E.defaultChecked,E.type,E.name,!0),Ps(v);break;case"select":or("invalid",v);break;case"textarea":or("invalid",v),oa(v,E.value,E.defaultValue,E.children),Ps(v)}b=E.children,typeof b!="string"&&typeof b!="number"&&typeof b!="bigint"||v.textContent===""+b||E.suppressHydrationWarning===!0||eW(v.textContent,b)?(E.popover!=null&&(or("beforetoggle",v),or("toggle",v)),E.onScroll!=null&&or("scroll",v),E.onScrollEnd!=null&&or("scrollend",v),E.onClick!=null&&(v.onclick=v4),v=!0):v=!1,v||Mp(g)}function $B(g){for(js=g.return;js;)switch(js.tag){case 5:case 13:jf=!1;return;case 27:case 3:jf=!0;return;default:js=js.return}}function q2(g){if(g!==js)return!1;if(!Pr)return $B(g),Pr=!0,!1;var v=g.tag,b;if((b=v!==3&&v!==27)&&((b=v===5)&&(b=g.type,b=!(b!=="form"&&b!=="button")||sO(g.type,g.memoizedProps)),b=!b),b&&ca&&Mp(g),$B(g),v===13){if(g=g.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));e:{for(g=g.nextSibling,v=0;g;){if(g.nodeType===8)if(b=g.data,b==="/$"){if(v===0){ca=Bu(g.nextSibling);break e}v--}else b!=="$"&&b!=="$!"&&b!=="$?"||v++;g=g.nextSibling}ca=null}}else v===27?(v=ca,Xh(g.type)?(g=fO,fO=null,ca=g):ca=v):ca=js?Bu(g.stateNode.nextSibling):null;return!0}function K2(){ca=js=null,Pr=!1}function jB(){var g=Dp;return g!==null&&(bc===null?bc=g:bc.push.apply(bc,g),Dp=null),g}function Y2(g){Dp===null?Dp=[g]:Dp.push(g)}var H9=ae(null),Rp=null,e0=null;function Ah(g,v,b){te(H9,v._currentValue),v._currentValue=b}function t0(g){g._currentValue=H9.current,re(H9)}function q9(g,v,b){for(;g!==null;){var E=g.alternate;if((g.childLanes&v)!==v?(g.childLanes|=v,E!==null&&(E.childLanes|=v)):E!==null&&(E.childLanes&v)!==v&&(E.childLanes|=v),g===b)break;g=g.return}}function K9(g,v,b,E){var R=g.child;for(R!==null&&(R.return=g);R!==null;){var N=R.dependencies;if(N!==null){var Z=R.child;N=N.firstContext;e:for(;N!==null;){var ce=N;N=R;for(var Se=0;Se<v.length;Se++)if(ce.context===v[Se]){N.lanes|=b,ce=N.alternate,ce!==null&&(ce.lanes|=b),q9(N.return,b,g),E||(Z=null);break e}N=ce.next}}else if(R.tag===18){if(Z=R.return,Z===null)throw Error(r(341));Z.lanes|=b,N=Z.alternate,N!==null&&(N.lanes|=b),q9(Z,b,g),Z=null}else Z=R.child;if(Z!==null)Z.return=R;else for(Z=R;Z!==null;){if(Z===g){Z=null;break}if(R=Z.sibling,R!==null){R.return=Z.return,Z=R;break}Z=Z.return}R=Z}}function X2(g,v,b,E){g=null;for(var R=v,N=!1;R!==null;){if(!N){if((R.flags&524288)!==0)N=!0;else if((R.flags&262144)!==0)break}if(R.tag===10){var Z=R.alternate;if(Z===null)throw Error(r(387));if(Z=Z.memoizedProps,Z!==null){var ce=R.type;le(R.pendingProps.value,Z.value)||(g!==null?g.push(ce):g=[ce])}}else if(R===Te.current){if(Z=R.alternate,Z===null)throw Error(r(387));Z.memoizedState.memoizedState!==R.memoizedState.memoizedState&&(g!==null?g.push(Tx):g=[Tx])}R=R.return}g!==null&&K9(v,g,b,E),v.flags|=262144}function $3(g){for(g=g.firstContext;g!==null;){if(!le(g.context._currentValue,g.memoizedValue))return!0;g=g.next}return!1}function Ip(g){Rp=g,e0=null,g=g.dependencies,g!==null&&(g.firstContext=null)}function us(g){return UB(Rp,g)}function j3(g,v){return Rp===null&&Ip(g),UB(g,v)}function UB(g,v){var b=v._currentValue;if(v={context:v,memoizedValue:b,next:null},e0===null){if(g===null)throw Error(r(308));e0=v,g.dependencies={lanes:0,firstContext:v},g.flags|=524288}else e0=e0.next=v;return b}var NCe=typeof AbortController<"u"?AbortController:function(){var g=[],v=this.signal={aborted:!1,addEventListener:function(b,E){g.push(E)}};this.abort=function(){v.aborted=!0,g.forEach(function(b){return b()})}},PCe=t.unstable_scheduleCallback,kCe=t.unstable_NormalPriority,ro={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Y9(){return{controller:new NCe,data:new Map,refCount:0}}function Z2(g){g.refCount--,g.refCount===0&&PCe(kCe,function(){g.controller.abort()})}var Q2=null,X9=0,$1=0,j1=null;function ACe(g,v){if(Q2===null){var b=Q2=[];X9=0,$1=Q7(),j1={status:"pending",value:void 0,then:function(E){b.push(E)}}}return X9++,v.then(FB,FB),v}function FB(){if(--X9===0&&Q2!==null){j1!==null&&(j1.status="fulfilled");var g=Q2;Q2=null,$1=0,j1=null;for(var v=0;v<g.length;v++)(0,g[v])()}}function LCe(g,v){var b=[],E={status:"pending",value:null,reason:null,then:function(R){b.push(R)}};return g.then(function(){E.status="fulfilled",E.value=v;for(var R=0;R<b.length;R++)(0,b[R])(v)},function(R){for(E.status="rejected",E.reason=R,R=0;R<b.length;R++)(0,b[R])(void 0)}),E}var BB=U.S;U.S=function(g,v){typeof v=="object"&&v!==null&&typeof v.then=="function"&&ACe(g,v),BB!==null&&BB(g,v)};var Np=ae(null);function Z9(){var g=Np.current;return g!==null?g:fi.pooledCache}function U3(g,v){v===null?te(Np,Np.current):te(Np,v.pool)}function zB(){var g=Z9();return g===null?null:{parent:ro._currentValue,pool:g}}var J2=Error(r(460)),GB=Error(r(474)),F3=Error(r(542)),Q9={then:function(){}};function WB(g){return g=g.status,g==="fulfilled"||g==="rejected"}function B3(){}function HB(g,v,b){switch(b=g[b],b===void 0?g.push(v):b!==v&&(v.then(B3,B3),v=b),v.status){case"fulfilled":return v.value;case"rejected":throw g=v.reason,KB(g),g;default:if(typeof v.status=="string")v.then(B3,B3);else{if(g=fi,g!==null&&100<g.shellSuspendCounter)throw Error(r(482));g=v,g.status="pending",g.then(function(E){if(v.status==="pending"){var R=v;R.status="fulfilled",R.value=E}},function(E){if(v.status==="pending"){var R=v;R.status="rejected",R.reason=E}})}switch(v.status){case"fulfilled":return v.value;case"rejected":throw g=v.reason,KB(g),g}throw ex=v,J2}}var ex=null;function qB(){if(ex===null)throw Error(r(459));var g=ex;return ex=null,g}function KB(g){if(g===J2||g===F3)throw Error(r(483))}var Lh=!1;function J9(g){g.updateQueue={baseState:g.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function e7(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 Vh(g){return{lane:g,tag:0,payload:null,callback:null,next:null}}function $h(g,v,b){var E=g.updateQueue;if(E===null)return null;if(E=E.shared,(Wr&2)!==0){var R=E.pending;return R===null?v.next=v:(v.next=R.next,R.next=v),E.pending=v,v=k3(g),kB(g,null,b),v}return P3(g,E,v,b),k3(g)}function tx(g,v,b){if(v=v.updateQueue,v!==null&&(v=v.shared,(b&4194048)!==0)){var E=v.lanes;E&=g.pendingLanes,b|=E,v.lanes=b,Un(g,b)}}function t7(g,v){var b=g.updateQueue,E=g.alternate;if(E!==null&&(E=E.updateQueue,b===E)){var R=null,N=null;if(b=b.firstBaseUpdate,b!==null){do{var Z={lane:b.lane,tag:b.tag,payload:b.payload,callback:null,next:null};N===null?R=N=Z:N=N.next=Z,b=b.next}while(b!==null);N===null?R=N=v:N=N.next=v}else R=N=v;b={baseState:E.baseState,firstBaseUpdate:R,lastBaseUpdate:N,shared:E.shared,callbacks:E.callbacks},g.updateQueue=b;return}g=b.lastBaseUpdate,g===null?b.firstBaseUpdate=v:g.next=v,b.lastBaseUpdate=v}var n7=!1;function nx(){if(n7){var g=j1;if(g!==null)throw g}}function rx(g,v,b,E){n7=!1;var R=g.updateQueue;Lh=!1;var N=R.firstBaseUpdate,Z=R.lastBaseUpdate,ce=R.shared.pending;if(ce!==null){R.shared.pending=null;var Se=ce,$e=Se.next;Se.next=null,Z===null?N=$e:Z.next=$e,Z=Se;var nt=g.alternate;nt!==null&&(nt=nt.updateQueue,ce=nt.lastBaseUpdate,ce!==Z&&(ce===null?nt.firstBaseUpdate=$e:ce.next=$e,nt.lastBaseUpdate=Se))}if(N!==null){var lt=R.baseState;Z=0,nt=$e=Se=null,ce=N;do{var Fe=ce.lane&-536870913,ze=Fe!==ce.lane;if(ze?(xr&Fe)===Fe:(E&Fe)===Fe){Fe!==0&&Fe===$1&&(n7=!0),nt!==null&&(nt=nt.next={lane:0,tag:ce.tag,payload:ce.payload,callback:null,next:null});e:{var Cn=g,mn=ce;Fe=v;var ei=b;switch(mn.tag){case 1:if(Cn=mn.payload,typeof Cn=="function"){lt=Cn.call(ei,lt,Fe);break e}lt=Cn;break e;case 3:Cn.flags=Cn.flags&-65537|128;case 0:if(Cn=mn.payload,Fe=typeof Cn=="function"?Cn.call(ei,lt,Fe):Cn,Fe==null)break e;lt=u({},lt,Fe);break e;case 2:Lh=!0}}Fe=ce.callback,Fe!==null&&(g.flags|=64,ze&&(g.flags|=8192),ze=R.callbacks,ze===null?R.callbacks=[Fe]:ze.push(Fe))}else ze={lane:Fe,tag:ce.tag,payload:ce.payload,callback:ce.callback,next:null},nt===null?($e=nt=ze,Se=lt):nt=nt.next=ze,Z|=Fe;if(ce=ce.next,ce===null){if(ce=R.shared.pending,ce===null)break;ze=ce,ce=ze.next,ze.next=null,R.lastBaseUpdate=ze,R.shared.pending=null}}while(!0);nt===null&&(Se=lt),R.baseState=Se,R.firstBaseUpdate=$e,R.lastBaseUpdate=nt,N===null&&(R.shared.lanes=0),Hh|=Z,g.lanes=Z,g.memoizedState=lt}}function YB(g,v){if(typeof g!="function")throw Error(r(191,g));g.call(v)}function XB(g,v){var b=g.callbacks;if(b!==null)for(g.callbacks=null,g=0;g<b.length;g++)YB(b[g],v)}var U1=ae(null),z3=ae(0);function ZB(g,v){g=c0,te(z3,g),te(U1,v),c0=g|v.baseLanes}function r7(){te(z3,c0),te(U1,U1.current)}function i7(){c0=z3.current,re(U1),re(z3)}var jh=0,Jn=null,Qr=null,Ba=null,G3=!1,F1=!1,Pp=!1,W3=0,ix=0,B1=null,VCe=0;function Ca(){throw Error(r(321))}function a7(g,v){if(v===null)return!1;for(var b=0;b<v.length&&b<g.length;b++)if(!le(g[b],v[b]))return!1;return!0}function o7(g,v,b,E,R,N){return jh=N,Jn=v,v.memoizedState=null,v.updateQueue=null,v.lanes=0,U.H=g===null||g.memoizedState===null?kz:Az,Pp=!1,N=b(E,R),Pp=!1,F1&&(N=JB(v,b,E,R)),QB(g),N}function QB(g){U.H=Z3;var v=Qr!==null&&Qr.next!==null;if(jh=0,Ba=Qr=Jn=null,G3=!1,ix=0,B1=null,v)throw Error(r(300));g===null||_o||(g=g.dependencies,g!==null&&$3(g)&&(_o=!0))}function JB(g,v,b,E){Jn=g;var R=0;do{if(F1&&(B1=null),ix=0,F1=!1,25<=R)throw Error(r(301));if(R+=1,Ba=Qr=null,g.updateQueue!=null){var N=g.updateQueue;N.lastEffect=null,N.events=null,N.stores=null,N.memoCache!=null&&(N.memoCache.index=0)}U.H=GCe,N=v(b,E)}while(F1);return N}function $Ce(){var g=U.H,v=g.useState()[0];return v=typeof v.then=="function"?ax(v):v,g=g.useState()[0],(Qr!==null?Qr.memoizedState:null)!==g&&(Jn.flags|=1024),v}function s7(){var g=W3!==0;return W3=0,g}function c7(g,v,b){v.updateQueue=g.updateQueue,v.flags&=-2053,g.lanes&=~b}function l7(g){if(G3){for(g=g.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}G3=!1}jh=0,Ba=Qr=Jn=null,F1=!1,ix=W3=0,B1=null}function xc(){var g={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ba===null?Jn.memoizedState=Ba=g:Ba=Ba.next=g,Ba}function za(){if(Qr===null){var g=Jn.alternate;g=g!==null?g.memoizedState:null}else g=Qr.next;var v=Ba===null?Jn.memoizedState:Ba.next;if(v!==null)Ba=v,Qr=g;else{if(g===null)throw Jn.alternate===null?Error(r(467)):Error(r(310));Qr=g,g={memoizedState:Qr.memoizedState,baseState:Qr.baseState,baseQueue:Qr.baseQueue,queue:Qr.queue,next:null},Ba===null?Jn.memoizedState=Ba=g:Ba=Ba.next=g}return Ba}function u7(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ax(g){var v=ix;return ix+=1,B1===null&&(B1=[]),g=HB(B1,g,v),v=Jn,(Ba===null?v.memoizedState:Ba.next)===null&&(v=v.alternate,U.H=v===null||v.memoizedState===null?kz:Az),g}function H3(g){if(g!==null&&typeof g=="object"){if(typeof g.then=="function")return ax(g);if(g.$$typeof===C)return us(g)}throw Error(r(438,String(g)))}function f7(g){var v=null,b=Jn.updateQueue;if(b!==null&&(v=b.memoCache),v==null){var E=Jn.alternate;E!==null&&(E=E.updateQueue,E!==null&&(E=E.memoCache,E!=null&&(v={data:E.data.map(function(R){return R.slice()}),index:0})))}if(v==null&&(v={data:[],index:0}),b===null&&(b=u7(),Jn.updateQueue=b),b.memoCache=v,b=v.data[v.index],b===void 0)for(b=v.data[v.index]=Array(g),E=0;E<g;E++)b[E]=k;return v.index++,b}function n0(g,v){return typeof v=="function"?v(g):v}function q3(g){var v=za();return d7(v,Qr,g)}function d7(g,v,b){var E=g.queue;if(E===null)throw Error(r(311));E.lastRenderedReducer=b;var R=g.baseQueue,N=E.pending;if(N!==null){if(R!==null){var Z=R.next;R.next=N.next,N.next=Z}v.baseQueue=R=N,E.pending=null}if(N=g.baseState,R===null)g.memoizedState=N;else{v=R.next;var ce=Z=null,Se=null,$e=v,nt=!1;do{var lt=$e.lane&-536870913;if(lt!==$e.lane?(xr&lt)===lt:(jh&lt)===lt){var Fe=$e.revertLane;if(Fe===0)Se!==null&&(Se=Se.next={lane:0,revertLane:0,action:$e.action,hasEagerState:$e.hasEagerState,eagerState:$e.eagerState,next:null}),lt===$1&&(nt=!0);else if((jh&Fe)===Fe){$e=$e.next,Fe===$1&&(nt=!0);continue}else lt={lane:0,revertLane:$e.revertLane,action:$e.action,hasEagerState:$e.hasEagerState,eagerState:$e.eagerState,next:null},Se===null?(ce=Se=lt,Z=N):Se=Se.next=lt,Jn.lanes|=Fe,Hh|=Fe;lt=$e.action,Pp&&b(N,lt),N=$e.hasEagerState?$e.eagerState:b(N,lt)}else Fe={lane:lt,revertLane:$e.revertLane,action:$e.action,hasEagerState:$e.hasEagerState,eagerState:$e.eagerState,next:null},Se===null?(ce=Se=Fe,Z=N):Se=Se.next=Fe,Jn.lanes|=lt,Hh|=lt;$e=$e.next}while($e!==null&&$e!==v);if(Se===null?Z=N:Se.next=ce,!le(N,g.memoizedState)&&(_o=!0,nt&&(b=j1,b!==null)))throw b;g.memoizedState=N,g.baseState=Z,g.baseQueue=Se,E.lastRenderedState=N}return R===null&&(E.lanes=0),[g.memoizedState,E.dispatch]}function h7(g){var v=za(),b=v.queue;if(b===null)throw Error(r(311));b.lastRenderedReducer=g;var E=b.dispatch,R=b.pending,N=v.memoizedState;if(R!==null){b.pending=null;var Z=R=R.next;do N=g(N,Z.action),Z=Z.next;while(Z!==R);le(N,v.memoizedState)||(_o=!0),v.memoizedState=N,v.baseQueue===null&&(v.baseState=N),b.lastRenderedState=N}return[N,E]}function ez(g,v,b){var E=Jn,R=za(),N=Pr;if(N){if(b===void 0)throw Error(r(407));b=b()}else b=v();var Z=!le((Qr||R).memoizedState,b);Z&&(R.memoizedState=b,_o=!0),R=R.queue;var ce=rz.bind(null,E,R,g);if(ox(2048,8,ce,[g]),R.getSnapshot!==v||Z||Ba!==null&&Ba.memoizedState.tag&1){if(E.flags|=2048,z1(9,K3(),nz.bind(null,E,R,b,v),null),fi===null)throw Error(r(349));N||(jh&124)!==0||tz(E,v,b)}return b}function tz(g,v,b){g.flags|=16384,g={getSnapshot:v,value:b},v=Jn.updateQueue,v===null?(v=u7(),Jn.updateQueue=v,v.stores=[g]):(b=v.stores,b===null?v.stores=[g]:b.push(g))}function nz(g,v,b,E){v.value=b,v.getSnapshot=E,iz(v)&&az(g)}function rz(g,v,b){return b(function(){iz(v)&&az(g)})}function iz(g){var v=g.getSnapshot;g=g.value;try{var b=v();return!le(g,b)}catch{return!0}}function az(g){var v=k1(g,2);v!==null&&nl(v,g,2)}function g7(g){var v=xc();if(typeof g=="function"){var b=g;if(g=b(),Pp){wt(!0);try{b()}finally{wt(!1)}}}return v.memoizedState=v.baseState=g,v.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n0,lastRenderedState:g},v}function oz(g,v,b,E){return g.baseState=b,d7(g,Qr,typeof E=="function"?E:n0)}function jCe(g,v,b,E,R){if(X3(g))throw Error(r(485));if(g=v.action,g!==null){var N={payload:R,action:g,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(Z){N.listeners.push(Z)}};U.T!==null?b(!0):N.isTransition=!1,E(N),b=v.pending,b===null?(N.next=v.pending=N,sz(v,N)):(N.next=b.next,v.pending=b.next=N)}}function sz(g,v){var b=v.action,E=v.payload,R=g.state;if(v.isTransition){var N=U.T,Z={};U.T=Z;try{var ce=b(R,E),Se=U.S;Se!==null&&Se(Z,ce),cz(g,v,ce)}catch($e){p7(g,v,$e)}finally{U.T=N}}else try{N=b(R,E),cz(g,v,N)}catch($e){p7(g,v,$e)}}function cz(g,v,b){b!==null&&typeof b=="object"&&typeof b.then=="function"?b.then(function(E){lz(g,v,E)},function(E){return p7(g,v,E)}):lz(g,v,b)}function lz(g,v,b){v.status="fulfilled",v.value=b,uz(v),g.state=b,v=g.pending,v!==null&&(b=v.next,b===v?g.pending=null:(b=b.next,v.next=b,sz(g,b)))}function p7(g,v,b){var E=g.pending;if(g.pending=null,E!==null){E=E.next;do v.status="rejected",v.reason=b,uz(v),v=v.next;while(v!==E)}g.action=null}function uz(g){g=g.listeners;for(var v=0;v<g.length;v++)(0,g[v])()}function fz(g,v){return v}function dz(g,v){if(Pr){var b=fi.formState;if(b!==null){e:{var E=Jn;if(Pr){if(ca){t:{for(var R=ca,N=jf;R.nodeType!==8;){if(!N){R=null;break t}if(R=Bu(R.nextSibling),R===null){R=null;break t}}N=R.data,R=N==="F!"||N==="F"?R:null}if(R){ca=Bu(R.nextSibling),E=R.data==="F!";break e}}Mp(E)}E=!1}E&&(v=b[0])}}return b=xc(),b.memoizedState=b.baseState=v,E={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fz,lastRenderedState:v},b.queue=E,b=Iz.bind(null,Jn,E),E.dispatch=b,E=g7(!1),N=w7.bind(null,Jn,!1,E.queue),E=xc(),R={state:v,dispatch:null,action:g,pending:null},E.queue=R,b=jCe.bind(null,Jn,R,N,b),R.dispatch=b,E.memoizedState=g,[v,b,!1]}function hz(g){var v=za();return gz(v,Qr,g)}function gz(g,v,b){if(v=d7(g,v,fz)[0],g=q3(n0)[0],typeof v=="object"&&v!==null&&typeof v.then=="function")try{var E=ax(v)}catch(Z){throw Z===J2?F3:Z}else E=v;v=za();var R=v.queue,N=R.dispatch;return b!==v.memoizedState&&(Jn.flags|=2048,z1(9,K3(),UCe.bind(null,R,b),null)),[E,N,g]}function UCe(g,v){g.action=v}function pz(g){var v=za(),b=Qr;if(b!==null)return gz(v,b,g);za(),v=v.memoizedState,b=za();var E=b.queue.dispatch;return b.memoizedState=g,[v,E,!1]}function z1(g,v,b,E){return g={tag:g,create:b,deps:E,inst:v,next:null},v=Jn.updateQueue,v===null&&(v=u7(),Jn.updateQueue=v),b=v.lastEffect,b===null?v.lastEffect=g.next=g:(E=b.next,b.next=g,g.next=E,v.lastEffect=g),g}function K3(){return{destroy:void 0,resource:void 0}}function mz(){return za().memoizedState}function Y3(g,v,b,E){var R=xc();E=E===void 0?null:E,Jn.flags|=g,R.memoizedState=z1(1|v,K3(),b,E)}function ox(g,v,b,E){var R=za();E=E===void 0?null:E;var N=R.memoizedState.inst;Qr!==null&&E!==null&&a7(E,Qr.memoizedState.deps)?R.memoizedState=z1(v,N,b,E):(Jn.flags|=g,R.memoizedState=z1(1|v,N,b,E))}function vz(g,v){Y3(8390656,8,g,v)}function yz(g,v){ox(2048,8,g,v)}function xz(g,v){return ox(4,2,g,v)}function wz(g,v){return ox(4,4,g,v)}function bz(g,v){if(typeof v=="function"){g=g();var b=v(g);return function(){typeof b=="function"?b():v(null)}}if(v!=null)return g=g(),v.current=g,function(){v.current=null}}function Sz(g,v,b){b=b!=null?b.concat([g]):null,ox(4,4,bz.bind(null,v,g),b)}function m7(){}function Cz(g,v){var b=za();v=v===void 0?null:v;var E=b.memoizedState;return v!==null&&a7(v,E[1])?E[0]:(b.memoizedState=[g,v],g)}function _z(g,v){var b=za();v=v===void 0?null:v;var E=b.memoizedState;if(v!==null&&a7(v,E[1]))return E[0];if(E=g(),Pp){wt(!0);try{g()}finally{wt(!1)}}return b.memoizedState=[E,v],E}function v7(g,v,b){return b===void 0||(jh&1073741824)!==0?g.memoizedState=v:(g.memoizedState=b,g=OG(),Jn.lanes|=g,Hh|=g,b)}function Tz(g,v,b,E){return le(b,v)?b:U1.current!==null?(g=v7(g,b,E),le(g,v)||(_o=!0),g):(jh&42)===0?(_o=!0,g.memoizedState=b):(g=OG(),Jn.lanes|=g,Hh|=g,v)}function Ez(g,v,b,E,R){var N=Y.p;Y.p=N!==0&&8>N?N:8;var Z=U.T,ce={};U.T=ce,w7(g,!1,v,b);try{var Se=R(),$e=U.S;if($e!==null&&$e(ce,Se),Se!==null&&typeof Se=="object"&&typeof Se.then=="function"){var nt=LCe(Se,E);sx(g,v,nt,tl(g))}else sx(g,v,E,tl(g))}catch(lt){sx(g,v,{then:function(){},status:"rejected",reason:lt},tl())}finally{Y.p=N,U.T=Z}}function FCe(){}function y7(g,v,b,E){if(g.tag!==5)throw Error(r(476));var R=Oz(g).queue;Ez(g,R,v,J,b===null?FCe:function(){return Dz(g),b(E)})}function Oz(g){var v=g.memoizedState;if(v!==null)return v;v={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:n0,lastRenderedState:J},next:null};var b={};return v.next={memoizedState:b,baseState:b,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:n0,lastRenderedState:b},next:null},g.memoizedState=v,g=g.alternate,g!==null&&(g.memoizedState=v),v}function Dz(g){var v=Oz(g).next.queue;sx(g,v,{},tl())}function x7(){return us(Tx)}function Mz(){return za().memoizedState}function Rz(){return za().memoizedState}function BCe(g){for(var v=g.return;v!==null;){switch(v.tag){case 24:case 3:var b=tl();g=Vh(b);var E=$h(v,g,b);E!==null&&(nl(E,v,b),tx(E,v,b)),v={cache:Y9()},g.payload=v;return}v=v.return}}function zCe(g,v,b){var E=tl();b={lane:E,revertLane:0,action:b,hasEagerState:!1,eagerState:null,next:null},X3(g)?Nz(v,b):(b=j9(g,v,b,E),b!==null&&(nl(b,g,E),Pz(b,v,E)))}function Iz(g,v,b){var E=tl();sx(g,v,b,E)}function sx(g,v,b,E){var R={lane:E,revertLane:0,action:b,hasEagerState:!1,eagerState:null,next:null};if(X3(g))Nz(v,R);else{var N=g.alternate;if(g.lanes===0&&(N===null||N.lanes===0)&&(N=v.lastRenderedReducer,N!==null))try{var Z=v.lastRenderedState,ce=N(Z,b);if(R.hasEagerState=!0,R.eagerState=ce,le(ce,Z))return P3(g,v,R,0),fi===null&&N3(),!1}catch{}finally{}if(b=j9(g,v,R,E),b!==null)return nl(b,g,E),Pz(b,v,E),!0}return!1}function w7(g,v,b,E){if(E={lane:2,revertLane:Q7(),action:E,hasEagerState:!1,eagerState:null,next:null},X3(g)){if(v)throw Error(r(479))}else v=j9(g,b,E,2),v!==null&&nl(v,g,2)}function X3(g){var v=g.alternate;return g===Jn||v!==null&&v===Jn}function Nz(g,v){F1=G3=!0;var b=g.pending;b===null?v.next=v:(v.next=b.next,b.next=v),g.pending=v}function Pz(g,v,b){if((b&4194048)!==0){var E=v.lanes;E&=g.pendingLanes,b|=E,v.lanes=b,Un(g,b)}}var Z3={readContext:us,use:H3,useCallback:Ca,useContext:Ca,useEffect:Ca,useImperativeHandle:Ca,useLayoutEffect:Ca,useInsertionEffect:Ca,useMemo:Ca,useReducer:Ca,useRef:Ca,useState:Ca,useDebugValue:Ca,useDeferredValue:Ca,useTransition:Ca,useSyncExternalStore:Ca,useId:Ca,useHostTransitionStatus:Ca,useFormState:Ca,useActionState:Ca,useOptimistic:Ca,useMemoCache:Ca,useCacheRefresh:Ca},kz={readContext:us,use:H3,useCallback:function(g,v){return xc().memoizedState=[g,v===void 0?null:v],g},useContext:us,useEffect:vz,useImperativeHandle:function(g,v,b){b=b!=null?b.concat([g]):null,Y3(4194308,4,bz.bind(null,v,g),b)},useLayoutEffect:function(g,v){return Y3(4194308,4,g,v)},useInsertionEffect:function(g,v){Y3(4,2,g,v)},useMemo:function(g,v){var b=xc();v=v===void 0?null:v;var E=g();if(Pp){wt(!0);try{g()}finally{wt(!1)}}return b.memoizedState=[E,v],E},useReducer:function(g,v,b){var E=xc();if(b!==void 0){var R=b(v);if(Pp){wt(!0);try{b(v)}finally{wt(!1)}}}else R=v;return E.memoizedState=E.baseState=R,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:R},E.queue=g,g=g.dispatch=zCe.bind(null,Jn,g),[E.memoizedState,g]},useRef:function(g){var v=xc();return g={current:g},v.memoizedState=g},useState:function(g){g=g7(g);var v=g.queue,b=Iz.bind(null,Jn,v);return v.dispatch=b,[g.memoizedState,b]},useDebugValue:m7,useDeferredValue:function(g,v){var b=xc();return v7(b,g,v)},useTransition:function(){var g=g7(!1);return g=Ez.bind(null,Jn,g.queue,!0,!1),xc().memoizedState=g,[!1,g]},useSyncExternalStore:function(g,v,b){var E=Jn,R=xc();if(Pr){if(b===void 0)throw Error(r(407));b=b()}else{if(b=v(),fi===null)throw Error(r(349));(xr&124)!==0||tz(E,v,b)}R.memoizedState=b;var N={value:b,getSnapshot:v};return R.queue=N,vz(rz.bind(null,E,N,g),[g]),E.flags|=2048,z1(9,K3(),nz.bind(null,E,N,b,v),null),b},useId:function(){var g=xc(),v=fi.identifierPrefix;if(Pr){var b=Jd,E=Qd;b=(E&~(1<<32-Pt(E)-1)).toString(32)+b,v="«"+v+"R"+b,b=W3++,0<b&&(v+="H"+b.toString(32)),v+="»"}else b=VCe++,v="«"+v+"r"+b.toString(32)+"»";return g.memoizedState=v},useHostTransitionStatus:x7,useFormState:dz,useActionState:dz,useOptimistic:function(g){var v=xc();v.memoizedState=v.baseState=g;var b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return v.queue=b,v=w7.bind(null,Jn,!0,b),b.dispatch=v,[g,v]},useMemoCache:f7,useCacheRefresh:function(){return xc().memoizedState=BCe.bind(null,Jn)}},Az={readContext:us,use:H3,useCallback:Cz,useContext:us,useEffect:yz,useImperativeHandle:Sz,useInsertionEffect:xz,useLayoutEffect:wz,useMemo:_z,useReducer:q3,useRef:mz,useState:function(){return q3(n0)},useDebugValue:m7,useDeferredValue:function(g,v){var b=za();return Tz(b,Qr.memoizedState,g,v)},useTransition:function(){var g=q3(n0)[0],v=za().memoizedState;return[typeof g=="boolean"?g:ax(g),v]},useSyncExternalStore:ez,useId:Mz,useHostTransitionStatus:x7,useFormState:hz,useActionState:hz,useOptimistic:function(g,v){var b=za();return oz(b,Qr,g,v)},useMemoCache:f7,useCacheRefresh:Rz},GCe={readContext:us,use:H3,useCallback:Cz,useContext:us,useEffect:yz,useImperativeHandle:Sz,useInsertionEffect:xz,useLayoutEffect:wz,useMemo:_z,useReducer:h7,useRef:mz,useState:function(){return h7(n0)},useDebugValue:m7,useDeferredValue:function(g,v){var b=za();return Qr===null?v7(b,g,v):Tz(b,Qr.memoizedState,g,v)},useTransition:function(){var g=h7(n0)[0],v=za().memoizedState;return[typeof g=="boolean"?g:ax(g),v]},useSyncExternalStore:ez,useId:Mz,useHostTransitionStatus:x7,useFormState:pz,useActionState:pz,useOptimistic:function(g,v){var b=za();return Qr!==null?oz(b,Qr,g,v):(b.baseState=g,[g,b.queue.dispatch])},useMemoCache:f7,useCacheRefresh:Rz},G1=null,cx=0;function Q3(g){var v=cx;return cx+=1,G1===null&&(G1=[]),HB(G1,g,v)}function lx(g,v){v=v.props.ref,g.ref=v!==void 0?v:null}function J3(g,v){throw v.$$typeof===f?Error(r(525)):(g=Object.prototype.toString.call(v),Error(r(31,g==="[object Object]"?"object with keys {"+Object.keys(v).join(", ")+"}":g)))}function Lz(g){var v=g._init;return v(g._payload)}function Vz(g){function v(Ne,De){if(g){var Ve=Ne.deletions;Ve===null?(Ne.deletions=[De],Ne.flags|=16):Ve.push(De)}}function b(Ne,De){if(!g)return null;for(;De!==null;)v(Ne,De),De=De.sibling;return null}function E(Ne){for(var De=new Map;Ne!==null;)Ne.key!==null?De.set(Ne.key,Ne):De.set(Ne.index,Ne),Ne=Ne.sibling;return De}function R(Ne,De){return Ne=Zd(Ne,De),Ne.index=0,Ne.sibling=null,Ne}function N(Ne,De,Ve){return Ne.index=Ve,g?(Ve=Ne.alternate,Ve!==null?(Ve=Ve.index,Ve<De?(Ne.flags|=67108866,De):Ve):(Ne.flags|=67108866,De)):(Ne.flags|=1048576,De)}function Z(Ne){return g&&Ne.alternate===null&&(Ne.flags|=67108866),Ne}function ce(Ne,De,Ve,st){return De===null||De.tag!==6?(De=F9(Ve,Ne.mode,st),De.return=Ne,De):(De=R(De,Ve),De.return=Ne,De)}function Se(Ne,De,Ve,st){var Ft=Ve.type;return Ft===m?nt(Ne,De,Ve.props.children,st,Ve.key):De!==null&&(De.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===I&&Lz(Ft)===De.type)?(De=R(De,Ve.props),lx(De,Ve),De.return=Ne,De):(De=A3(Ve.type,Ve.key,Ve.props,null,Ne.mode,st),lx(De,Ve),De.return=Ne,De)}function $e(Ne,De,Ve,st){return De===null||De.tag!==4||De.stateNode.containerInfo!==Ve.containerInfo||De.stateNode.implementation!==Ve.implementation?(De=B9(Ve,Ne.mode,st),De.return=Ne,De):(De=R(De,Ve.children||[]),De.return=Ne,De)}function nt(Ne,De,Ve,st,Ft){return De===null||De.tag!==7?(De=Tp(Ve,Ne.mode,st,Ft),De.return=Ne,De):(De=R(De,Ve),De.return=Ne,De)}function lt(Ne,De,Ve){if(typeof De=="string"&&De!==""||typeof De=="number"||typeof De=="bigint")return De=F9(""+De,Ne.mode,Ve),De.return=Ne,De;if(typeof De=="object"&&De!==null){switch(De.$$typeof){case d:return Ve=A3(De.type,De.key,De.props,null,Ne.mode,Ve),lx(Ve,De),Ve.return=Ne,Ve;case h:return De=B9(De,Ne.mode,Ve),De.return=Ne,De;case I:var st=De._init;return De=st(De._payload),lt(Ne,De,Ve)}if(oe(De)||$(De))return De=Tp(De,Ne.mode,Ve,null),De.return=Ne,De;if(typeof De.then=="function")return lt(Ne,Q3(De),Ve);if(De.$$typeof===C)return lt(Ne,j3(Ne,De),Ve);J3(Ne,De)}return null}function Fe(Ne,De,Ve,st){var Ft=De!==null?De.key:null;if(typeof Ve=="string"&&Ve!==""||typeof Ve=="number"||typeof Ve=="bigint")return Ft!==null?null:ce(Ne,De,""+Ve,st);if(typeof Ve=="object"&&Ve!==null){switch(Ve.$$typeof){case d:return Ve.key===Ft?Se(Ne,De,Ve,st):null;case h:return Ve.key===Ft?$e(Ne,De,Ve,st):null;case I:return Ft=Ve._init,Ve=Ft(Ve._payload),Fe(Ne,De,Ve,st)}if(oe(Ve)||$(Ve))return Ft!==null?null:nt(Ne,De,Ve,st,null);if(typeof Ve.then=="function")return Fe(Ne,De,Q3(Ve),st);if(Ve.$$typeof===C)return Fe(Ne,De,j3(Ne,Ve),st);J3(Ne,Ve)}return null}function ze(Ne,De,Ve,st,Ft){if(typeof st=="string"&&st!==""||typeof st=="number"||typeof st=="bigint")return Ne=Ne.get(Ve)||null,ce(De,Ne,""+st,Ft);if(typeof st=="object"&&st!==null){switch(st.$$typeof){case d:return Ne=Ne.get(st.key===null?Ve:st.key)||null,Se(De,Ne,st,Ft);case h:return Ne=Ne.get(st.key===null?Ve:st.key)||null,$e(De,Ne,st,Ft);case I:var nr=st._init;return st=nr(st._payload),ze(Ne,De,Ve,st,Ft)}if(oe(st)||$(st))return Ne=Ne.get(Ve)||null,nt(De,Ne,st,Ft,null);if(typeof st.then=="function")return ze(Ne,De,Ve,Q3(st),Ft);if(st.$$typeof===C)return ze(Ne,De,Ve,j3(De,st),Ft);J3(De,st)}return null}function Cn(Ne,De,Ve,st){for(var Ft=null,nr=null,tn=De,yn=De=0,Eo=null;tn!==null&&yn<Ve.length;yn++){tn.index>yn?(Eo=tn,tn=null):Eo=tn.sibling;var Or=Fe(Ne,tn,Ve[yn],st);if(Or===null){tn===null&&(tn=Eo);break}g&&tn&&Or.alternate===null&&v(Ne,tn),De=N(Or,De,yn),nr===null?Ft=Or:nr.sibling=Or,nr=Or,tn=Eo}if(yn===Ve.length)return b(Ne,tn),Pr&&Op(Ne,yn),Ft;if(tn===null){for(;yn<Ve.length;yn++)tn=lt(Ne,Ve[yn],st),tn!==null&&(De=N(tn,De,yn),nr===null?Ft=tn:nr.sibling=tn,nr=tn);return Pr&&Op(Ne,yn),Ft}for(tn=E(tn);yn<Ve.length;yn++)Eo=ze(tn,Ne,yn,Ve[yn],st),Eo!==null&&(g&&Eo.alternate!==null&&tn.delete(Eo.key===null?yn:Eo.key),De=N(Eo,De,yn),nr===null?Ft=Eo:nr.sibling=Eo,nr=Eo);return g&&tn.forEach(function(tg){return v(Ne,tg)}),Pr&&Op(Ne,yn),Ft}function mn(Ne,De,Ve,st){if(Ve==null)throw Error(r(151));for(var Ft=null,nr=null,tn=De,yn=De=0,Eo=null,Or=Ve.next();tn!==null&&!Or.done;yn++,Or=Ve.next()){tn.index>yn?(Eo=tn,tn=null):Eo=tn.sibling;var tg=Fe(Ne,tn,Or.value,st);if(tg===null){tn===null&&(tn=Eo);break}g&&tn&&tg.alternate===null&&v(Ne,tn),De=N(tg,De,yn),nr===null?Ft=tg:nr.sibling=tg,nr=tg,tn=Eo}if(Or.done)return b(Ne,tn),Pr&&Op(Ne,yn),Ft;if(tn===null){for(;!Or.done;yn++,Or=Ve.next())Or=lt(Ne,Or.value,st),Or!==null&&(De=N(Or,De,yn),nr===null?Ft=Or:nr.sibling=Or,nr=Or);return Pr&&Op(Ne,yn),Ft}for(tn=E(tn);!Or.done;yn++,Or=Ve.next())Or=ze(tn,Ne,yn,Or.value,st),Or!==null&&(g&&Or.alternate!==null&&tn.delete(Or.key===null?yn:Or.key),De=N(Or,De,yn),nr===null?Ft=Or:nr.sibling=Or,nr=Or);return g&&tn.forEach(function(W_e){return v(Ne,W_e)}),Pr&&Op(Ne,yn),Ft}function ei(Ne,De,Ve,st){if(typeof Ve=="object"&&Ve!==null&&Ve.type===m&&Ve.key===null&&(Ve=Ve.props.children),typeof Ve=="object"&&Ve!==null){switch(Ve.$$typeof){case d:e:{for(var Ft=Ve.key;De!==null;){if(De.key===Ft){if(Ft=Ve.type,Ft===m){if(De.tag===7){b(Ne,De.sibling),st=R(De,Ve.props.children),st.return=Ne,Ne=st;break e}}else if(De.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===I&&Lz(Ft)===De.type){b(Ne,De.sibling),st=R(De,Ve.props),lx(st,Ve),st.return=Ne,Ne=st;break e}b(Ne,De);break}else v(Ne,De);De=De.sibling}Ve.type===m?(st=Tp(Ve.props.children,Ne.mode,st,Ve.key),st.return=Ne,Ne=st):(st=A3(Ve.type,Ve.key,Ve.props,null,Ne.mode,st),lx(st,Ve),st.return=Ne,Ne=st)}return Z(Ne);case h:e:{for(Ft=Ve.key;De!==null;){if(De.key===Ft)if(De.tag===4&&De.stateNode.containerInfo===Ve.containerInfo&&De.stateNode.implementation===Ve.implementation){b(Ne,De.sibling),st=R(De,Ve.children||[]),st.return=Ne,Ne=st;break e}else{b(Ne,De);break}else v(Ne,De);De=De.sibling}st=B9(Ve,Ne.mode,st),st.return=Ne,Ne=st}return Z(Ne);case I:return Ft=Ve._init,Ve=Ft(Ve._payload),ei(Ne,De,Ve,st)}if(oe(Ve))return Cn(Ne,De,Ve,st);if($(Ve)){if(Ft=$(Ve),typeof Ft!="function")throw Error(r(150));return Ve=Ft.call(Ve),mn(Ne,De,Ve,st)}if(typeof Ve.then=="function")return ei(Ne,De,Q3(Ve),st);if(Ve.$$typeof===C)return ei(Ne,De,j3(Ne,Ve),st);J3(Ne,Ve)}return typeof Ve=="string"&&Ve!==""||typeof Ve=="number"||typeof Ve=="bigint"?(Ve=""+Ve,De!==null&&De.tag===6?(b(Ne,De.sibling),st=R(De,Ve),st.return=Ne,Ne=st):(b(Ne,De),st=F9(Ve,Ne.mode,st),st.return=Ne,Ne=st),Z(Ne)):b(Ne,De)}return function(Ne,De,Ve,st){try{cx=0;var Ft=ei(Ne,De,Ve,st);return G1=null,Ft}catch(tn){if(tn===J2||tn===F3)throw tn;var nr=Zc(29,tn,null,Ne.mode);return nr.lanes=st,nr.return=Ne,nr}finally{}}}var W1=Vz(!0),$z=Vz(!1),Yl=ae(null),Uf=null;function Uh(g){var v=g.alternate;te(io,io.current&1),te(Yl,g),Uf===null&&(v===null||U1.current!==null||v.memoizedState!==null)&&(Uf=g)}function jz(g){if(g.tag===22){if(te(io,io.current),te(Yl,g),Uf===null){var v=g.alternate;v!==null&&v.memoizedState!==null&&(Uf=g)}}else Fh()}function Fh(){te(io,io.current),te(Yl,Yl.current)}function r0(g){re(Yl),Uf===g&&(Uf=null),re(io)}var io=ae(0);function e4(g){for(var v=g;v!==null;){if(v.tag===13){var b=v.memoizedState;if(b!==null&&(b=b.dehydrated,b===null||b.data==="$?"||uO(b)))return v}else if(v.tag===19&&v.memoizedProps.revealOrder!==void 0){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 b7(g,v,b,E){v=g.memoizedState,b=b(E,v),b=b==null?v:u({},v,b),g.memoizedState=b,g.lanes===0&&(g.updateQueue.baseState=b)}var S7={enqueueSetState:function(g,v,b){g=g._reactInternals;var E=tl(),R=Vh(E);R.payload=v,b!=null&&(R.callback=b),v=$h(g,R,E),v!==null&&(nl(v,g,E),tx(v,g,E))},enqueueReplaceState:function(g,v,b){g=g._reactInternals;var E=tl(),R=Vh(E);R.tag=1,R.payload=v,b!=null&&(R.callback=b),v=$h(g,R,E),v!==null&&(nl(v,g,E),tx(v,g,E))},enqueueForceUpdate:function(g,v){g=g._reactInternals;var b=tl(),E=Vh(b);E.tag=2,v!=null&&(E.callback=v),v=$h(g,E,b),v!==null&&(nl(v,g,b),tx(v,g,b))}};function Uz(g,v,b,E,R,N,Z){return g=g.stateNode,typeof g.shouldComponentUpdate=="function"?g.shouldComponentUpdate(E,N,Z):v.prototype&&v.prototype.isPureReactComponent?!he(b,E)||!he(R,N):!0}function Fz(g,v,b,E){g=v.state,typeof v.componentWillReceiveProps=="function"&&v.componentWillReceiveProps(b,E),typeof v.UNSAFE_componentWillReceiveProps=="function"&&v.UNSAFE_componentWillReceiveProps(b,E),v.state!==g&&S7.enqueueReplaceState(v,v.state,null)}function kp(g,v){var b=v;if("ref"in v){b={};for(var E in v)E!=="ref"&&(b[E]=v[E])}if(g=g.defaultProps){b===v&&(b=u({},b));for(var R in g)b[R]===void 0&&(b[R]=g[R])}return b}var t4=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)};function Bz(g){t4(g)}function zz(g){console.error(g)}function Gz(g){t4(g)}function n4(g,v){try{var b=g.onUncaughtError;b(v.value,{componentStack:v.stack})}catch(E){setTimeout(function(){throw E})}}function Wz(g,v,b){try{var E=g.onCaughtError;E(b.value,{componentStack:b.stack,errorBoundary:v.tag===1?v.stateNode:null})}catch(R){setTimeout(function(){throw R})}}function C7(g,v,b){return b=Vh(b),b.tag=3,b.payload={element:null},b.callback=function(){n4(g,v)},b}function Hz(g){return g=Vh(g),g.tag=3,g}function qz(g,v,b,E){var R=b.type.getDerivedStateFromError;if(typeof R=="function"){var N=E.value;g.payload=function(){return R(N)},g.callback=function(){Wz(v,b,E)}}var Z=b.stateNode;Z!==null&&typeof Z.componentDidCatch=="function"&&(g.callback=function(){Wz(v,b,E),typeof R!="function"&&(qh===null?qh=new Set([this]):qh.add(this));var ce=E.stack;this.componentDidCatch(E.value,{componentStack:ce!==null?ce:""})})}function WCe(g,v,b,E,R){if(b.flags|=32768,E!==null&&typeof E=="object"&&typeof E.then=="function"){if(v=b.alternate,v!==null&&X2(v,b,R,!0),b=Yl.current,b!==null){switch(b.tag){case 13:return Uf===null?q7():b.alternate===null&&la===0&&(la=3),b.flags&=-257,b.flags|=65536,b.lanes=R,E===Q9?b.flags|=16384:(v=b.updateQueue,v===null?b.updateQueue=new Set([E]):v.add(E),Y7(g,E,R)),!1;case 22:return b.flags|=65536,E===Q9?b.flags|=16384:(v=b.updateQueue,v===null?(v={transitions:null,markerInstances:null,retryQueue:new Set([E])},b.updateQueue=v):(b=v.retryQueue,b===null?v.retryQueue=new Set([E]):b.add(E)),Y7(g,E,R)),!1}throw Error(r(435,b.tag))}return Y7(g,E,R),q7(),!1}if(Pr)return v=Yl.current,v!==null?((v.flags&65536)===0&&(v.flags|=256),v.flags|=65536,v.lanes=R,E!==W9&&(g=Error(r(422),{cause:E}),Y2(Wl(g,b)))):(E!==W9&&(v=Error(r(423),{cause:E}),Y2(Wl(v,b))),g=g.current.alternate,g.flags|=65536,R&=-R,g.lanes|=R,E=Wl(E,b),R=C7(g.stateNode,E,R),t7(g,R),la!==4&&(la=2)),!1;var N=Error(r(520),{cause:E});if(N=Wl(N,b),mx===null?mx=[N]:mx.push(N),la!==4&&(la=2),v===null)return!0;E=Wl(E,b),b=v;do{switch(b.tag){case 3:return b.flags|=65536,g=R&-R,b.lanes|=g,g=C7(b.stateNode,E,g),t7(b,g),!1;case 1:if(v=b.type,N=b.stateNode,(b.flags&128)===0&&(typeof v.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&(qh===null||!qh.has(N))))return b.flags|=65536,R&=-R,b.lanes|=R,R=Hz(R),qz(R,g,b,E),t7(b,R),!1}b=b.return}while(b!==null);return!1}var Kz=Error(r(461)),_o=!1;function Ho(g,v,b,E){v.child=g===null?$z(v,null,b,E):W1(v,g.child,b,E)}function Yz(g,v,b,E,R){b=b.render;var N=v.ref;if("ref"in E){var Z={};for(var ce in E)ce!=="ref"&&(Z[ce]=E[ce])}else Z=E;return Ip(v),E=o7(g,v,b,Z,N,R),ce=s7(),g!==null&&!_o?(c7(g,v,R),i0(g,v,R)):(Pr&&ce&&z9(v),v.flags|=1,Ho(g,v,E,R),v.child)}function Xz(g,v,b,E,R){if(g===null){var N=b.type;return typeof N=="function"&&!U9(N)&&N.defaultProps===void 0&&b.compare===null?(v.tag=15,v.type=N,Zz(g,v,N,E,R)):(g=A3(b.type,null,E,v,v.mode,R),g.ref=v.ref,g.return=v,v.child=g)}if(N=g.child,!I7(g,R)){var Z=N.memoizedProps;if(b=b.compare,b=b!==null?b:he,b(Z,E)&&g.ref===v.ref)return i0(g,v,R)}return v.flags|=1,g=Zd(N,E),g.ref=v.ref,g.return=v,v.child=g}function Zz(g,v,b,E,R){if(g!==null){var N=g.memoizedProps;if(he(N,E)&&g.ref===v.ref)if(_o=!1,v.pendingProps=E=N,I7(g,R))(g.flags&131072)!==0&&(_o=!0);else return v.lanes=g.lanes,i0(g,v,R)}return _7(g,v,b,E,R)}function Qz(g,v,b){var E=v.pendingProps,R=E.children,N=g!==null?g.memoizedState:null;if(E.mode==="hidden"){if((v.flags&128)!==0){if(E=N!==null?N.baseLanes|b:b,g!==null){for(R=v.child=g.child,N=0;R!==null;)N=N|R.lanes|R.childLanes,R=R.sibling;v.childLanes=N&~E}else v.childLanes=0,v.child=null;return Jz(g,v,E,b)}if((b&536870912)!==0)v.memoizedState={baseLanes:0,cachePool:null},g!==null&&U3(v,N!==null?N.cachePool:null),N!==null?ZB(v,N):r7(),jz(v);else return v.lanes=v.childLanes=536870912,Jz(g,v,N!==null?N.baseLanes|b:b,b)}else N!==null?(U3(v,N.cachePool),ZB(v,N),Fh(),v.memoizedState=null):(g!==null&&U3(v,null),r7(),Fh());return Ho(g,v,R,b),v.child}function Jz(g,v,b,E){var R=Z9();return R=R===null?null:{parent:ro._currentValue,pool:R},v.memoizedState={baseLanes:b,cachePool:R},g!==null&&U3(v,null),r7(),jz(v),g!==null&&X2(g,v,E,!0),null}function r4(g,v){var b=v.ref;if(b===null)g!==null&&g.ref!==null&&(v.flags|=4194816);else{if(typeof b!="function"&&typeof b!="object")throw Error(r(284));(g===null||g.ref!==b)&&(v.flags|=4194816)}}function _7(g,v,b,E,R){return Ip(v),b=o7(g,v,b,E,void 0,R),E=s7(),g!==null&&!_o?(c7(g,v,R),i0(g,v,R)):(Pr&&E&&z9(v),v.flags|=1,Ho(g,v,b,R),v.child)}function eG(g,v,b,E,R,N){return Ip(v),v.updateQueue=null,b=JB(v,E,b,R),QB(g),E=s7(),g!==null&&!_o?(c7(g,v,N),i0(g,v,N)):(Pr&&E&&z9(v),v.flags|=1,Ho(g,v,b,N),v.child)}function tG(g,v,b,E,R){if(Ip(v),v.stateNode===null){var N=A1,Z=b.contextType;typeof Z=="object"&&Z!==null&&(N=us(Z)),N=new b(E,N),v.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,N.updater=S7,v.stateNode=N,N._reactInternals=v,N=v.stateNode,N.props=E,N.state=v.memoizedState,N.refs={},J9(v),Z=b.contextType,N.context=typeof Z=="object"&&Z!==null?us(Z):A1,N.state=v.memoizedState,Z=b.getDerivedStateFromProps,typeof Z=="function"&&(b7(v,b,Z,E),N.state=v.memoizedState),typeof b.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(Z=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),Z!==N.state&&S7.enqueueReplaceState(N,N.state,null),rx(v,E,N,R),nx(),N.state=v.memoizedState),typeof N.componentDidMount=="function"&&(v.flags|=4194308),E=!0}else if(g===null){N=v.stateNode;var ce=v.memoizedProps,Se=kp(b,ce);N.props=Se;var $e=N.context,nt=b.contextType;Z=A1,typeof nt=="object"&&nt!==null&&(Z=us(nt));var lt=b.getDerivedStateFromProps;nt=typeof lt=="function"||typeof N.getSnapshotBeforeUpdate=="function",ce=v.pendingProps!==ce,nt||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(ce||$e!==Z)&&Fz(v,N,E,Z),Lh=!1;var Fe=v.memoizedState;N.state=Fe,rx(v,E,N,R),nx(),$e=v.memoizedState,ce||Fe!==$e||Lh?(typeof lt=="function"&&(b7(v,b,lt,E),$e=v.memoizedState),(Se=Lh||Uz(v,b,Se,E,Fe,$e,Z))?(nt||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(v.flags|=4194308)):(typeof N.componentDidMount=="function"&&(v.flags|=4194308),v.memoizedProps=E,v.memoizedState=$e),N.props=E,N.state=$e,N.context=Z,E=Se):(typeof N.componentDidMount=="function"&&(v.flags|=4194308),E=!1)}else{N=v.stateNode,e7(g,v),Z=v.memoizedProps,nt=kp(b,Z),N.props=nt,lt=v.pendingProps,Fe=N.context,$e=b.contextType,Se=A1,typeof $e=="object"&&$e!==null&&(Se=us($e)),ce=b.getDerivedStateFromProps,($e=typeof ce=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(Z!==lt||Fe!==Se)&&Fz(v,N,E,Se),Lh=!1,Fe=v.memoizedState,N.state=Fe,rx(v,E,N,R),nx();var ze=v.memoizedState;Z!==lt||Fe!==ze||Lh||g!==null&&g.dependencies!==null&&$3(g.dependencies)?(typeof ce=="function"&&(b7(v,b,ce,E),ze=v.memoizedState),(nt=Lh||Uz(v,b,nt,E,Fe,ze,Se)||g!==null&&g.dependencies!==null&&$3(g.dependencies))?($e||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(E,ze,Se),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(E,ze,Se)),typeof N.componentDidUpdate=="function"&&(v.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(v.flags|=1024)):(typeof N.componentDidUpdate!="function"||Z===g.memoizedProps&&Fe===g.memoizedState||(v.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||Z===g.memoizedProps&&Fe===g.memoizedState||(v.flags|=1024),v.memoizedProps=E,v.memoizedState=ze),N.props=E,N.state=ze,N.context=Se,E=nt):(typeof N.componentDidUpdate!="function"||Z===g.memoizedProps&&Fe===g.memoizedState||(v.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||Z===g.memoizedProps&&Fe===g.memoizedState||(v.flags|=1024),E=!1)}return N=E,r4(g,v),E=(v.flags&128)!==0,N||E?(N=v.stateNode,b=E&&typeof b.getDerivedStateFromError!="function"?null:N.render(),v.flags|=1,g!==null&&E?(v.child=W1(v,g.child,null,R),v.child=W1(v,null,b,R)):Ho(g,v,b,R),v.memoizedState=N.state,g=v.child):g=i0(g,v,R),g}function nG(g,v,b,E){return K2(),v.flags|=256,Ho(g,v,b,E),v.child}var T7={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function E7(g){return{baseLanes:g,cachePool:zB()}}function O7(g,v,b){return g=g!==null?g.childLanes&~b:0,v&&(g|=Xl),g}function rG(g,v,b){var E=v.pendingProps,R=!1,N=(v.flags&128)!==0,Z;if((Z=N)||(Z=g!==null&&g.memoizedState===null?!1:(io.current&2)!==0),Z&&(R=!0,v.flags&=-129),Z=(v.flags&32)!==0,v.flags&=-33,g===null){if(Pr){if(R?Uh(v):Fh(),Pr){var ce=ca,Se;if(Se=ce){e:{for(Se=ce,ce=jf;Se.nodeType!==8;){if(!ce){ce=null;break e}if(Se=Bu(Se.nextSibling),Se===null){ce=null;break e}}ce=Se}ce!==null?(v.memoizedState={dehydrated:ce,treeContext:Ep!==null?{id:Qd,overflow:Jd}:null,retryLane:536870912,hydrationErrors:null},Se=Zc(18,null,null,0),Se.stateNode=ce,Se.return=v,v.child=Se,js=v,ca=null,Se=!0):Se=!1}Se||Mp(v)}if(ce=v.memoizedState,ce!==null&&(ce=ce.dehydrated,ce!==null))return uO(ce)?v.lanes=32:v.lanes=536870912,null;r0(v)}return ce=E.children,E=E.fallback,R?(Fh(),R=v.mode,ce=i4({mode:"hidden",children:ce},R),E=Tp(E,R,b,null),ce.return=v,E.return=v,ce.sibling=E,v.child=ce,R=v.child,R.memoizedState=E7(b),R.childLanes=O7(g,Z,b),v.memoizedState=T7,E):(Uh(v),D7(v,ce))}if(Se=g.memoizedState,Se!==null&&(ce=Se.dehydrated,ce!==null)){if(N)v.flags&256?(Uh(v),v.flags&=-257,v=M7(g,v,b)):v.memoizedState!==null?(Fh(),v.child=g.child,v.flags|=128,v=null):(Fh(),R=E.fallback,ce=v.mode,E=i4({mode:"visible",children:E.children},ce),R=Tp(R,ce,b,null),R.flags|=2,E.return=v,R.return=v,E.sibling=R,v.child=E,W1(v,g.child,null,b),E=v.child,E.memoizedState=E7(b),E.childLanes=O7(g,Z,b),v.memoizedState=T7,v=R);else if(Uh(v),uO(ce)){if(Z=ce.nextSibling&&ce.nextSibling.dataset,Z)var $e=Z.dgst;Z=$e,E=Error(r(419)),E.stack="",E.digest=Z,Y2({value:E,source:null,stack:null}),v=M7(g,v,b)}else if(_o||X2(g,v,b,!1),Z=(b&g.childLanes)!==0,_o||Z){if(Z=fi,Z!==null&&(E=b&-b,E=(E&42)!==0?1:Bn(E),E=(E&(Z.suspendedLanes|b))!==0?0:E,E!==0&&E!==Se.retryLane))throw Se.retryLane=E,k1(g,E),nl(Z,g,E),Kz;ce.data==="$?"||q7(),v=M7(g,v,b)}else ce.data==="$?"?(v.flags|=192,v.child=g.child,v=null):(g=Se.treeContext,ca=Bu(ce.nextSibling),js=v,Pr=!0,Dp=null,jf=!1,g!==null&&(ql[Kl++]=Qd,ql[Kl++]=Jd,ql[Kl++]=Ep,Qd=g.id,Jd=g.overflow,Ep=v),v=D7(v,E.children),v.flags|=4096);return v}return R?(Fh(),R=E.fallback,ce=v.mode,Se=g.child,$e=Se.sibling,E=Zd(Se,{mode:"hidden",children:E.children}),E.subtreeFlags=Se.subtreeFlags&65011712,$e!==null?R=Zd($e,R):(R=Tp(R,ce,b,null),R.flags|=2),R.return=v,E.return=v,E.sibling=R,v.child=E,E=R,R=v.child,ce=g.child.memoizedState,ce===null?ce=E7(b):(Se=ce.cachePool,Se!==null?($e=ro._currentValue,Se=Se.parent!==$e?{parent:$e,pool:$e}:Se):Se=zB(),ce={baseLanes:ce.baseLanes|b,cachePool:Se}),R.memoizedState=ce,R.childLanes=O7(g,Z,b),v.memoizedState=T7,E):(Uh(v),b=g.child,g=b.sibling,b=Zd(b,{mode:"visible",children:E.children}),b.return=v,b.sibling=null,g!==null&&(Z=v.deletions,Z===null?(v.deletions=[g],v.flags|=16):Z.push(g)),v.child=b,v.memoizedState=null,b)}function D7(g,v){return v=i4({mode:"visible",children:v},g.mode),v.return=g,g.child=v}function i4(g,v){return g=Zc(22,g,null,v),g.lanes=0,g.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},g}function M7(g,v,b){return W1(v,g.child,null,b),g=D7(v,v.pendingProps.children),g.flags|=2,v.memoizedState=null,g}function iG(g,v,b){g.lanes|=v;var E=g.alternate;E!==null&&(E.lanes|=v),q9(g.return,v,b)}function R7(g,v,b,E,R){var N=g.memoizedState;N===null?g.memoizedState={isBackwards:v,rendering:null,renderingStartTime:0,last:E,tail:b,tailMode:R}:(N.isBackwards=v,N.rendering=null,N.renderingStartTime=0,N.last=E,N.tail=b,N.tailMode=R)}function aG(g,v,b){var E=v.pendingProps,R=E.revealOrder,N=E.tail;if(Ho(g,v,E.children,b),E=io.current,(E&2)!==0)E=E&1|2,v.flags|=128;else{if(g!==null&&(g.flags&128)!==0)e:for(g=v.child;g!==null;){if(g.tag===13)g.memoizedState!==null&&iG(g,b,v);else if(g.tag===19)iG(g,b,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}E&=1}switch(te(io,E),R){case"forwards":for(b=v.child,R=null;b!==null;)g=b.alternate,g!==null&&e4(g)===null&&(R=b),b=b.sibling;b=R,b===null?(R=v.child,v.child=null):(R=b.sibling,b.sibling=null),R7(v,!1,R,b,N);break;case"backwards":for(b=null,R=v.child,v.child=null;R!==null;){if(g=R.alternate,g!==null&&e4(g)===null){v.child=R;break}g=R.sibling,R.sibling=b,b=R,R=g}R7(v,!0,b,null,N);break;case"together":R7(v,!1,null,null,void 0);break;default:v.memoizedState=null}return v.child}function i0(g,v,b){if(g!==null&&(v.dependencies=g.dependencies),Hh|=v.lanes,(b&v.childLanes)===0)if(g!==null){if(X2(g,v,b,!1),(b&v.childLanes)===0)return null}else return null;if(g!==null&&v.child!==g.child)throw Error(r(153));if(v.child!==null){for(g=v.child,b=Zd(g,g.pendingProps),v.child=b,b.return=v;g.sibling!==null;)g=g.sibling,b=b.sibling=Zd(g,g.pendingProps),b.return=v;b.sibling=null}return v.child}function I7(g,v){return(g.lanes&v)!==0?!0:(g=g.dependencies,!!(g!==null&&$3(g)))}function HCe(g,v,b){switch(v.tag){case 3:Me(v,v.stateNode.containerInfo),Ah(v,ro,g.memoizedState.cache),K2();break;case 27:case 5:Ye(v);break;case 4:Me(v,v.stateNode.containerInfo);break;case 10:Ah(v,v.type,v.memoizedProps.value);break;case 13:var E=v.memoizedState;if(E!==null)return E.dehydrated!==null?(Uh(v),v.flags|=128,null):(b&v.child.childLanes)!==0?rG(g,v,b):(Uh(v),g=i0(g,v,b),g!==null?g.sibling:null);Uh(v);break;case 19:var R=(g.flags&128)!==0;if(E=(b&v.childLanes)!==0,E||(X2(g,v,b,!1),E=(b&v.childLanes)!==0),R){if(E)return aG(g,v,b);v.flags|=128}if(R=v.memoizedState,R!==null&&(R.rendering=null,R.tail=null,R.lastEffect=null),te(io,io.current),E)break;return null;case 22:case 23:return v.lanes=0,Qz(g,v,b);case 24:Ah(v,ro,g.memoizedState.cache)}return i0(g,v,b)}function oG(g,v,b){if(g!==null)if(g.memoizedProps!==v.pendingProps)_o=!0;else{if(!I7(g,b)&&(v.flags&128)===0)return _o=!1,HCe(g,v,b);_o=(g.flags&131072)!==0}else _o=!1,Pr&&(v.flags&1048576)!==0&&LB(v,V3,v.index);switch(v.lanes=0,v.tag){case 16:e:{g=v.pendingProps;var E=v.elementType,R=E._init;if(E=R(E._payload),v.type=E,typeof E=="function")U9(E)?(g=kp(E,g),v.tag=1,v=tG(null,v,E,g,b)):(v.tag=0,v=_7(null,v,E,g,b));else{if(E!=null){if(R=E.$$typeof,R===_){v.tag=11,v=Yz(null,v,E,g,b);break e}else if(R===M){v.tag=14,v=Xz(null,v,E,g,b);break e}}throw v=G(E)||E,Error(r(306,v,""))}}return v;case 0:return _7(g,v,v.type,v.pendingProps,b);case 1:return E=v.type,R=kp(E,v.pendingProps),tG(g,v,E,R,b);case 3:e:{if(Me(v,v.stateNode.containerInfo),g===null)throw Error(r(387));E=v.pendingProps;var N=v.memoizedState;R=N.element,e7(g,v),rx(v,E,null,b);var Z=v.memoizedState;if(E=Z.cache,Ah(v,ro,E),E!==N.cache&&K9(v,[ro],b,!0),nx(),E=Z.element,N.isDehydrated)if(N={element:E,isDehydrated:!1,cache:Z.cache},v.updateQueue.baseState=N,v.memoizedState=N,v.flags&256){v=nG(g,v,E,b);break e}else if(E!==R){R=Wl(Error(r(424)),v),Y2(R),v=nG(g,v,E,b);break e}else{switch(g=v.stateNode.containerInfo,g.nodeType){case 9:g=g.body;break;default:g=g.nodeName==="HTML"?g.ownerDocument.body:g}for(ca=Bu(g.firstChild),js=v,Pr=!0,Dp=null,jf=!0,b=$z(v,null,E,b),v.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling}else{if(K2(),E===R){v=i0(g,v,b);break e}Ho(g,v,E,b)}v=v.child}return v;case 26:return r4(g,v),g===null?(b=uW(v.type,null,v.pendingProps,null))?v.memoizedState=b:Pr||(b=v.type,g=v.pendingProps,E=y4(Oe.current).createElement(b),E[Dt]=v,E[Gt]=g,Ko(E,b,g),Zt(E),v.stateNode=E):v.memoizedState=uW(v.type,g.memoizedProps,v.pendingProps,g.memoizedState),null;case 27:return Ye(v),g===null&&Pr&&(E=v.stateNode=sW(v.type,v.pendingProps,Oe.current),js=v,jf=!0,R=ca,Xh(v.type)?(fO=R,ca=Bu(E.firstChild)):ca=R),Ho(g,v,v.pendingProps.children,b),r4(g,v),g===null&&(v.flags|=4194304),v.child;case 5:return g===null&&Pr&&((R=E=ca)&&(E=w_e(E,v.type,v.pendingProps,jf),E!==null?(v.stateNode=E,js=v,ca=Bu(E.firstChild),jf=!1,R=!0):R=!1),R||Mp(v)),Ye(v),R=v.type,N=v.pendingProps,Z=g!==null?g.memoizedProps:null,E=N.children,sO(R,N)?E=null:Z!==null&&sO(R,Z)&&(v.flags|=32),v.memoizedState!==null&&(R=o7(g,v,$Ce,null,null,b),Tx._currentValue=R),r4(g,v),Ho(g,v,E,b),v.child;case 6:return g===null&&Pr&&((g=b=ca)&&(b=b_e(b,v.pendingProps,jf),b!==null?(v.stateNode=b,js=v,ca=null,g=!0):g=!1),g||Mp(v)),null;case 13:return rG(g,v,b);case 4:return Me(v,v.stateNode.containerInfo),E=v.pendingProps,g===null?v.child=W1(v,null,E,b):Ho(g,v,E,b),v.child;case 11:return Yz(g,v,v.type,v.pendingProps,b);case 7:return Ho(g,v,v.pendingProps,b),v.child;case 8:return Ho(g,v,v.pendingProps.children,b),v.child;case 12:return Ho(g,v,v.pendingProps.children,b),v.child;case 10:return E=v.pendingProps,Ah(v,v.type,E.value),Ho(g,v,E.children,b),v.child;case 9:return R=v.type._context,E=v.pendingProps.children,Ip(v),R=us(R),E=E(R),v.flags|=1,Ho(g,v,E,b),v.child;case 14:return Xz(g,v,v.type,v.pendingProps,b);case 15:return Zz(g,v,v.type,v.pendingProps,b);case 19:return aG(g,v,b);case 31:return E=v.pendingProps,b=v.mode,E={mode:E.mode,children:E.children},g===null?(b=i4(E,b),b.ref=v.ref,v.child=b,b.return=v,v=b):(b=Zd(g.child,E),b.ref=v.ref,v.child=b,b.return=v,v=b),v;case 22:return Qz(g,v,b);case 24:return Ip(v),E=us(ro),g===null?(R=Z9(),R===null&&(R=fi,N=Y9(),R.pooledCache=N,N.refCount++,N!==null&&(R.pooledCacheLanes|=b),R=N),v.memoizedState={parent:E,cache:R},J9(v),Ah(v,ro,R)):((g.lanes&b)!==0&&(e7(g,v),rx(v,null,null,b),nx()),R=g.memoizedState,N=v.memoizedState,R.parent!==E?(R={parent:E,cache:E},v.memoizedState=R,v.lanes===0&&(v.memoizedState=v.updateQueue.baseState=R),Ah(v,ro,E)):(E=N.cache,Ah(v,ro,E),E!==R.cache&&K9(v,[ro],b,!0))),Ho(g,v,v.pendingProps.children,b),v.child;case 29:throw v.pendingProps}throw Error(r(156,v.tag))}function a0(g){g.flags|=4}function sG(g,v){if(v.type!=="stylesheet"||(v.state.loading&4)!==0)g.flags&=-16777217;else if(g.flags|=16777216,!pW(v)){if(v=Yl.current,v!==null&&((xr&4194048)===xr?Uf!==null:(xr&62914560)!==xr&&(xr&536870912)===0||v!==Uf))throw ex=Q9,GB;g.flags|=8192}}function a4(g,v){v!==null&&(g.flags|=4),g.flags&16384&&(v=g.tag!==22?jt():536870912,g.lanes|=v,Y1|=v)}function ux(g,v){if(!Pr)switch(g.tailMode){case"hidden":v=g.tail;for(var b=null;v!==null;)v.alternate!==null&&(b=v),v=v.sibling;b===null?g.tail=null:b.sibling=null;break;case"collapsed":b=g.tail;for(var E=null;b!==null;)b.alternate!==null&&(E=b),b=b.sibling;E===null?v||g.tail===null?g.tail=null:g.tail.sibling=null:E.sibling=null}}function Gi(g){var v=g.alternate!==null&&g.alternate.child===g.child,b=0,E=0;if(v)for(var R=g.child;R!==null;)b|=R.lanes|R.childLanes,E|=R.subtreeFlags&65011712,E|=R.flags&65011712,R.return=g,R=R.sibling;else for(R=g.child;R!==null;)b|=R.lanes|R.childLanes,E|=R.subtreeFlags,E|=R.flags,R.return=g,R=R.sibling;return g.subtreeFlags|=E,g.childLanes=b,v}function qCe(g,v,b){var E=v.pendingProps;switch(G9(v),v.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gi(v),null;case 1:return Gi(v),null;case 3:return b=v.stateNode,E=null,g!==null&&(E=g.memoizedState.cache),v.memoizedState.cache!==E&&(v.flags|=2048),t0(ro),be(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(g===null||g.child===null)&&(q2(v)?a0(v):g===null||g.memoizedState.isDehydrated&&(v.flags&256)===0||(v.flags|=1024,jB())),Gi(v),null;case 26:return b=v.memoizedState,g===null?(a0(v),b!==null?(Gi(v),sG(v,b)):(Gi(v),v.flags&=-16777217)):b?b!==g.memoizedState?(a0(v),Gi(v),sG(v,b)):(Gi(v),v.flags&=-16777217):(g.memoizedProps!==E&&a0(v),Gi(v),v.flags&=-16777217),null;case 27:ft(v),b=Oe.current;var R=v.type;if(g!==null&&v.stateNode!=null)g.memoizedProps!==E&&a0(v);else{if(!E){if(v.stateNode===null)throw Error(r(166));return Gi(v),null}g=ye.current,q2(v)?VB(v):(g=sW(R,E,b),v.stateNode=g,a0(v))}return Gi(v),null;case 5:if(ft(v),b=v.type,g!==null&&v.stateNode!=null)g.memoizedProps!==E&&a0(v);else{if(!E){if(v.stateNode===null)throw Error(r(166));return Gi(v),null}if(g=ye.current,q2(v))VB(v);else{switch(R=y4(Oe.current),g){case 1:g=R.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:g=R.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":g=R.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":g=R.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":g=R.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof E.is=="string"?R.createElement("select",{is:E.is}):R.createElement("select"),E.multiple?g.multiple=!0:E.size&&(g.size=E.size);break;default:g=typeof E.is=="string"?R.createElement(b,{is:E.is}):R.createElement(b)}}g[Dt]=v,g[Gt]=E;e:for(R=v.child;R!==null;){if(R.tag===5||R.tag===6)g.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===v)break e;for(;R.sibling===null;){if(R.return===null||R.return===v)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}v.stateNode=g;e:switch(Ko(g,b,E),b){case"button":case"input":case"select":case"textarea":g=!!E.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&a0(v)}}return Gi(v),v.flags&=-16777217,null;case 6:if(g&&v.stateNode!=null)g.memoizedProps!==E&&a0(v);else{if(typeof E!="string"&&v.stateNode===null)throw Error(r(166));if(g=Oe.current,q2(v)){if(g=v.stateNode,b=v.memoizedProps,E=null,R=js,R!==null)switch(R.tag){case 27:case 5:E=R.memoizedProps}g[Dt]=v,g=!!(g.nodeValue===b||E!==null&&E.suppressHydrationWarning===!0||eW(g.nodeValue,b)),g||Mp(v)}else g=y4(g).createTextNode(E),g[Dt]=v,v.stateNode=g}return Gi(v),null;case 13:if(E=v.memoizedState,g===null||g.memoizedState!==null&&g.memoizedState.dehydrated!==null){if(R=q2(v),E!==null&&E.dehydrated!==null){if(g===null){if(!R)throw Error(r(318));if(R=v.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(r(317));R[Dt]=v}else K2(),(v.flags&128)===0&&(v.memoizedState=null),v.flags|=4;Gi(v),R=!1}else R=jB(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=R),R=!0;if(!R)return v.flags&256?(r0(v),v):(r0(v),null)}if(r0(v),(v.flags&128)!==0)return v.lanes=b,v;if(b=E!==null,g=g!==null&&g.memoizedState!==null,b){E=v.child,R=null,E.alternate!==null&&E.alternate.memoizedState!==null&&E.alternate.memoizedState.cachePool!==null&&(R=E.alternate.memoizedState.cachePool.pool);var N=null;E.memoizedState!==null&&E.memoizedState.cachePool!==null&&(N=E.memoizedState.cachePool.pool),N!==R&&(E.flags|=2048)}return b!==g&&b&&(v.child.flags|=8192),a4(v,v.updateQueue),Gi(v),null;case 4:return be(),g===null&&nO(v.stateNode.containerInfo),Gi(v),null;case 10:return t0(v.type),Gi(v),null;case 19:if(re(io),R=v.memoizedState,R===null)return Gi(v),null;if(E=(v.flags&128)!==0,N=R.rendering,N===null)if(E)ux(R,!1);else{if(la!==0||g!==null&&(g.flags&128)!==0)for(g=v.child;g!==null;){if(N=e4(g),N!==null){for(v.flags|=128,ux(R,!1),g=N.updateQueue,v.updateQueue=g,a4(v,g),v.subtreeFlags=0,g=b,b=v.child;b!==null;)AB(b,g),b=b.sibling;return te(io,io.current&1|2),v.child}g=g.sibling}R.tail!==null&&en()>c4&&(v.flags|=128,E=!0,ux(R,!1),v.lanes=4194304)}else{if(!E)if(g=e4(N),g!==null){if(v.flags|=128,E=!0,g=g.updateQueue,v.updateQueue=g,a4(v,g),ux(R,!0),R.tail===null&&R.tailMode==="hidden"&&!N.alternate&&!Pr)return Gi(v),null}else 2*en()-R.renderingStartTime>c4&&b!==536870912&&(v.flags|=128,E=!0,ux(R,!1),v.lanes=4194304);R.isBackwards?(N.sibling=v.child,v.child=N):(g=R.last,g!==null?g.sibling=N:v.child=N,R.last=N)}return R.tail!==null?(v=R.tail,R.rendering=v,R.tail=v.sibling,R.renderingStartTime=en(),v.sibling=null,g=io.current,te(io,E?g&1|2:g&1),v):(Gi(v),null);case 22:case 23:return r0(v),i7(),E=v.memoizedState!==null,g!==null?g.memoizedState!==null!==E&&(v.flags|=8192):E&&(v.flags|=8192),E?(b&536870912)!==0&&(v.flags&128)===0&&(Gi(v),v.subtreeFlags&6&&(v.flags|=8192)):Gi(v),b=v.updateQueue,b!==null&&a4(v,b.retryQueue),b=null,g!==null&&g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(b=g.memoizedState.cachePool.pool),E=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(E=v.memoizedState.cachePool.pool),E!==b&&(v.flags|=2048),g!==null&&re(Np),null;case 24:return b=null,g!==null&&(b=g.memoizedState.cache),v.memoizedState.cache!==b&&(v.flags|=2048),t0(ro),Gi(v),null;case 25:return null;case 30:return null}throw Error(r(156,v.tag))}function KCe(g,v){switch(G9(v),v.tag){case 1:return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 3:return t0(ro),be(),g=v.flags,(g&65536)!==0&&(g&128)===0?(v.flags=g&-65537|128,v):null;case 26:case 27:case 5:return ft(v),null;case 13:if(r0(v),g=v.memoizedState,g!==null&&g.dehydrated!==null){if(v.alternate===null)throw Error(r(340));K2()}return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 19:return re(io),null;case 4:return be(),null;case 10:return t0(v.type),null;case 22:case 23:return r0(v),i7(),g!==null&&re(Np),g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 24:return t0(ro),null;case 25:return null;default:return null}}function cG(g,v){switch(G9(v),v.tag){case 3:t0(ro),be();break;case 26:case 27:case 5:ft(v);break;case 4:be();break;case 13:r0(v);break;case 19:re(io);break;case 10:t0(v.type);break;case 22:case 23:r0(v),i7(),g!==null&&re(Np);break;case 24:t0(ro)}}function fx(g,v){try{var b=v.updateQueue,E=b!==null?b.lastEffect:null;if(E!==null){var R=E.next;b=R;do{if((b.tag&g)===g){E=void 0;var N=b.create,Z=b.inst;E=N(),Z.destroy=E}b=b.next}while(b!==R)}}catch(ce){ai(v,v.return,ce)}}function Bh(g,v,b){try{var E=v.updateQueue,R=E!==null?E.lastEffect:null;if(R!==null){var N=R.next;E=N;do{if((E.tag&g)===g){var Z=E.inst,ce=Z.destroy;if(ce!==void 0){Z.destroy=void 0,R=v;var Se=b,$e=ce;try{$e()}catch(nt){ai(R,Se,nt)}}}E=E.next}while(E!==N)}}catch(nt){ai(v,v.return,nt)}}function lG(g){var v=g.updateQueue;if(v!==null){var b=g.stateNode;try{XB(v,b)}catch(E){ai(g,g.return,E)}}}function uG(g,v,b){b.props=kp(g.type,g.memoizedProps),b.state=g.memoizedState;try{b.componentWillUnmount()}catch(E){ai(g,v,E)}}function dx(g,v){try{var b=g.ref;if(b!==null){switch(g.tag){case 26:case 27:case 5:var E=g.stateNode;break;case 30:E=g.stateNode;break;default:E=g.stateNode}typeof b=="function"?g.refCleanup=b(E):b.current=E}}catch(R){ai(g,v,R)}}function Ff(g,v){var b=g.ref,E=g.refCleanup;if(b!==null)if(typeof E=="function")try{E()}catch(R){ai(g,v,R)}finally{g.refCleanup=null,g=g.alternate,g!=null&&(g.refCleanup=null)}else if(typeof b=="function")try{b(null)}catch(R){ai(g,v,R)}else b.current=null}function fG(g){var v=g.type,b=g.memoizedProps,E=g.stateNode;try{e:switch(v){case"button":case"input":case"select":case"textarea":b.autoFocus&&E.focus();break e;case"img":b.src?E.src=b.src:b.srcSet&&(E.srcset=b.srcSet)}}catch(R){ai(g,g.return,R)}}function N7(g,v,b){try{var E=g.stateNode;p_e(E,g.type,b,v),E[Gt]=v}catch(R){ai(g,g.return,R)}}function dG(g){return g.tag===5||g.tag===3||g.tag===26||g.tag===27&&Xh(g.type)||g.tag===4}function P7(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||dG(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(g.tag===27&&Xh(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 k7(g,v,b){var E=g.tag;if(E===5||E===6)g=g.stateNode,v?(b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b).insertBefore(g,v):(v=b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b,v.appendChild(g),b=b._reactRootContainer,b!=null||v.onclick!==null||(v.onclick=v4));else if(E!==4&&(E===27&&Xh(g.type)&&(b=g.stateNode,v=null),g=g.child,g!==null))for(k7(g,v,b),g=g.sibling;g!==null;)k7(g,v,b),g=g.sibling}function o4(g,v,b){var E=g.tag;if(E===5||E===6)g=g.stateNode,v?b.insertBefore(g,v):b.appendChild(g);else if(E!==4&&(E===27&&Xh(g.type)&&(b=g.stateNode),g=g.child,g!==null))for(o4(g,v,b),g=g.sibling;g!==null;)o4(g,v,b),g=g.sibling}function hG(g){var v=g.stateNode,b=g.memoizedProps;try{for(var E=g.type,R=v.attributes;R.length;)v.removeAttributeNode(R[0]);Ko(v,E,b),v[Dt]=g,v[Gt]=b}catch(N){ai(g,g.return,N)}}var o0=!1,_a=!1,A7=!1,gG=typeof WeakSet=="function"?WeakSet:Set,To=null;function YCe(g,v){if(g=g.containerInfo,aO=_4,g=ke(g),Xe(g)){if("selectionStart"in g)var b={start:g.selectionStart,end:g.selectionEnd};else e:{b=(b=g.ownerDocument)&&b.defaultView||window;var E=b.getSelection&&b.getSelection();if(E&&E.rangeCount!==0){b=E.anchorNode;var R=E.anchorOffset,N=E.focusNode;E=E.focusOffset;try{b.nodeType,N.nodeType}catch{b=null;break e}var Z=0,ce=-1,Se=-1,$e=0,nt=0,lt=g,Fe=null;t:for(;;){for(var ze;lt!==b||R!==0&&lt.nodeType!==3||(ce=Z+R),lt!==N||E!==0&&lt.nodeType!==3||(Se=Z+E),lt.nodeType===3&&(Z+=lt.nodeValue.length),(ze=lt.firstChild)!==null;)Fe=lt,lt=ze;for(;;){if(lt===g)break t;if(Fe===b&&++$e===R&&(ce=Z),Fe===N&&++nt===E&&(Se=Z),(ze=lt.nextSibling)!==null)break;lt=Fe,Fe=lt.parentNode}lt=ze}b=ce===-1||Se===-1?null:{start:ce,end:Se}}else b=null}b=b||{start:0,end:0}}else b=null;for(oO={focusedElem:g,selectionRange:b},_4=!1,To=v;To!==null;)if(v=To,g=v.child,(v.subtreeFlags&1024)!==0&&g!==null)g.return=v,To=g;else for(;To!==null;){switch(v=To,N=v.alternate,g=v.flags,v.tag){case 0:break;case 11:case 15:break;case 1:if((g&1024)!==0&&N!==null){g=void 0,b=v,R=N.memoizedProps,N=N.memoizedState,E=b.stateNode;try{var Cn=kp(b.type,R,b.elementType===b.type);g=E.getSnapshotBeforeUpdate(Cn,N),E.__reactInternalSnapshotBeforeUpdate=g}catch(mn){ai(b,b.return,mn)}}break;case 3:if((g&1024)!==0){if(g=v.stateNode.containerInfo,b=g.nodeType,b===9)lO(g);else if(b===1)switch(g.nodeName){case"HEAD":case"HTML":case"BODY":lO(g);break;default:g.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((g&1024)!==0)throw Error(r(163))}if(g=v.sibling,g!==null){g.return=v.return,To=g;break}To=v.return}}function pG(g,v,b){var E=b.flags;switch(b.tag){case 0:case 11:case 15:zh(g,b),E&4&&fx(5,b);break;case 1:if(zh(g,b),E&4)if(g=b.stateNode,v===null)try{g.componentDidMount()}catch(Z){ai(b,b.return,Z)}else{var R=kp(b.type,v.memoizedProps);v=v.memoizedState;try{g.componentDidUpdate(R,v,g.__reactInternalSnapshotBeforeUpdate)}catch(Z){ai(b,b.return,Z)}}E&64&&lG(b),E&512&&dx(b,b.return);break;case 3:if(zh(g,b),E&64&&(g=b.updateQueue,g!==null)){if(v=null,b.child!==null)switch(b.child.tag){case 27:case 5:v=b.child.stateNode;break;case 1:v=b.child.stateNode}try{XB(g,v)}catch(Z){ai(b,b.return,Z)}}break;case 27:v===null&&E&4&&hG(b);case 26:case 5:zh(g,b),v===null&&E&4&&fG(b),E&512&&dx(b,b.return);break;case 12:zh(g,b);break;case 13:zh(g,b),E&4&&yG(g,b),E&64&&(g=b.memoizedState,g!==null&&(g=g.dehydrated,g!==null&&(b=i_e.bind(null,b),S_e(g,b))));break;case 22:if(E=b.memoizedState!==null||o0,!E){v=v!==null&&v.memoizedState!==null||_a,R=o0;var N=_a;o0=E,(_a=v)&&!N?Gh(g,b,(b.subtreeFlags&8772)!==0):zh(g,b),o0=R,_a=N}break;case 30:break;default:zh(g,b)}}function mG(g){var v=g.alternate;v!==null&&(g.alternate=null,mG(v)),g.child=null,g.deletions=null,g.sibling=null,g.tag===5&&(v=g.stateNode,v!==null&&Uo(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}var Pi=null,wc=!1;function s0(g,v,b){for(b=b.child;b!==null;)vG(g,v,b),b=b.sibling}function vG(g,v,b){if(et&&typeof et.onCommitFiberUnmount=="function")try{et.onCommitFiberUnmount(Re,b)}catch{}switch(b.tag){case 26:_a||Ff(b,v),s0(g,v,b),b.memoizedState?b.memoizedState.count--:b.stateNode&&(b=b.stateNode,b.parentNode.removeChild(b));break;case 27:_a||Ff(b,v);var E=Pi,R=wc;Xh(b.type)&&(Pi=b.stateNode,wc=!1),s0(g,v,b),bx(b.stateNode),Pi=E,wc=R;break;case 5:_a||Ff(b,v);case 6:if(E=Pi,R=wc,Pi=null,s0(g,v,b),Pi=E,wc=R,Pi!==null)if(wc)try{(Pi.nodeType===9?Pi.body:Pi.nodeName==="HTML"?Pi.ownerDocument.body:Pi).removeChild(b.stateNode)}catch(N){ai(b,v,N)}else try{Pi.removeChild(b.stateNode)}catch(N){ai(b,v,N)}break;case 18:Pi!==null&&(wc?(g=Pi,aW(g.nodeType===9?g.body:g.nodeName==="HTML"?g.ownerDocument.body:g,b.stateNode),Mx(g)):aW(Pi,b.stateNode));break;case 4:E=Pi,R=wc,Pi=b.stateNode.containerInfo,wc=!0,s0(g,v,b),Pi=E,wc=R;break;case 0:case 11:case 14:case 15:_a||Bh(2,b,v),_a||Bh(4,b,v),s0(g,v,b);break;case 1:_a||(Ff(b,v),E=b.stateNode,typeof E.componentWillUnmount=="function"&&uG(b,v,E)),s0(g,v,b);break;case 21:s0(g,v,b);break;case 22:_a=(E=_a)||b.memoizedState!==null,s0(g,v,b),_a=E;break;default:s0(g,v,b)}}function yG(g,v){if(v.memoizedState===null&&(g=v.alternate,g!==null&&(g=g.memoizedState,g!==null&&(g=g.dehydrated,g!==null))))try{Mx(g)}catch(b){ai(v,v.return,b)}}function XCe(g){switch(g.tag){case 13:case 19:var v=g.stateNode;return v===null&&(v=g.stateNode=new gG),v;case 22:return g=g.stateNode,v=g._retryCache,v===null&&(v=g._retryCache=new gG),v;default:throw Error(r(435,g.tag))}}function L7(g,v){var b=XCe(g);v.forEach(function(E){var R=a_e.bind(null,g,E);b.has(E)||(b.add(E),E.then(R,R))})}function Qc(g,v){var b=v.deletions;if(b!==null)for(var E=0;E<b.length;E++){var R=b[E],N=g,Z=v,ce=Z;e:for(;ce!==null;){switch(ce.tag){case 27:if(Xh(ce.type)){Pi=ce.stateNode,wc=!1;break e}break;case 5:Pi=ce.stateNode,wc=!1;break e;case 3:case 4:Pi=ce.stateNode.containerInfo,wc=!0;break e}ce=ce.return}if(Pi===null)throw Error(r(160));vG(N,Z,R),Pi=null,wc=!1,N=R.alternate,N!==null&&(N.return=null),R.return=null}if(v.subtreeFlags&13878)for(v=v.child;v!==null;)xG(v,g),v=v.sibling}var Fu=null;function xG(g,v){var b=g.alternate,E=g.flags;switch(g.tag){case 0:case 11:case 14:case 15:Qc(v,g),Jc(g),E&4&&(Bh(3,g,g.return),fx(3,g),Bh(5,g,g.return));break;case 1:Qc(v,g),Jc(g),E&512&&(_a||b===null||Ff(b,b.return)),E&64&&o0&&(g=g.updateQueue,g!==null&&(E=g.callbacks,E!==null&&(b=g.shared.hiddenCallbacks,g.shared.hiddenCallbacks=b===null?E:b.concat(E))));break;case 26:var R=Fu;if(Qc(v,g),Jc(g),E&512&&(_a||b===null||Ff(b,b.return)),E&4){var N=b!==null?b.memoizedState:null;if(E=g.memoizedState,b===null)if(E===null)if(g.stateNode===null){e:{E=g.type,b=g.memoizedProps,R=R.ownerDocument||R;t:switch(E){case"title":N=R.getElementsByTagName("title")[0],(!N||N[os]||N[Dt]||N.namespaceURI==="http://www.w3.org/2000/svg"||N.hasAttribute("itemprop"))&&(N=R.createElement(E),R.head.insertBefore(N,R.querySelector("head > title"))),Ko(N,E,b),N[Dt]=g,Zt(N),E=N;break e;case"link":var Z=hW("link","href",R).get(E+(b.href||""));if(Z){for(var ce=0;ce<Z.length;ce++)if(N=Z[ce],N.getAttribute("href")===(b.href==null||b.href===""?null:b.href)&&N.getAttribute("rel")===(b.rel==null?null:b.rel)&&N.getAttribute("title")===(b.title==null?null:b.title)&&N.getAttribute("crossorigin")===(b.crossOrigin==null?null:b.crossOrigin)){Z.splice(ce,1);break t}}N=R.createElement(E),Ko(N,E,b),R.head.appendChild(N);break;case"meta":if(Z=hW("meta","content",R).get(E+(b.content||""))){for(ce=0;ce<Z.length;ce++)if(N=Z[ce],N.getAttribute("content")===(b.content==null?null:""+b.content)&&N.getAttribute("name")===(b.name==null?null:b.name)&&N.getAttribute("property")===(b.property==null?null:b.property)&&N.getAttribute("http-equiv")===(b.httpEquiv==null?null:b.httpEquiv)&&N.getAttribute("charset")===(b.charSet==null?null:b.charSet)){Z.splice(ce,1);break t}}N=R.createElement(E),Ko(N,E,b),R.head.appendChild(N);break;default:throw Error(r(468,E))}N[Dt]=g,Zt(N),E=N}g.stateNode=E}else gW(R,g.type,g.stateNode);else g.stateNode=dW(R,E,g.memoizedProps);else N!==E?(N===null?b.stateNode!==null&&(b=b.stateNode,b.parentNode.removeChild(b)):N.count--,E===null?gW(R,g.type,g.stateNode):dW(R,E,g.memoizedProps)):E===null&&g.stateNode!==null&&N7(g,g.memoizedProps,b.memoizedProps)}break;case 27:Qc(v,g),Jc(g),E&512&&(_a||b===null||Ff(b,b.return)),b!==null&&E&4&&N7(g,g.memoizedProps,b.memoizedProps);break;case 5:if(Qc(v,g),Jc(g),E&512&&(_a||b===null||Ff(b,b.return)),g.flags&32){R=g.stateNode;try{ks(R,"")}catch(ze){ai(g,g.return,ze)}}E&4&&g.stateNode!=null&&(R=g.memoizedProps,N7(g,R,b!==null?b.memoizedProps:R)),E&1024&&(A7=!0);break;case 6:if(Qc(v,g),Jc(g),E&4){if(g.stateNode===null)throw Error(r(162));E=g.memoizedProps,b=g.stateNode;try{b.nodeValue=E}catch(ze){ai(g,g.return,ze)}}break;case 3:if(b4=null,R=Fu,Fu=x4(v.containerInfo),Qc(v,g),Fu=R,Jc(g),E&4&&b!==null&&b.memoizedState.isDehydrated)try{Mx(v.containerInfo)}catch(ze){ai(g,g.return,ze)}A7&&(A7=!1,wG(g));break;case 4:E=Fu,Fu=x4(g.stateNode.containerInfo),Qc(v,g),Jc(g),Fu=E;break;case 12:Qc(v,g),Jc(g);break;case 13:Qc(v,g),Jc(g),g.child.flags&8192&&g.memoizedState!==null!=(b!==null&&b.memoizedState!==null)&&(B7=en()),E&4&&(E=g.updateQueue,E!==null&&(g.updateQueue=null,L7(g,E)));break;case 22:R=g.memoizedState!==null;var Se=b!==null&&b.memoizedState!==null,$e=o0,nt=_a;if(o0=$e||R,_a=nt||Se,Qc(v,g),_a=nt,o0=$e,Jc(g),E&8192)e:for(v=g.stateNode,v._visibility=R?v._visibility&-2:v._visibility|1,R&&(b===null||Se||o0||_a||Ap(g)),b=null,v=g;;){if(v.tag===5||v.tag===26){if(b===null){Se=b=v;try{if(N=Se.stateNode,R)Z=N.style,typeof Z.setProperty=="function"?Z.setProperty("display","none","important"):Z.display="none";else{ce=Se.stateNode;var lt=Se.memoizedProps.style,Fe=lt!=null&&lt.hasOwnProperty("display")?lt.display:null;ce.style.display=Fe==null||typeof Fe=="boolean"?"":(""+Fe).trim()}}catch(ze){ai(Se,Se.return,ze)}}}else if(v.tag===6){if(b===null){Se=v;try{Se.stateNode.nodeValue=R?"":Se.memoizedProps}catch(ze){ai(Se,Se.return,ze)}}}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;b===v&&(b=null),v=v.return}b===v&&(b=null),v.sibling.return=v.return,v=v.sibling}E&4&&(E=g.updateQueue,E!==null&&(b=E.retryQueue,b!==null&&(E.retryQueue=null,L7(g,b))));break;case 19:Qc(v,g),Jc(g),E&4&&(E=g.updateQueue,E!==null&&(g.updateQueue=null,L7(g,E)));break;case 30:break;case 21:break;default:Qc(v,g),Jc(g)}}function Jc(g){var v=g.flags;if(v&2){try{for(var b,E=g.return;E!==null;){if(dG(E)){b=E;break}E=E.return}if(b==null)throw Error(r(160));switch(b.tag){case 27:var R=b.stateNode,N=P7(g);o4(g,N,R);break;case 5:var Z=b.stateNode;b.flags&32&&(ks(Z,""),b.flags&=-33);var ce=P7(g);o4(g,ce,Z);break;case 3:case 4:var Se=b.stateNode.containerInfo,$e=P7(g);k7(g,$e,Se);break;default:throw Error(r(161))}}catch(nt){ai(g,g.return,nt)}g.flags&=-3}v&4096&&(g.flags&=-4097)}function wG(g){if(g.subtreeFlags&1024)for(g=g.child;g!==null;){var v=g;wG(v),v.tag===5&&v.flags&1024&&v.stateNode.reset(),g=g.sibling}}function zh(g,v){if(v.subtreeFlags&8772)for(v=v.child;v!==null;)pG(g,v.alternate,v),v=v.sibling}function Ap(g){for(g=g.child;g!==null;){var v=g;switch(v.tag){case 0:case 11:case 14:case 15:Bh(4,v,v.return),Ap(v);break;case 1:Ff(v,v.return);var b=v.stateNode;typeof b.componentWillUnmount=="function"&&uG(v,v.return,b),Ap(v);break;case 27:bx(v.stateNode);case 26:case 5:Ff(v,v.return),Ap(v);break;case 22:v.memoizedState===null&&Ap(v);break;case 30:Ap(v);break;default:Ap(v)}g=g.sibling}}function Gh(g,v,b){for(b=b&&(v.subtreeFlags&8772)!==0,v=v.child;v!==null;){var E=v.alternate,R=g,N=v,Z=N.flags;switch(N.tag){case 0:case 11:case 15:Gh(R,N,b),fx(4,N);break;case 1:if(Gh(R,N,b),E=N,R=E.stateNode,typeof R.componentDidMount=="function")try{R.componentDidMount()}catch($e){ai(E,E.return,$e)}if(E=N,R=E.updateQueue,R!==null){var ce=E.stateNode;try{var Se=R.shared.hiddenCallbacks;if(Se!==null)for(R.shared.hiddenCallbacks=null,R=0;R<Se.length;R++)YB(Se[R],ce)}catch($e){ai(E,E.return,$e)}}b&&Z&64&&lG(N),dx(N,N.return);break;case 27:hG(N);case 26:case 5:Gh(R,N,b),b&&E===null&&Z&4&&fG(N),dx(N,N.return);break;case 12:Gh(R,N,b);break;case 13:Gh(R,N,b),b&&Z&4&&yG(R,N);break;case 22:N.memoizedState===null&&Gh(R,N,b),dx(N,N.return);break;case 30:break;default:Gh(R,N,b)}v=v.sibling}}function V7(g,v){var b=null;g!==null&&g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(b=g.memoizedState.cachePool.pool),g=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(g=v.memoizedState.cachePool.pool),g!==b&&(g!=null&&g.refCount++,b!=null&&Z2(b))}function $7(g,v){g=null,v.alternate!==null&&(g=v.alternate.memoizedState.cache),v=v.memoizedState.cache,v!==g&&(v.refCount++,g!=null&&Z2(g))}function Bf(g,v,b,E){if(v.subtreeFlags&10256)for(v=v.child;v!==null;)bG(g,v,b,E),v=v.sibling}function bG(g,v,b,E){var R=v.flags;switch(v.tag){case 0:case 11:case 15:Bf(g,v,b,E),R&2048&&fx(9,v);break;case 1:Bf(g,v,b,E);break;case 3:Bf(g,v,b,E),R&2048&&(g=null,v.alternate!==null&&(g=v.alternate.memoizedState.cache),v=v.memoizedState.cache,v!==g&&(v.refCount++,g!=null&&Z2(g)));break;case 12:if(R&2048){Bf(g,v,b,E),g=v.stateNode;try{var N=v.memoizedProps,Z=N.id,ce=N.onPostCommit;typeof ce=="function"&&ce(Z,v.alternate===null?"mount":"update",g.passiveEffectDuration,-0)}catch(Se){ai(v,v.return,Se)}}else Bf(g,v,b,E);break;case 13:Bf(g,v,b,E);break;case 23:break;case 22:N=v.stateNode,Z=v.alternate,v.memoizedState!==null?N._visibility&2?Bf(g,v,b,E):hx(g,v):N._visibility&2?Bf(g,v,b,E):(N._visibility|=2,H1(g,v,b,E,(v.subtreeFlags&10256)!==0)),R&2048&&V7(Z,v);break;case 24:Bf(g,v,b,E),R&2048&&$7(v.alternate,v);break;default:Bf(g,v,b,E)}}function H1(g,v,b,E,R){for(R=R&&(v.subtreeFlags&10256)!==0,v=v.child;v!==null;){var N=g,Z=v,ce=b,Se=E,$e=Z.flags;switch(Z.tag){case 0:case 11:case 15:H1(N,Z,ce,Se,R),fx(8,Z);break;case 23:break;case 22:var nt=Z.stateNode;Z.memoizedState!==null?nt._visibility&2?H1(N,Z,ce,Se,R):hx(N,Z):(nt._visibility|=2,H1(N,Z,ce,Se,R)),R&&$e&2048&&V7(Z.alternate,Z);break;case 24:H1(N,Z,ce,Se,R),R&&$e&2048&&$7(Z.alternate,Z);break;default:H1(N,Z,ce,Se,R)}v=v.sibling}}function hx(g,v){if(v.subtreeFlags&10256)for(v=v.child;v!==null;){var b=g,E=v,R=E.flags;switch(E.tag){case 22:hx(b,E),R&2048&&V7(E.alternate,E);break;case 24:hx(b,E),R&2048&&$7(E.alternate,E);break;default:hx(b,E)}v=v.sibling}}var gx=8192;function q1(g){if(g.subtreeFlags&gx)for(g=g.child;g!==null;)SG(g),g=g.sibling}function SG(g){switch(g.tag){case 26:q1(g),g.flags&gx&&g.memoizedState!==null&&A_e(Fu,g.memoizedState,g.memoizedProps);break;case 5:q1(g);break;case 3:case 4:var v=Fu;Fu=x4(g.stateNode.containerInfo),q1(g),Fu=v;break;case 22:g.memoizedState===null&&(v=g.alternate,v!==null&&v.memoizedState!==null?(v=gx,gx=16777216,q1(g),gx=v):q1(g));break;default:q1(g)}}function CG(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 px(g){var v=g.deletions;if((g.flags&16)!==0){if(v!==null)for(var b=0;b<v.length;b++){var E=v[b];To=E,TG(E,g)}CG(g)}if(g.subtreeFlags&10256)for(g=g.child;g!==null;)_G(g),g=g.sibling}function _G(g){switch(g.tag){case 0:case 11:case 15:px(g),g.flags&2048&&Bh(9,g,g.return);break;case 3:px(g);break;case 12:px(g);break;case 22:var v=g.stateNode;g.memoizedState!==null&&v._visibility&2&&(g.return===null||g.return.tag!==13)?(v._visibility&=-3,s4(g)):px(g);break;default:px(g)}}function s4(g){var v=g.deletions;if((g.flags&16)!==0){if(v!==null)for(var b=0;b<v.length;b++){var E=v[b];To=E,TG(E,g)}CG(g)}for(g=g.child;g!==null;){switch(v=g,v.tag){case 0:case 11:case 15:Bh(8,v,v.return),s4(v);break;case 22:b=v.stateNode,b._visibility&2&&(b._visibility&=-3,s4(v));break;default:s4(v)}g=g.sibling}}function TG(g,v){for(;To!==null;){var b=To;switch(b.tag){case 0:case 11:case 15:Bh(8,b,v);break;case 23:case 22:if(b.memoizedState!==null&&b.memoizedState.cachePool!==null){var E=b.memoizedState.cachePool.pool;E!=null&&E.refCount++}break;case 24:Z2(b.memoizedState.cache)}if(E=b.child,E!==null)E.return=b,To=E;else e:for(b=g;To!==null;){E=To;var R=E.sibling,N=E.return;if(mG(E),E===b){To=null;break e}if(R!==null){R.return=N,To=R;break e}To=N}}}var ZCe={getCacheForType:function(g){var v=us(ro),b=v.data.get(g);return b===void 0&&(b=g(),v.data.set(g,b)),b}},QCe=typeof WeakMap=="function"?WeakMap:Map,Wr=0,fi=null,ar=null,xr=0,Hr=0,el=null,Wh=!1,K1=!1,j7=!1,c0=0,la=0,Hh=0,Lp=0,U7=0,Xl=0,Y1=0,mx=null,bc=null,F7=!1,B7=0,c4=1/0,l4=null,qh=null,qo=0,Kh=null,X1=null,Z1=0,z7=0,G7=null,EG=null,vx=0,W7=null;function tl(){if((Wr&2)!==0&&xr!==0)return xr&-xr;if(U.T!==null){var g=$1;return g!==0?g:Q7()}return wi()}function OG(){Xl===0&&(Xl=(xr&536870912)===0||Pr?kt():536870912);var g=Yl.current;return g!==null&&(g.flags|=32),Xl}function nl(g,v,b){(g===fi&&(Hr===2||Hr===9)||g.cancelPendingCommit!==null)&&(Q1(g,0),Yh(g,xr,Xl,!1)),Kn(g,b),((Wr&2)===0||g!==fi)&&(g===fi&&((Wr&2)===0&&(Lp|=b),la===4&&Yh(g,xr,Xl,!1)),zf(g))}function DG(g,v,b){if((Wr&6)!==0)throw Error(r(327));var E=!b&&(v&124)===0&&(v&g.expiredLanes)===0||at(g,v),R=E?t_e(g,v):K7(g,v,!0),N=E;do{if(R===0){K1&&!E&&Yh(g,v,0,!1);break}else{if(b=g.current.alternate,N&&!JCe(b)){R=K7(g,v,!1),N=!1;continue}if(R===2){if(N=v,g.errorRecoveryDisabledLanes&N)var Z=0;else Z=g.pendingLanes&-536870913,Z=Z!==0?Z:Z&536870912?536870912:0;if(Z!==0){v=Z;e:{var ce=g;R=mx;var Se=ce.current.memoizedState.isDehydrated;if(Se&&(Q1(ce,Z).flags|=256),Z=K7(ce,Z,!1),Z!==2){if(j7&&!Se){ce.errorRecoveryDisabledLanes|=N,Lp|=N,R=4;break e}N=bc,bc=R,N!==null&&(bc===null?bc=N:bc.push.apply(bc,N))}R=Z}if(N=!1,R!==2)continue}}if(R===1){Q1(g,0),Yh(g,v,0,!0);break}e:{switch(E=g,N=R,N){case 0:case 1:throw Error(r(345));case 4:if((v&4194048)!==v)break;case 6:Yh(E,v,Xl,!Wh);break e;case 2:bc=null;break;case 3:case 5:break;default:throw Error(r(329))}if((v&62914560)===v&&(R=B7+300-en(),10<R)){if(Yh(E,v,Xl,!Wh),Ae(E,0,!0)!==0)break e;E.timeoutHandle=rW(MG.bind(null,E,b,bc,l4,F7,v,Xl,Lp,Y1,Wh,N,2,-0,0),R);break e}MG(E,b,bc,l4,F7,v,Xl,Lp,Y1,Wh,N,0,-0,0)}}break}while(!0);zf(g)}function MG(g,v,b,E,R,N,Z,ce,Se,$e,nt,lt,Fe,ze){if(g.timeoutHandle=-1,lt=v.subtreeFlags,(lt&8192||(lt&16785408)===16785408)&&(_x={stylesheets:null,count:0,unsuspend:k_e},SG(v),lt=L_e(),lt!==null)){g.cancelPendingCommit=lt(LG.bind(null,g,v,N,b,E,R,Z,ce,Se,nt,1,Fe,ze)),Yh(g,N,Z,!$e);return}LG(g,v,N,b,E,R,Z,ce,Se)}function JCe(g){for(var v=g;;){var b=v.tag;if((b===0||b===11||b===15)&&v.flags&16384&&(b=v.updateQueue,b!==null&&(b=b.stores,b!==null)))for(var E=0;E<b.length;E++){var R=b[E],N=R.getSnapshot;R=R.value;try{if(!le(N(),R))return!1}catch{return!1}}if(b=v.child,v.subtreeFlags&16384&&b!==null)b.return=v,v=b;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 Yh(g,v,b,E){v&=~U7,v&=~Lp,g.suspendedLanes|=v,g.pingedLanes&=~v,E&&(g.warmLanes|=v),E=g.expirationTimes;for(var R=v;0<R;){var N=31-Pt(R),Z=1<<N;E[N]=-1,R&=~Z}b!==0&&Xt(g,b,v)}function u4(){return(Wr&6)===0?(yx(0),!1):!0}function H7(){if(ar!==null){if(Hr===0)var g=ar.return;else g=ar,e0=Rp=null,l7(g),G1=null,cx=0,g=ar;for(;g!==null;)cG(g.alternate,g),g=g.return;ar=null}}function Q1(g,v){var b=g.timeoutHandle;b!==-1&&(g.timeoutHandle=-1,v_e(b)),b=g.cancelPendingCommit,b!==null&&(g.cancelPendingCommit=null,b()),H7(),fi=g,ar=b=Zd(g.current,null),xr=v,Hr=0,el=null,Wh=!1,K1=at(g,v),j7=!1,Y1=Xl=U7=Lp=Hh=la=0,bc=mx=null,F7=!1,(v&8)!==0&&(v|=v&32);var E=g.entangledLanes;if(E!==0)for(g=g.entanglements,E&=v;0<E;){var R=31-Pt(E),N=1<<R;v|=g[R],E&=~N}return c0=v,N3(),b}function RG(g,v){Jn=null,U.H=Z3,v===J2||v===F3?(v=qB(),Hr=3):v===GB?(v=qB(),Hr=4):Hr=v===Kz?8:v!==null&&typeof v=="object"&&typeof v.then=="function"?6:1,el=v,ar===null&&(la=1,n4(g,Wl(v,g.current)))}function IG(){var g=U.H;return U.H=Z3,g===null?Z3:g}function NG(){var g=U.A;return U.A=ZCe,g}function q7(){la=4,Wh||(xr&4194048)!==xr&&Yl.current!==null||(K1=!0),(Hh&134217727)===0&&(Lp&134217727)===0||fi===null||Yh(fi,xr,Xl,!1)}function K7(g,v,b){var E=Wr;Wr|=2;var R=IG(),N=NG();(fi!==g||xr!==v)&&(l4=null,Q1(g,v)),v=!1;var Z=la;e:do try{if(Hr!==0&&ar!==null){var ce=ar,Se=el;switch(Hr){case 8:H7(),Z=6;break e;case 3:case 2:case 9:case 6:Yl.current===null&&(v=!0);var $e=Hr;if(Hr=0,el=null,J1(g,ce,Se,$e),b&&K1){Z=0;break e}break;default:$e=Hr,Hr=0,el=null,J1(g,ce,Se,$e)}}e_e(),Z=la;break}catch(nt){RG(g,nt)}while(!0);return v&&g.shellSuspendCounter++,e0=Rp=null,Wr=E,U.H=R,U.A=N,ar===null&&(fi=null,xr=0,N3()),Z}function e_e(){for(;ar!==null;)PG(ar)}function t_e(g,v){var b=Wr;Wr|=2;var E=IG(),R=NG();fi!==g||xr!==v?(l4=null,c4=en()+500,Q1(g,v)):K1=at(g,v);e:do try{if(Hr!==0&&ar!==null){v=ar;var N=el;t:switch(Hr){case 1:Hr=0,el=null,J1(g,v,N,1);break;case 2:case 9:if(WB(N)){Hr=0,el=null,kG(v);break}v=function(){Hr!==2&&Hr!==9||fi!==g||(Hr=7),zf(g)},N.then(v,v);break e;case 3:Hr=7;break e;case 4:Hr=5;break e;case 7:WB(N)?(Hr=0,el=null,kG(v)):(Hr=0,el=null,J1(g,v,N,7));break;case 5:var Z=null;switch(ar.tag){case 26:Z=ar.memoizedState;case 5:case 27:var ce=ar;if(!Z||pW(Z)){Hr=0,el=null;var Se=ce.sibling;if(Se!==null)ar=Se;else{var $e=ce.return;$e!==null?(ar=$e,f4($e)):ar=null}break t}}Hr=0,el=null,J1(g,v,N,5);break;case 6:Hr=0,el=null,J1(g,v,N,6);break;case 8:H7(),la=6;break e;default:throw Error(r(462))}}n_e();break}catch(nt){RG(g,nt)}while(!0);return e0=Rp=null,U.H=E,U.A=R,Wr=b,ar!==null?0:(fi=null,xr=0,N3(),la)}function n_e(){for(;ar!==null&&!cn();)PG(ar)}function PG(g){var v=oG(g.alternate,g,c0);g.memoizedProps=g.pendingProps,v===null?f4(g):ar=v}function kG(g){var v=g,b=v.alternate;switch(v.tag){case 15:case 0:v=eG(b,v,v.pendingProps,v.type,void 0,xr);break;case 11:v=eG(b,v,v.pendingProps,v.type.render,v.ref,xr);break;case 5:l7(v);default:cG(b,v),v=ar=AB(v,c0),v=oG(b,v,c0)}g.memoizedProps=g.pendingProps,v===null?f4(g):ar=v}function J1(g,v,b,E){e0=Rp=null,l7(v),G1=null,cx=0;var R=v.return;try{if(WCe(g,R,v,b,xr)){la=1,n4(g,Wl(b,g.current)),ar=null;return}}catch(N){if(R!==null)throw ar=R,N;la=1,n4(g,Wl(b,g.current)),ar=null;return}v.flags&32768?(Pr||E===1?g=!0:K1||(xr&536870912)!==0?g=!1:(Wh=g=!0,(E===2||E===9||E===3||E===6)&&(E=Yl.current,E!==null&&E.tag===13&&(E.flags|=16384))),AG(v,g)):f4(v)}function f4(g){var v=g;do{if((v.flags&32768)!==0){AG(v,Wh);return}g=v.return;var b=qCe(v.alternate,v,c0);if(b!==null){ar=b;return}if(v=v.sibling,v!==null){ar=v;return}ar=v=g}while(v!==null);la===0&&(la=5)}function AG(g,v){do{var b=KCe(g.alternate,g);if(b!==null){b.flags&=32767,ar=b;return}if(b=g.return,b!==null&&(b.flags|=32768,b.subtreeFlags=0,b.deletions=null),!v&&(g=g.sibling,g!==null)){ar=g;return}ar=g=b}while(g!==null);la=6,ar=null}function LG(g,v,b,E,R,N,Z,ce,Se){g.cancelPendingCommit=null;do d4();while(qo!==0);if((Wr&6)!==0)throw Error(r(327));if(v!==null){if(v===g.current)throw Error(r(177));if(N=v.lanes|v.childLanes,N|=$9,rn(g,b,N,Z,ce,Se),g===fi&&(ar=fi=null,xr=0),X1=v,Kh=g,Z1=b,z7=N,G7=R,EG=E,(v.subtreeFlags&10256)!==0||(v.flags&10256)!==0?(g.callbackNode=null,g.callbackPriority=0,o_e(B,function(){return FG(),null})):(g.callbackNode=null,g.callbackPriority=0),E=(v.flags&13878)!==0,(v.subtreeFlags&13878)!==0||E){E=U.T,U.T=null,R=Y.p,Y.p=2,Z=Wr,Wr|=4;try{YCe(g,v,b)}finally{Wr=Z,Y.p=R,U.T=E}}qo=1,VG(),$G(),jG()}}function VG(){if(qo===1){qo=0;var g=Kh,v=X1,b=(v.flags&13878)!==0;if((v.subtreeFlags&13878)!==0||b){b=U.T,U.T=null;var E=Y.p;Y.p=2;var R=Wr;Wr|=4;try{xG(v,g);var N=oO,Z=ke(g.containerInfo),ce=N.focusedElem,Se=N.selectionRange;if(Z!==ce&&ce&&ce.ownerDocument&&_e(ce.ownerDocument.documentElement,ce)){if(Se!==null&&Xe(ce)){var $e=Se.start,nt=Se.end;if(nt===void 0&&(nt=$e),"selectionStart"in ce)ce.selectionStart=$e,ce.selectionEnd=Math.min(nt,ce.value.length);else{var lt=ce.ownerDocument||document,Fe=lt&&lt.defaultView||window;if(Fe.getSelection){var ze=Fe.getSelection(),Cn=ce.textContent.length,mn=Math.min(Se.start,Cn),ei=Se.end===void 0?mn:Math.min(Se.end,Cn);!ze.extend&&mn>ei&&(Z=ei,ei=mn,mn=Z);var Ne=xe(ce,mn),De=xe(ce,ei);if(Ne&&De&&(ze.rangeCount!==1||ze.anchorNode!==Ne.node||ze.anchorOffset!==Ne.offset||ze.focusNode!==De.node||ze.focusOffset!==De.offset)){var Ve=lt.createRange();Ve.setStart(Ne.node,Ne.offset),ze.removeAllRanges(),mn>ei?(ze.addRange(Ve),ze.extend(De.node,De.offset)):(Ve.setEnd(De.node,De.offset),ze.addRange(Ve))}}}}for(lt=[],ze=ce;ze=ze.parentNode;)ze.nodeType===1&&lt.push({element:ze,left:ze.scrollLeft,top:ze.scrollTop});for(typeof ce.focus=="function"&&ce.focus(),ce=0;ce<lt.length;ce++){var st=lt[ce];st.element.scrollLeft=st.left,st.element.scrollTop=st.top}}_4=!!aO,oO=aO=null}finally{Wr=R,Y.p=E,U.T=b}}g.current=v,qo=2}}function $G(){if(qo===2){qo=0;var g=Kh,v=X1,b=(v.flags&8772)!==0;if((v.subtreeFlags&8772)!==0||b){b=U.T,U.T=null;var E=Y.p;Y.p=2;var R=Wr;Wr|=4;try{pG(g,v.alternate,v)}finally{Wr=R,Y.p=E,U.T=b}}qo=3}}function jG(){if(qo===4||qo===3){qo=0,ln();var g=Kh,v=X1,b=Z1,E=EG;(v.subtreeFlags&10256)!==0||(v.flags&10256)!==0?qo=5:(qo=0,X1=Kh=null,UG(g,g.pendingLanes));var R=g.pendingLanes;if(R===0&&(qh=null),pr(b),v=v.stateNode,et&&typeof et.onCommitFiberRoot=="function")try{et.onCommitFiberRoot(Re,v,void 0,(v.current.flags&128)===128)}catch{}if(E!==null){v=U.T,R=Y.p,Y.p=2,U.T=null;try{for(var N=g.onRecoverableError,Z=0;Z<E.length;Z++){var ce=E[Z];N(ce.value,{componentStack:ce.stack})}}finally{U.T=v,Y.p=R}}(Z1&3)!==0&&d4(),zf(g),R=g.pendingLanes,(b&4194090)!==0&&(R&42)!==0?g===W7?vx++:(vx=0,W7=g):vx=0,yx(0)}}function UG(g,v){(g.pooledCacheLanes&=v)===0&&(v=g.pooledCache,v!=null&&(g.pooledCache=null,Z2(v)))}function d4(g){return VG(),$G(),jG(),FG()}function FG(){if(qo!==5)return!1;var g=Kh,v=z7;z7=0;var b=pr(Z1),E=U.T,R=Y.p;try{Y.p=32>b?32:b,U.T=null,b=G7,G7=null;var N=Kh,Z=Z1;if(qo=0,X1=Kh=null,Z1=0,(Wr&6)!==0)throw Error(r(331));var ce=Wr;if(Wr|=4,_G(N.current),bG(N,N.current,Z,b),Wr=ce,yx(0,!1),et&&typeof et.onPostCommitFiberRoot=="function")try{et.onPostCommitFiberRoot(Re,N)}catch{}return!0}finally{Y.p=R,U.T=E,UG(g,v)}}function BG(g,v,b){v=Wl(b,v),v=C7(g.stateNode,v,2),g=$h(g,v,2),g!==null&&(Kn(g,2),zf(g))}function ai(g,v,b){if(g.tag===3)BG(g,g,b);else for(;v!==null;){if(v.tag===3){BG(v,g,b);break}else if(v.tag===1){var E=v.stateNode;if(typeof v.type.getDerivedStateFromError=="function"||typeof E.componentDidCatch=="function"&&(qh===null||!qh.has(E))){g=Wl(b,g),b=Hz(2),E=$h(v,b,2),E!==null&&(qz(b,E,v,g),Kn(E,2),zf(E));break}}v=v.return}}function Y7(g,v,b){var E=g.pingCache;if(E===null){E=g.pingCache=new QCe;var R=new Set;E.set(v,R)}else R=E.get(v),R===void 0&&(R=new Set,E.set(v,R));R.has(b)||(j7=!0,R.add(b),g=r_e.bind(null,g,v,b),v.then(g,g))}function r_e(g,v,b){var E=g.pingCache;E!==null&&E.delete(v),g.pingedLanes|=g.suspendedLanes&b,g.warmLanes&=~b,fi===g&&(xr&b)===b&&(la===4||la===3&&(xr&62914560)===xr&&300>en()-B7?(Wr&2)===0&&Q1(g,0):U7|=b,Y1===xr&&(Y1=0)),zf(g)}function zG(g,v){v===0&&(v=jt()),g=k1(g,v),g!==null&&(Kn(g,v),zf(g))}function i_e(g){var v=g.memoizedState,b=0;v!==null&&(b=v.retryLane),zG(g,b)}function a_e(g,v){var b=0;switch(g.tag){case 13:var E=g.stateNode,R=g.memoizedState;R!==null&&(b=R.retryLane);break;case 19:E=g.stateNode;break;case 22:E=g.stateNode._retryCache;break;default:throw Error(r(314))}E!==null&&E.delete(v),zG(g,b)}function o_e(g,v){return It(g,v)}var h4=null,ev=null,X7=!1,g4=!1,Z7=!1,Vp=0;function zf(g){g!==ev&&g.next===null&&(ev===null?h4=ev=g:ev=ev.next=g),g4=!0,X7||(X7=!0,c_e())}function yx(g,v){if(!Z7&&g4){Z7=!0;do for(var b=!1,E=h4;E!==null;){if(g!==0){var R=E.pendingLanes;if(R===0)var N=0;else{var Z=E.suspendedLanes,ce=E.pingedLanes;N=(1<<31-Pt(42|g)+1)-1,N&=R&~(Z&~ce),N=N&201326741?N&201326741|1:N?N|2:0}N!==0&&(b=!0,qG(E,N))}else N=xr,N=Ae(E,E===fi?N:0,E.cancelPendingCommit!==null||E.timeoutHandle!==-1),(N&3)===0||at(E,N)||(b=!0,qG(E,N));E=E.next}while(b);Z7=!1}}function s_e(){GG()}function GG(){g4=X7=!1;var g=0;Vp!==0&&(m_e()&&(g=Vp),Vp=0);for(var v=en(),b=null,E=h4;E!==null;){var R=E.next,N=WG(E,v);N===0?(E.next=null,b===null?h4=R:b.next=R,R===null&&(ev=b)):(b=E,(g!==0||(N&3)!==0)&&(g4=!0)),E=R}yx(g)}function WG(g,v){for(var b=g.suspendedLanes,E=g.pingedLanes,R=g.expirationTimes,N=g.pendingLanes&-62914561;0<N;){var Z=31-Pt(N),ce=1<<Z,Se=R[Z];Se===-1?((ce&b)===0||(ce&E)!==0)&&(R[Z]=ct(ce,v)):Se<=v&&(g.expiredLanes|=ce),N&=~ce}if(v=fi,b=xr,b=Ae(g,g===v?b:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),E=g.callbackNode,b===0||g===v&&(Hr===2||Hr===9)||g.cancelPendingCommit!==null)return E!==null&&E!==null&&Rt(E),g.callbackNode=null,g.callbackPriority=0;if((b&3)===0||at(g,b)){if(v=b&-b,v===g.callbackPriority)return v;switch(E!==null&&Rt(E),pr(b)){case 2:case 8:b=ue;break;case 32:b=B;break;case 268435456:b=fe;break;default:b=B}return E=HG.bind(null,g),b=It(b,E),g.callbackPriority=v,g.callbackNode=b,v}return E!==null&&E!==null&&Rt(E),g.callbackPriority=2,g.callbackNode=null,2}function HG(g,v){if(qo!==0&&qo!==5)return g.callbackNode=null,g.callbackPriority=0,null;var b=g.callbackNode;if(d4()&&g.callbackNode!==b)return null;var E=xr;return E=Ae(g,g===fi?E:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),E===0?null:(DG(g,E,v),WG(g,en()),g.callbackNode!=null&&g.callbackNode===b?HG.bind(null,g):null)}function qG(g,v){if(d4())return null;DG(g,v,!0)}function c_e(){y_e(function(){(Wr&6)!==0?It(Ke,s_e):GG()})}function Q7(){return Vp===0&&(Vp=kt()),Vp}function KG(g){return g==null||typeof g=="symbol"||typeof g=="boolean"?null:typeof g=="function"?g:dc(""+g)}function YG(g,v){var b=v.ownerDocument.createElement("input");return b.name=v.name,b.value=v.value,g.id&&b.setAttribute("form",g.id),v.parentNode.insertBefore(b,v),g=new FormData(g),b.parentNode.removeChild(b),g}function l_e(g,v,b,E,R){if(v==="submit"&&b&&b.stateNode===R){var N=KG((R[Gt]||null).action),Z=E.submitter;Z&&(v=(v=Z[Gt]||null)?KG(v.formAction):Z.getAttribute("formAction"),v!==null&&(N=v,Z=null));var ce=new $l("action","action",null,E,R);g.push({event:ce,listeners:[{instance:null,listener:function(){if(E.defaultPrevented){if(Vp!==0){var Se=Z?YG(R,Z):new FormData(R);y7(b,{pending:!0,data:Se,method:R.method,action:N},null,Se)}}else typeof N=="function"&&(ce.preventDefault(),Se=Z?YG(R,Z):new FormData(R),y7(b,{pending:!0,data:Se,method:R.method,action:N},N,Se))},currentTarget:R}]})}}for(var J7=0;J7<V9.length;J7++){var eO=V9[J7],u_e=eO.toLowerCase(),f_e=eO[0].toUpperCase()+eO.slice(1);Uu(u_e,"on"+f_e)}Uu(kh,"onAnimationEnd"),Uu(W2,"onAnimationIteration"),Uu(H2,"onAnimationStart"),Uu("dblclick","onDoubleClick"),Uu("focusin","onFocus"),Uu("focusout","onBlur"),Uu(DCe,"onTransitionRun"),Uu(MCe,"onTransitionStart"),Uu(RCe,"onTransitionCancel"),Uu(IB,"onTransitionEnd"),Va("onMouseEnter",["mouseout","mouseover"]),Va("onMouseLeave",["mouseout","mouseover"]),Va("onPointerEnter",["pointerout","pointerover"]),Va("onPointerLeave",["pointerout","pointerover"]),Fi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Fi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Fi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Fi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Fi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Fi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xx="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(" "),d_e=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xx));function XG(g,v){v=(v&4)!==0;for(var b=0;b<g.length;b++){var E=g[b],R=E.event;E=E.listeners;e:{var N=void 0;if(v)for(var Z=E.length-1;0<=Z;Z--){var ce=E[Z],Se=ce.instance,$e=ce.currentTarget;if(ce=ce.listener,Se!==N&&R.isPropagationStopped())break e;N=ce,R.currentTarget=$e;try{N(R)}catch(nt){t4(nt)}R.currentTarget=null,N=Se}else for(Z=0;Z<E.length;Z++){if(ce=E[Z],Se=ce.instance,$e=ce.currentTarget,ce=ce.listener,Se!==N&&R.isPropagationStopped())break e;N=ce,R.currentTarget=$e;try{N(R)}catch(nt){t4(nt)}R.currentTarget=null,N=Se}}}}function or(g,v){var b=v[un];b===void 0&&(b=v[un]=new Set);var E=g+"__bubble";b.has(E)||(ZG(v,g,2,!1),b.add(E))}function tO(g,v,b){var E=0;v&&(E|=4),ZG(b,g,E,v)}var p4="_reactListening"+Math.random().toString(36).slice(2);function nO(g){if(!g[p4]){g[p4]=!0,Ui.forEach(function(b){b!=="selectionchange"&&(d_e.has(b)||tO(b,!1,g),tO(b,!0,g))});var v=g.nodeType===9?g:g.ownerDocument;v===null||v[p4]||(v[p4]=!0,tO("selectionchange",!1,v))}}function ZG(g,v,b,E){switch(bW(v)){case 2:var R=j_e;break;case 8:R=U_e;break;default:R=mO}b=R.bind(null,v,b,g),R=void 0,!Si||v!=="touchstart"&&v!=="touchmove"&&v!=="wheel"||(R=!0),E?R!==void 0?g.addEventListener(v,b,{capture:!0,passive:R}):g.addEventListener(v,b,!0):R!==void 0?g.addEventListener(v,b,{passive:R}):g.addEventListener(v,b,!1)}function rO(g,v,b,E,R){var N=E;if((v&1)===0&&(v&2)===0&&E!==null)e:for(;;){if(E===null)return;var Z=E.tag;if(Z===3||Z===4){var ce=E.stateNode.containerInfo;if(ce===R)break;if(Z===4)for(Z=E.return;Z!==null;){var Se=Z.tag;if((Se===3||Se===4)&&Z.stateNode.containerInfo===R)return;Z=Z.return}for(;ce!==null;){if(Z=wo(ce),Z===null)return;if(Se=Z.tag,Se===5||Se===6||Se===26||Se===27){E=N=Z;continue e}ce=ce.parentNode}}E=E.return}jr(function(){var $e=N,nt=Sa(b),lt=[];e:{var Fe=NB.get(g);if(Fe!==void 0){var ze=$l,Cn=g;switch(g){case"keypress":if(pc(b)===0)break e;case"keydown":case"keyup":ze=Af;break;case"focusin":Cn="focus",ze=ku;break;case"focusout":Cn="blur",ze=ku;break;case"beforeblur":case"afterblur":ze=ku;break;case"click":if(b.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ze=Mf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ze=Bd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ze=Xd;break;case kh:case W2:case H2:ze=Gd;break;case IB:ze=Vu;break;case"scroll":case"scrollend":ze=qc;break;case"wheel":ze=vc;break;case"copy":case"cut":case"paste":ze=Nf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ze=Lf;break;case"toggle":case"beforetoggle":ze=Vf}var mn=(v&4)!==0,ei=!mn&&(g==="scroll"||g==="scrollend"),Ne=mn?Fe!==null?Fe+"Capture":null:Fe;mn=[];for(var De=$e,Ve;De!==null;){var st=De;if(Ve=st.stateNode,st=st.tag,st!==5&&st!==26&&st!==27||Ve===null||Ne===null||(st=zo(De,Ne),st!=null&&mn.push(wx(De,st,Ve))),ei)break;De=De.return}0<mn.length&&(Fe=new ze(Fe,Cn,null,b,nt),lt.push({event:Fe,listeners:mn}))}}if((v&7)===0){e:{if(Fe=g==="mouseover"||g==="pointerover",ze=g==="mouseout"||g==="pointerout",Fe&&b!==cs&&(Cn=b.relatedTarget||b.fromElement)&&(wo(Cn)||Cn[Ut]))break e;if((ze||Fe)&&(Fe=nt.window===nt?nt:(Fe=nt.ownerDocument)?Fe.defaultView||Fe.parentWindow:window,ze?(Cn=b.relatedTarget||b.toElement,ze=$e,Cn=Cn?wo(Cn):null,Cn!==null&&(ei=a(Cn),mn=Cn.tag,Cn!==ei||mn!==5&&mn!==27&&mn!==6)&&(Cn=null)):(ze=null,Cn=$e),ze!==Cn)){if(mn=Mf,st="onMouseLeave",Ne="onMouseEnter",De="mouse",(g==="pointerout"||g==="pointerover")&&(mn=Lf,st="onPointerLeave",Ne="onPointerEnter",De="pointer"),ei=ze==null?Fe:zr(ze),Ve=Cn==null?Fe:zr(Cn),Fe=new mn(st,De+"leave",ze,b,nt),Fe.target=ei,Fe.relatedTarget=Ve,st=null,wo(nt)===$e&&(mn=new mn(Ne,De+"enter",Cn,b,nt),mn.target=Ve,mn.relatedTarget=ei,st=mn),ei=st,ze&&Cn)t:{for(mn=ze,Ne=Cn,De=0,Ve=mn;Ve;Ve=tv(Ve))De++;for(Ve=0,st=Ne;st;st=tv(st))Ve++;for(;0<De-Ve;)mn=tv(mn),De--;for(;0<Ve-De;)Ne=tv(Ne),Ve--;for(;De--;){if(mn===Ne||Ne!==null&&mn===Ne.alternate)break t;mn=tv(mn),Ne=tv(Ne)}mn=null}else mn=null;ze!==null&&QG(lt,Fe,ze,mn,!1),Cn!==null&&ei!==null&&QG(lt,ei,Cn,mn,!0)}}e:{if(Fe=$e?zr($e):window,ze=Fe.nodeName&&Fe.nodeName.toLowerCase(),ze==="select"||ze==="input"&&Fe.type==="file")var Ft=q;else if(tt(Fe))if(de)Ft=A;else{Ft=z;var nr=j}else ze=Fe.nodeName,!ze||ze.toLowerCase()!=="input"||Fe.type!=="checkbox"&&Fe.type!=="radio"?$e&&Vl($e.elementType)&&(Ft=q):Ft=P;if(Ft&&(Ft=Ft(g,$e))){mt(lt,Ft,b,nt);break e}nr&&nr(g,Fe,$e),g==="focusout"&&$e&&Fe.type==="number"&&$e.memoizedProps.value!=null&&eo(Fe,"number",Fe.value)}switch(nr=$e?zr($e):window,g){case"focusin":(tt(nr)||nr.contentEditable==="true")&&(Nt=nr,_t=$e,dn=null);break;case"focusout":dn=_t=Nt=null;break;case"mousedown":pn=!0;break;case"contextmenu":case"mouseup":case"dragend":pn=!1,lr(lt,b,nt);break;case"selectionchange":if(gt)break;case"keydown":case"keyup":lr(lt,b,nt)}var tn;if(Xc)e:{switch(g){case"compositionstart":var yn="onCompositionStart";break e;case"compositionend":yn="onCompositionEnd";break e;case"compositionupdate":yn="onCompositionUpdate";break e}yn=void 0}else Be?me(g,b)&&(yn="onCompositionEnd"):g==="keydown"&&b.keyCode===229&&(yn="onCompositionStart");yn&&($u&&b.locale!=="ko"&&(Be||yn!=="onCompositionStart"?yn==="onCompositionEnd"&&Be&&(tn=Go()):(Ci=nt,Pu="value"in Ci?Ci.value:Ci.textContent,Be=!0)),nr=m4($e,yn),0<nr.length&&(yn=new Fl(yn,g,null,b,nt),lt.push({event:yn,listeners:nr}),tn?yn.data=tn:(tn=Pe(b),tn!==null&&(yn.data=tn)))),(tn=zl?Qe(g,b):Je(g,b))&&(yn=m4($e,"onBeforeInput"),0<yn.length&&(nr=new Fl("onBeforeInput","beforeinput",null,b,nt),lt.push({event:nr,listeners:yn}),nr.data=tn)),l_e(lt,g,$e,b,nt)}XG(lt,v)})}function wx(g,v,b){return{instance:g,listener:v,currentTarget:b}}function m4(g,v){for(var b=v+"Capture",E=[];g!==null;){var R=g,N=R.stateNode;if(R=R.tag,R!==5&&R!==26&&R!==27||N===null||(R=zo(g,b),R!=null&&E.unshift(wx(g,R,N)),R=zo(g,v),R!=null&&E.push(wx(g,R,N))),g.tag===3)return E;g=g.return}return[]}function tv(g){if(g===null)return null;do g=g.return;while(g&&g.tag!==5&&g.tag!==27);return g||null}function QG(g,v,b,E,R){for(var N=v._reactName,Z=[];b!==null&&b!==E;){var ce=b,Se=ce.alternate,$e=ce.stateNode;if(ce=ce.tag,Se!==null&&Se===E)break;ce!==5&&ce!==26&&ce!==27||$e===null||(Se=$e,R?($e=zo(b,N),$e!=null&&Z.unshift(wx(b,$e,Se))):R||($e=zo(b,N),$e!=null&&Z.push(wx(b,$e,Se)))),b=b.return}Z.length!==0&&g.push({event:v,listeners:Z})}var h_e=/\r\n?/g,g_e=/\u0000|\uFFFD/g;function JG(g){return(typeof g=="string"?g:""+g).replace(h_e,`
`).replace(g_e,"")}function eW(g,v){return v=JG(v),JG(g)===v}function v4(){}function Jr(g,v,b,E,R,N){switch(b){case"children":typeof E=="string"?v==="body"||v==="textarea"&&E===""||ks(g,E):(typeof E=="number"||typeof E=="bigint")&&v!=="body"&&ks(g,""+E);break;case"className":Wc(g,"class",E);break;case"tabIndex":Wc(g,"tabindex",E);break;case"dir":case"role":case"viewBox":case"width":case"height":Wc(g,b,E);break;case"style":ui(g,E,N);break;case"data":if(v!=="object"){Wc(g,"data",E);break}case"src":case"href":if(E===""&&(v!=="a"||b!=="href")){g.removeAttribute(b);break}if(E==null||typeof E=="function"||typeof E=="symbol"||typeof E=="boolean"){g.removeAttribute(b);break}E=dc(""+E),g.setAttribute(b,E);break;case"action":case"formAction":if(typeof E=="function"){g.setAttribute(b,"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 N=="function"&&(b==="formAction"?(v!=="input"&&Jr(g,v,"name",R.name,R,null),Jr(g,v,"formEncType",R.formEncType,R,null),Jr(g,v,"formMethod",R.formMethod,R,null),Jr(g,v,"formTarget",R.formTarget,R,null)):(Jr(g,v,"encType",R.encType,R,null),Jr(g,v,"method",R.method,R,null),Jr(g,v,"target",R.target,R,null)));if(E==null||typeof E=="symbol"||typeof E=="boolean"){g.removeAttribute(b);break}E=dc(""+E),g.setAttribute(b,E);break;case"onClick":E!=null&&(g.onclick=v4);break;case"onScroll":E!=null&&or("scroll",g);break;case"onScrollEnd":E!=null&&or("scrollend",g);break;case"dangerouslySetInnerHTML":if(E!=null){if(typeof E!="object"||!("__html"in E))throw Error(r(61));if(b=E.__html,b!=null){if(R.children!=null)throw Error(r(60));g.innerHTML=b}}break;case"multiple":g.multiple=E&&typeof E!="function"&&typeof E!="symbol";break;case"muted":g.muted=E&&typeof E!="function"&&typeof E!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(E==null||typeof E=="function"||typeof E=="boolean"||typeof E=="symbol"){g.removeAttribute("xlink:href");break}b=dc(""+E),g.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",b);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":E!=null&&typeof E!="function"&&typeof E!="symbol"?g.setAttribute(b,""+E):g.removeAttribute(b);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":E&&typeof E!="function"&&typeof E!="symbol"?g.setAttribute(b,""):g.removeAttribute(b);break;case"capture":case"download":E===!0?g.setAttribute(b,""):E!==!1&&E!=null&&typeof E!="function"&&typeof E!="symbol"?g.setAttribute(b,E):g.removeAttribute(b);break;case"cols":case"rows":case"size":case"span":E!=null&&typeof E!="function"&&typeof E!="symbol"&&!isNaN(E)&&1<=E?g.setAttribute(b,E):g.removeAttribute(b);break;case"rowSpan":case"start":E==null||typeof E=="function"||typeof E=="symbol"||isNaN(E)?g.removeAttribute(b):g.setAttribute(b,E);break;case"popover":or("beforetoggle",g),or("toggle",g),ja(g,"popover",E);break;case"xlinkActuate":bi(g,"http://www.w3.org/1999/xlink","xlink:actuate",E);break;case"xlinkArcrole":bi(g,"http://www.w3.org/1999/xlink","xlink:arcrole",E);break;case"xlinkRole":bi(g,"http://www.w3.org/1999/xlink","xlink:role",E);break;case"xlinkShow":bi(g,"http://www.w3.org/1999/xlink","xlink:show",E);break;case"xlinkTitle":bi(g,"http://www.w3.org/1999/xlink","xlink:title",E);break;case"xlinkType":bi(g,"http://www.w3.org/1999/xlink","xlink:type",E);break;case"xmlBase":bi(g,"http://www.w3.org/XML/1998/namespace","xml:base",E);break;case"xmlLang":bi(g,"http://www.w3.org/XML/1998/namespace","xml:lang",E);break;case"xmlSpace":bi(g,"http://www.w3.org/XML/1998/namespace","xml:space",E);break;case"is":ja(g,"is",E);break;case"innerText":case"textContent":break;default:(!(2<b.length)||b[0]!=="o"&&b[0]!=="O"||b[1]!=="n"&&b[1]!=="N")&&(b=no.get(b)||b,ja(g,b,E))}}function iO(g,v,b,E,R,N){switch(b){case"style":ui(g,E,N);break;case"dangerouslySetInnerHTML":if(E!=null){if(typeof E!="object"||!("__html"in E))throw Error(r(61));if(b=E.__html,b!=null){if(R.children!=null)throw Error(r(60));g.innerHTML=b}}break;case"children":typeof E=="string"?ks(g,E):(typeof E=="number"||typeof E=="bigint")&&ks(g,""+E);break;case"onScroll":E!=null&&or("scroll",g);break;case"onScrollEnd":E!=null&&or("scrollend",g);break;case"onClick":E!=null&&(g.onclick=v4);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!kl.hasOwnProperty(b))e:{if(b[0]==="o"&&b[1]==="n"&&(R=b.endsWith("Capture"),v=b.slice(2,R?b.length-7:void 0),N=g[Gt]||null,N=N!=null?N[b]:null,typeof N=="function"&&g.removeEventListener(v,N,R),typeof E=="function")){typeof N!="function"&&N!==null&&(b in g?g[b]=null:g.hasAttribute(b)&&g.removeAttribute(b)),g.addEventListener(v,E,R);break e}b in g?g[b]=E:E===!0?g.setAttribute(b,""):ja(g,b,E)}}}function Ko(g,v,b){switch(v){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":or("error",g),or("load",g);var E=!1,R=!1,N;for(N in b)if(b.hasOwnProperty(N)){var Z=b[N];if(Z!=null)switch(N){case"src":E=!0;break;case"srcSet":R=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,v));default:Jr(g,v,N,Z,b,null)}}R&&Jr(g,v,"srcSet",b.srcSet,b,null),E&&Jr(g,v,"src",b.src,b,null);return;case"input":or("invalid",g);var ce=N=Z=R=null,Se=null,$e=null;for(E in b)if(b.hasOwnProperty(E)){var nt=b[E];if(nt!=null)switch(E){case"name":R=nt;break;case"type":Z=nt;break;case"checked":Se=nt;break;case"defaultChecked":$e=nt;break;case"value":N=nt;break;case"defaultValue":ce=nt;break;case"children":case"dangerouslySetInnerHTML":if(nt!=null)throw Error(r(137,v));break;default:Jr(g,v,E,nt,b,null)}}Df(g,N,ce,Se,$e,Z,R,!1),Ps(g);return;case"select":or("invalid",g),E=Z=N=null;for(R in b)if(b.hasOwnProperty(R)&&(ce=b[R],ce!=null))switch(R){case"value":N=ce;break;case"defaultValue":Z=ce;break;case"multiple":E=ce;default:Jr(g,v,R,ce,b,null)}v=N,b=Z,g.multiple=!!E,v!=null?aa(g,!!E,v,!1):b!=null&&aa(g,!!E,b,!0);return;case"textarea":or("invalid",g),N=R=E=null;for(Z in b)if(b.hasOwnProperty(Z)&&(ce=b[Z],ce!=null))switch(Z){case"value":E=ce;break;case"defaultValue":R=ce;break;case"children":N=ce;break;case"dangerouslySetInnerHTML":if(ce!=null)throw Error(r(91));break;default:Jr(g,v,Z,ce,b,null)}oa(g,E,R,N),Ps(g);return;case"option":for(Se in b)if(b.hasOwnProperty(Se)&&(E=b[Se],E!=null))switch(Se){case"selected":g.selected=E&&typeof E!="function"&&typeof E!="symbol";break;default:Jr(g,v,Se,E,b,null)}return;case"dialog":or("beforetoggle",g),or("toggle",g),or("cancel",g),or("close",g);break;case"iframe":case"object":or("load",g);break;case"video":case"audio":for(E=0;E<xx.length;E++)or(xx[E],g);break;case"image":or("error",g),or("load",g);break;case"details":or("toggle",g);break;case"embed":case"source":case"link":or("error",g),or("load",g);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for($e in b)if(b.hasOwnProperty($e)&&(E=b[$e],E!=null))switch($e){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,v));default:Jr(g,v,$e,E,b,null)}return;default:if(Vl(v)){for(nt in b)b.hasOwnProperty(nt)&&(E=b[nt],E!==void 0&&iO(g,v,nt,E,b,void 0));return}}for(ce in b)b.hasOwnProperty(ce)&&(E=b[ce],E!=null&&Jr(g,v,ce,E,b,null))}function p_e(g,v,b,E){switch(v){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var R=null,N=null,Z=null,ce=null,Se=null,$e=null,nt=null;for(ze in b){var lt=b[ze];if(b.hasOwnProperty(ze)&&lt!=null)switch(ze){case"checked":break;case"value":break;case"defaultValue":Se=lt;default:E.hasOwnProperty(ze)||Jr(g,v,ze,null,E,lt)}}for(var Fe in E){var ze=E[Fe];if(lt=b[Fe],E.hasOwnProperty(Fe)&&(ze!=null||lt!=null))switch(Fe){case"type":N=ze;break;case"name":R=ze;break;case"checked":$e=ze;break;case"defaultChecked":nt=ze;break;case"value":Z=ze;break;case"defaultValue":ce=ze;break;case"children":case"dangerouslySetInnerHTML":if(ze!=null)throw Error(r(137,v));break;default:ze!==lt&&Jr(g,v,Fe,ze,E,lt)}}Iu(g,Z,ce,Se,$e,nt,N,R);return;case"select":ze=Z=ce=Fe=null;for(N in b)if(Se=b[N],b.hasOwnProperty(N)&&Se!=null)switch(N){case"value":break;case"multiple":ze=Se;default:E.hasOwnProperty(N)||Jr(g,v,N,null,E,Se)}for(R in E)if(N=E[R],Se=b[R],E.hasOwnProperty(R)&&(N!=null||Se!=null))switch(R){case"value":Fe=N;break;case"defaultValue":ce=N;break;case"multiple":Z=N;default:N!==Se&&Jr(g,v,R,N,E,Se)}v=ce,b=Z,E=ze,Fe!=null?aa(g,!!b,Fe,!1):!!E!=!!b&&(v!=null?aa(g,!!b,v,!0):aa(g,!!b,b?[]:"",!1));return;case"textarea":ze=Fe=null;for(ce in b)if(R=b[ce],b.hasOwnProperty(ce)&&R!=null&&!E.hasOwnProperty(ce))switch(ce){case"value":break;case"children":break;default:Jr(g,v,ce,null,E,R)}for(Z in E)if(R=E[Z],N=b[Z],E.hasOwnProperty(Z)&&(R!=null||N!=null))switch(Z){case"value":Fe=R;break;case"defaultValue":ze=R;break;case"children":break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(r(91));break;default:R!==N&&Jr(g,v,Z,R,E,N)}to(g,Fe,ze);return;case"option":for(var Cn in b)if(Fe=b[Cn],b.hasOwnProperty(Cn)&&Fe!=null&&!E.hasOwnProperty(Cn))switch(Cn){case"selected":g.selected=!1;break;default:Jr(g,v,Cn,null,E,Fe)}for(Se in E)if(Fe=E[Se],ze=b[Se],E.hasOwnProperty(Se)&&Fe!==ze&&(Fe!=null||ze!=null))switch(Se){case"selected":g.selected=Fe&&typeof Fe!="function"&&typeof Fe!="symbol";break;default:Jr(g,v,Se,Fe,E,ze)}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 mn in b)Fe=b[mn],b.hasOwnProperty(mn)&&Fe!=null&&!E.hasOwnProperty(mn)&&Jr(g,v,mn,null,E,Fe);for($e in E)if(Fe=E[$e],ze=b[$e],E.hasOwnProperty($e)&&Fe!==ze&&(Fe!=null||ze!=null))switch($e){case"children":case"dangerouslySetInnerHTML":if(Fe!=null)throw Error(r(137,v));break;default:Jr(g,v,$e,Fe,E,ze)}return;default:if(Vl(v)){for(var ei in b)Fe=b[ei],b.hasOwnProperty(ei)&&Fe!==void 0&&!E.hasOwnProperty(ei)&&iO(g,v,ei,void 0,E,Fe);for(nt in E)Fe=E[nt],ze=b[nt],!E.hasOwnProperty(nt)||Fe===ze||Fe===void 0&&ze===void 0||iO(g,v,nt,Fe,E,ze);return}}for(var Ne in b)Fe=b[Ne],b.hasOwnProperty(Ne)&&Fe!=null&&!E.hasOwnProperty(Ne)&&Jr(g,v,Ne,null,E,Fe);for(lt in E)Fe=E[lt],ze=b[lt],!E.hasOwnProperty(lt)||Fe===ze||Fe==null&&ze==null||Jr(g,v,lt,Fe,E,ze)}var aO=null,oO=null;function y4(g){return g.nodeType===9?g:g.ownerDocument}function tW(g){switch(g){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function nW(g,v){if(g===0)switch(v){case"svg":return 1;case"math":return 2;default:return 0}return g===1&&v==="foreignObject"?0:g}function sO(g,v){return g==="textarea"||g==="noscript"||typeof v.children=="string"||typeof v.children=="number"||typeof v.children=="bigint"||typeof v.dangerouslySetInnerHTML=="object"&&v.dangerouslySetInnerHTML!==null&&v.dangerouslySetInnerHTML.__html!=null}var cO=null;function m_e(){var g=window.event;return g&&g.type==="popstate"?g===cO?!1:(cO=g,!0):(cO=null,!1)}var rW=typeof setTimeout=="function"?setTimeout:void 0,v_e=typeof clearTimeout=="function"?clearTimeout:void 0,iW=typeof Promise=="function"?Promise:void 0,y_e=typeof queueMicrotask=="function"?queueMicrotask:typeof iW<"u"?function(g){return iW.resolve(null).then(g).catch(x_e)}:rW;function x_e(g){setTimeout(function(){throw g})}function Xh(g){return g==="head"}function aW(g,v){var b=v,E=0,R=0;do{var N=b.nextSibling;if(g.removeChild(b),N&&N.nodeType===8)if(b=N.data,b==="/$"){if(0<E&&8>E){b=E;var Z=g.ownerDocument;if(b&1&&bx(Z.documentElement),b&2&&bx(Z.body),b&4)for(b=Z.head,bx(b),Z=b.firstChild;Z;){var ce=Z.nextSibling,Se=Z.nodeName;Z[os]||Se==="SCRIPT"||Se==="STYLE"||Se==="LINK"&&Z.rel.toLowerCase()==="stylesheet"||b.removeChild(Z),Z=ce}}if(R===0){g.removeChild(N),Mx(v);return}R--}else b==="$"||b==="$?"||b==="$!"?R++:E=b.charCodeAt(0)-48;else E=0;b=N}while(b);Mx(v)}function lO(g){var v=g.firstChild;for(v&&v.nodeType===10&&(v=v.nextSibling);v;){var b=v;switch(v=v.nextSibling,b.nodeName){case"HTML":case"HEAD":case"BODY":lO(b),Uo(b);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(b.rel.toLowerCase()==="stylesheet")continue}g.removeChild(b)}}function w_e(g,v,b,E){for(;g.nodeType===1;){var R=b;if(g.nodeName.toLowerCase()!==v.toLowerCase()){if(!E&&(g.nodeName!=="INPUT"||g.type!=="hidden"))break}else if(E){if(!g[os])switch(v){case"meta":if(!g.hasAttribute("itemprop"))break;return g;case"link":if(N=g.getAttribute("rel"),N==="stylesheet"&&g.hasAttribute("data-precedence"))break;if(N!==R.rel||g.getAttribute("href")!==(R.href==null||R.href===""?null:R.href)||g.getAttribute("crossorigin")!==(R.crossOrigin==null?null:R.crossOrigin)||g.getAttribute("title")!==(R.title==null?null:R.title))break;return g;case"style":if(g.hasAttribute("data-precedence"))break;return g;case"script":if(N=g.getAttribute("src"),(N!==(R.src==null?null:R.src)||g.getAttribute("type")!==(R.type==null?null:R.type)||g.getAttribute("crossorigin")!==(R.crossOrigin==null?null:R.crossOrigin))&&N&&g.hasAttribute("async")&&!g.hasAttribute("itemprop"))break;return g;default:return g}}else if(v==="input"&&g.type==="hidden"){var N=R.name==null?null:""+R.name;if(R.type==="hidden"&&g.getAttribute("name")===N)return g}else return g;if(g=Bu(g.nextSibling),g===null)break}return null}function b_e(g,v,b){if(v==="")return null;for(;g.nodeType!==3;)if((g.nodeType!==1||g.nodeName!=="INPUT"||g.type!=="hidden")&&!b||(g=Bu(g.nextSibling),g===null))return null;return g}function uO(g){return g.data==="$!"||g.data==="$?"&&g.ownerDocument.readyState==="complete"}function S_e(g,v){var b=g.ownerDocument;if(g.data!=="$?"||b.readyState==="complete")v();else{var E=function(){v(),b.removeEventListener("DOMContentLoaded",E)};b.addEventListener("DOMContentLoaded",E),g._reactRetry=E}}function Bu(g){for(;g!=null;g=g.nextSibling){var v=g.nodeType;if(v===1||v===3)break;if(v===8){if(v=g.data,v==="$"||v==="$!"||v==="$?"||v==="F!"||v==="F")break;if(v==="/$")return null}}return g}var fO=null;function oW(g){g=g.previousSibling;for(var v=0;g;){if(g.nodeType===8){var b=g.data;if(b==="$"||b==="$!"||b==="$?"){if(v===0)return g;v--}else b==="/$"&&v++}g=g.previousSibling}return null}function sW(g,v,b){switch(v=y4(b),g){case"html":if(g=v.documentElement,!g)throw Error(r(452));return g;case"head":if(g=v.head,!g)throw Error(r(453));return g;case"body":if(g=v.body,!g)throw Error(r(454));return g;default:throw Error(r(451))}}function bx(g){for(var v=g.attributes;v.length;)g.removeAttributeNode(v[0]);Uo(g)}var Zl=new Map,cW=new Set;function x4(g){return typeof g.getRootNode=="function"?g.getRootNode():g.nodeType===9?g:g.ownerDocument}var l0=Y.d;Y.d={f:C_e,r:__e,D:T_e,C:E_e,L:O_e,m:D_e,X:R_e,S:M_e,M:I_e};function C_e(){var g=l0.f(),v=u4();return g||v}function __e(g){var v=Fo(g);v!==null&&v.tag===5&&v.type==="form"?Dz(v):l0.r(g)}var nv=typeof document>"u"?null:document;function lW(g,v,b){var E=nv;if(E&&typeof v=="string"&&v){var R=Ua(v);R='link[rel="'+g+'"][href="'+R+'"]',typeof b=="string"&&(R+='[crossorigin="'+b+'"]'),cW.has(R)||(cW.add(R),g={rel:g,crossOrigin:b,href:v},E.querySelector(R)===null&&(v=E.createElement("link"),Ko(v,"link",g),Zt(v),E.head.appendChild(v)))}}function T_e(g){l0.D(g),lW("dns-prefetch",g,null)}function E_e(g,v){l0.C(g,v),lW("preconnect",g,v)}function O_e(g,v,b){l0.L(g,v,b);var E=nv;if(E&&g&&v){var R='link[rel="preload"][as="'+Ua(v)+'"]';v==="image"&&b&&b.imageSrcSet?(R+='[imagesrcset="'+Ua(b.imageSrcSet)+'"]',typeof b.imageSizes=="string"&&(R+='[imagesizes="'+Ua(b.imageSizes)+'"]')):R+='[href="'+Ua(g)+'"]';var N=R;switch(v){case"style":N=rv(g);break;case"script":N=iv(g)}Zl.has(N)||(g=u({rel:"preload",href:v==="image"&&b&&b.imageSrcSet?void 0:g,as:v},b),Zl.set(N,g),E.querySelector(R)!==null||v==="style"&&E.querySelector(Sx(N))||v==="script"&&E.querySelector(Cx(N))||(v=E.createElement("link"),Ko(v,"link",g),Zt(v),E.head.appendChild(v)))}}function D_e(g,v){l0.m(g,v);var b=nv;if(b&&g){var E=v&&typeof v.as=="string"?v.as:"script",R='link[rel="modulepreload"][as="'+Ua(E)+'"][href="'+Ua(g)+'"]',N=R;switch(E){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":N=iv(g)}if(!Zl.has(N)&&(g=u({rel:"modulepreload",href:g},v),Zl.set(N,g),b.querySelector(R)===null)){switch(E){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(b.querySelector(Cx(N)))return}E=b.createElement("link"),Ko(E,"link",g),Zt(E),b.head.appendChild(E)}}}function M_e(g,v,b){l0.S(g,v,b);var E=nv;if(E&&g){var R=ba(E).hoistableStyles,N=rv(g);v=v||"default";var Z=R.get(N);if(!Z){var ce={loading:0,preload:null};if(Z=E.querySelector(Sx(N)))ce.loading=5;else{g=u({rel:"stylesheet",href:g,"data-precedence":v},b),(b=Zl.get(N))&&dO(g,b);var Se=Z=E.createElement("link");Zt(Se),Ko(Se,"link",g),Se._p=new Promise(function($e,nt){Se.onload=$e,Se.onerror=nt}),Se.addEventListener("load",function(){ce.loading|=1}),Se.addEventListener("error",function(){ce.loading|=2}),ce.loading|=4,w4(Z,v,E)}Z={type:"stylesheet",instance:Z,count:1,state:ce},R.set(N,Z)}}}function R_e(g,v){l0.X(g,v);var b=nv;if(b&&g){var E=ba(b).hoistableScripts,R=iv(g),N=E.get(R);N||(N=b.querySelector(Cx(R)),N||(g=u({src:g,async:!0},v),(v=Zl.get(R))&&hO(g,v),N=b.createElement("script"),Zt(N),Ko(N,"link",g),b.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},E.set(R,N))}}function I_e(g,v){l0.M(g,v);var b=nv;if(b&&g){var E=ba(b).hoistableScripts,R=iv(g),N=E.get(R);N||(N=b.querySelector(Cx(R)),N||(g=u({src:g,async:!0,type:"module"},v),(v=Zl.get(R))&&hO(g,v),N=b.createElement("script"),Zt(N),Ko(N,"link",g),b.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},E.set(R,N))}}function uW(g,v,b,E){var R=(R=Oe.current)?x4(R):null;if(!R)throw Error(r(446));switch(g){case"meta":case"title":return null;case"style":return typeof b.precedence=="string"&&typeof b.href=="string"?(v=rv(b.href),b=ba(R).hoistableStyles,E=b.get(v),E||(E={type:"style",instance:null,count:0,state:null},b.set(v,E)),E):{type:"void",instance:null,count:0,state:null};case"link":if(b.rel==="stylesheet"&&typeof b.href=="string"&&typeof b.precedence=="string"){g=rv(b.href);var N=ba(R).hoistableStyles,Z=N.get(g);if(Z||(R=R.ownerDocument||R,Z={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},N.set(g,Z),(N=R.querySelector(Sx(g)))&&!N._p&&(Z.instance=N,Z.state.loading=5),Zl.has(g)||(b={rel:"preload",as:"style",href:b.href,crossOrigin:b.crossOrigin,integrity:b.integrity,media:b.media,hrefLang:b.hrefLang,referrerPolicy:b.referrerPolicy},Zl.set(g,b),N||N_e(R,g,b,Z.state))),v&&E===null)throw Error(r(528,""));return Z}if(v&&E!==null)throw Error(r(529,""));return null;case"script":return v=b.async,b=b.src,typeof b=="string"&&v&&typeof v!="function"&&typeof v!="symbol"?(v=iv(b),b=ba(R).hoistableScripts,E=b.get(v),E||(E={type:"script",instance:null,count:0,state:null},b.set(v,E)),E):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,g))}}function rv(g){return'href="'+Ua(g)+'"'}function Sx(g){return'link[rel="stylesheet"]['+g+"]"}function fW(g){return u({},g,{"data-precedence":g.precedence,precedence:null})}function N_e(g,v,b,E){g.querySelector('link[rel="preload"][as="style"]['+v+"]")?E.loading=1:(v=g.createElement("link"),E.preload=v,v.addEventListener("load",function(){return E.loading|=1}),v.addEventListener("error",function(){return E.loading|=2}),Ko(v,"link",b),Zt(v),g.head.appendChild(v))}function iv(g){return'[src="'+Ua(g)+'"]'}function Cx(g){return"script[async]"+g}function dW(g,v,b){if(v.count++,v.instance===null)switch(v.type){case"style":var E=g.querySelector('style[data-href~="'+Ua(b.href)+'"]');if(E)return v.instance=E,Zt(E),E;var R=u({},b,{"data-href":b.href,"data-precedence":b.precedence,href:null,precedence:null});return E=(g.ownerDocument||g).createElement("style"),Zt(E),Ko(E,"style",R),w4(E,b.precedence,g),v.instance=E;case"stylesheet":R=rv(b.href);var N=g.querySelector(Sx(R));if(N)return v.state.loading|=4,v.instance=N,Zt(N),N;E=fW(b),(R=Zl.get(R))&&dO(E,R),N=(g.ownerDocument||g).createElement("link"),Zt(N);var Z=N;return Z._p=new Promise(function(ce,Se){Z.onload=ce,Z.onerror=Se}),Ko(N,"link",E),v.state.loading|=4,w4(N,b.precedence,g),v.instance=N;case"script":return N=iv(b.src),(R=g.querySelector(Cx(N)))?(v.instance=R,Zt(R),R):(E=b,(R=Zl.get(N))&&(E=u({},b),hO(E,R)),g=g.ownerDocument||g,R=g.createElement("script"),Zt(R),Ko(R,"link",E),g.head.appendChild(R),v.instance=R);case"void":return null;default:throw Error(r(443,v.type))}else v.type==="stylesheet"&&(v.state.loading&4)===0&&(E=v.instance,v.state.loading|=4,w4(E,b.precedence,g));return v.instance}function w4(g,v,b){for(var E=b.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),R=E.length?E[E.length-1]:null,N=R,Z=0;Z<E.length;Z++){var ce=E[Z];if(ce.dataset.precedence===v)N=ce;else if(N!==R)break}N?N.parentNode.insertBefore(g,N.nextSibling):(v=b.nodeType===9?b.head:b,v.insertBefore(g,v.firstChild))}function dO(g,v){g.crossOrigin==null&&(g.crossOrigin=v.crossOrigin),g.referrerPolicy==null&&(g.referrerPolicy=v.referrerPolicy),g.title==null&&(g.title=v.title)}function hO(g,v){g.crossOrigin==null&&(g.crossOrigin=v.crossOrigin),g.referrerPolicy==null&&(g.referrerPolicy=v.referrerPolicy),g.integrity==null&&(g.integrity=v.integrity)}var b4=null;function hW(g,v,b){if(b4===null){var E=new Map,R=b4=new Map;R.set(b,E)}else R=b4,E=R.get(b),E||(E=new Map,R.set(b,E));if(E.has(g))return E;for(E.set(g,null),b=b.getElementsByTagName(g),R=0;R<b.length;R++){var N=b[R];if(!(N[os]||N[Dt]||g==="link"&&N.getAttribute("rel")==="stylesheet")&&N.namespaceURI!=="http://www.w3.org/2000/svg"){var Z=N.getAttribute(v)||"";Z=g+Z;var ce=E.get(Z);ce?ce.push(N):E.set(Z,[N])}}return E}function gW(g,v,b){g=g.ownerDocument||g,g.head.insertBefore(b,v==="title"?g.querySelector("head > title"):null)}function P_e(g,v,b){if(b===1||v.itemProp!=null)return!1;switch(g){case"meta":case"title":return!0;case"style":if(typeof v.precedence!="string"||typeof v.href!="string"||v.href==="")break;return!0;case"link":if(typeof v.rel!="string"||typeof v.href!="string"||v.href===""||v.onLoad||v.onError)break;switch(v.rel){case"stylesheet":return g=v.disabled,typeof v.precedence=="string"&&g==null;default:return!0}case"script":if(v.async&&typeof v.async!="function"&&typeof v.async!="symbol"&&!v.onLoad&&!v.onError&&v.src&&typeof v.src=="string")return!0}return!1}function pW(g){return!(g.type==="stylesheet"&&(g.state.loading&3)===0)}var _x=null;function k_e(){}function A_e(g,v,b){if(_x===null)throw Error(r(475));var E=_x;if(v.type==="stylesheet"&&(typeof b.media!="string"||matchMedia(b.media).matches!==!1)&&(v.state.loading&4)===0){if(v.instance===null){var R=rv(b.href),N=g.querySelector(Sx(R));if(N){g=N._p,g!==null&&typeof g=="object"&&typeof g.then=="function"&&(E.count++,E=S4.bind(E),g.then(E,E)),v.state.loading|=4,v.instance=N,Zt(N);return}N=g.ownerDocument||g,b=fW(b),(R=Zl.get(R))&&dO(b,R),N=N.createElement("link"),Zt(N);var Z=N;Z._p=new Promise(function(ce,Se){Z.onload=ce,Z.onerror=Se}),Ko(N,"link",b),v.instance=N}E.stylesheets===null&&(E.stylesheets=new Map),E.stylesheets.set(v,g),(g=v.state.preload)&&(v.state.loading&3)===0&&(E.count++,v=S4.bind(E),g.addEventListener("load",v),g.addEventListener("error",v))}}function L_e(){if(_x===null)throw Error(r(475));var g=_x;return g.stylesheets&&g.count===0&&gO(g,g.stylesheets),0<g.count?function(v){var b=setTimeout(function(){if(g.stylesheets&&gO(g,g.stylesheets),g.unsuspend){var E=g.unsuspend;g.unsuspend=null,E()}},6e4);return g.unsuspend=v,function(){g.unsuspend=null,clearTimeout(b)}}:null}function S4(){if(this.count--,this.count===0){if(this.stylesheets)gO(this,this.stylesheets);else if(this.unsuspend){var g=this.unsuspend;this.unsuspend=null,g()}}}var C4=null;function gO(g,v){g.stylesheets=null,g.unsuspend!==null&&(g.count++,C4=new Map,v.forEach(V_e,g),C4=null,S4.call(g))}function V_e(g,v){if(!(v.state.loading&4)){var b=C4.get(g);if(b)var E=b.get(null);else{b=new Map,C4.set(g,b);for(var R=g.querySelectorAll("link[data-precedence],style[data-precedence]"),N=0;N<R.length;N++){var Z=R[N];(Z.nodeName==="LINK"||Z.getAttribute("media")!=="not all")&&(b.set(Z.dataset.precedence,Z),E=Z)}E&&b.set(null,E)}R=v.instance,Z=R.getAttribute("data-precedence"),N=b.get(Z)||E,N===E&&b.set(null,R),b.set(Z,R),this.count++,E=S4.bind(this),R.addEventListener("load",E),R.addEventListener("error",E),N?N.parentNode.insertBefore(R,N.nextSibling):(g=g.nodeType===9?g.head:g,g.insertBefore(R,g.firstChild)),v.state.loading|=4}}var Tx={$$typeof:C,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function $_e(g,v,b,E,R,N,Z,ce){this.tag=1,this.containerInfo=g,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=gn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gn(0),this.hiddenUpdates=gn(null),this.identifierPrefix=E,this.onUncaughtError=R,this.onCaughtError=N,this.onRecoverableError=Z,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ce,this.incompleteTransitions=new Map}function mW(g,v,b,E,R,N,Z,ce,Se,$e,nt,lt){return g=new $_e(g,v,b,Z,ce,Se,$e,lt),v=1,N===!0&&(v|=24),N=Zc(3,null,null,v),g.current=N,N.stateNode=g,v=Y9(),v.refCount++,g.pooledCache=v,v.refCount++,N.memoizedState={element:E,isDehydrated:b,cache:v},J9(N),g}function vW(g){return g?(g=A1,g):A1}function yW(g,v,b,E,R,N){R=vW(R),E.context===null?E.context=R:E.pendingContext=R,E=Vh(v),E.payload={element:b},N=N===void 0?null:N,N!==null&&(E.callback=N),b=$h(g,E,v),b!==null&&(nl(b,g,v),tx(b,g,v))}function xW(g,v){if(g=g.memoizedState,g!==null&&g.dehydrated!==null){var b=g.retryLane;g.retryLane=b!==0&&b<v?b:v}}function pO(g,v){xW(g,v),(g=g.alternate)&&xW(g,v)}function wW(g){if(g.tag===13){var v=k1(g,67108864);v!==null&&nl(v,g,67108864),pO(g,67108864)}}var _4=!0;function j_e(g,v,b,E){var R=U.T;U.T=null;var N=Y.p;try{Y.p=2,mO(g,v,b,E)}finally{Y.p=N,U.T=R}}function U_e(g,v,b,E){var R=U.T;U.T=null;var N=Y.p;try{Y.p=8,mO(g,v,b,E)}finally{Y.p=N,U.T=R}}function mO(g,v,b,E){if(_4){var R=vO(E);if(R===null)rO(g,v,E,T4,b),SW(g,E);else if(B_e(R,g,v,b,E))E.stopPropagation();else if(SW(g,E),v&4&&-1<F_e.indexOf(g)){for(;R!==null;){var N=Fo(R);if(N!==null)switch(N.tag){case 3:if(N=N.stateNode,N.current.memoizedState.isDehydrated){var Z=Mn(N.pendingLanes);if(Z!==0){var ce=N;for(ce.pendingLanes|=2,ce.entangledLanes|=2;Z;){var Se=1<<31-Pt(Z);ce.entanglements[1]|=Se,Z&=~Se}zf(N),(Wr&6)===0&&(c4=en()+500,yx(0))}}break;case 13:ce=k1(N,2),ce!==null&&nl(ce,N,2),u4(),pO(N,2)}if(N=vO(E),N===null&&rO(g,v,E,T4,b),N===R)break;R=N}R!==null&&E.stopPropagation()}else rO(g,v,E,null,b)}}function vO(g){return g=Sa(g),yO(g)}var T4=null;function yO(g){if(T4=null,g=wo(g),g!==null){var v=a(g);if(v===null)g=null;else{var b=v.tag;if(b===13){if(g=o(v),g!==null)return g;g=null}else if(b===3){if(v.stateNode.current.memoizedState.isDehydrated)return v.tag===3?v.stateNode.containerInfo:null;g=null}else v!==g&&(g=null)}}return T4=g,null}function bW(g){switch(g){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(tr()){case Ke:return 2;case ue:return 8;case B:case K:return 32;case fe:return 268435456;default:return 32}default:return 32}}var xO=!1,Zh=null,Qh=null,Jh=null,Ex=new Map,Ox=new Map,eg=[],F_e="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 SW(g,v){switch(g){case"focusin":case"focusout":Zh=null;break;case"dragenter":case"dragleave":Qh=null;break;case"mouseover":case"mouseout":Jh=null;break;case"pointerover":case"pointerout":Ex.delete(v.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ox.delete(v.pointerId)}}function Dx(g,v,b,E,R,N){return g===null||g.nativeEvent!==N?(g={blockedOn:v,domEventName:b,eventSystemFlags:E,nativeEvent:N,targetContainers:[R]},v!==null&&(v=Fo(v),v!==null&&wW(v)),g):(g.eventSystemFlags|=E,v=g.targetContainers,R!==null&&v.indexOf(R)===-1&&v.push(R),g)}function B_e(g,v,b,E,R){switch(v){case"focusin":return Zh=Dx(Zh,g,v,b,E,R),!0;case"dragenter":return Qh=Dx(Qh,g,v,b,E,R),!0;case"mouseover":return Jh=Dx(Jh,g,v,b,E,R),!0;case"pointerover":var N=R.pointerId;return Ex.set(N,Dx(Ex.get(N)||null,g,v,b,E,R)),!0;case"gotpointercapture":return N=R.pointerId,Ox.set(N,Dx(Ox.get(N)||null,g,v,b,E,R)),!0}return!1}function CW(g){var v=wo(g.target);if(v!==null){var b=a(v);if(b!==null){if(v=b.tag,v===13){if(v=o(b),v!==null){g.blockedOn=v,Vn(g.priority,function(){if(b.tag===13){var E=tl();E=Bn(E);var R=k1(b,E);R!==null&&nl(R,b,E),pO(b,E)}});return}}else if(v===3&&b.stateNode.current.memoizedState.isDehydrated){g.blockedOn=b.tag===3?b.stateNode.containerInfo:null;return}}}g.blockedOn=null}function E4(g){if(g.blockedOn!==null)return!1;for(var v=g.targetContainers;0<v.length;){var b=vO(g.nativeEvent);if(b===null){b=g.nativeEvent;var E=new b.constructor(b.type,b);cs=E,b.target.dispatchEvent(E),cs=null}else return v=Fo(b),v!==null&&wW(v),g.blockedOn=b,!1;v.shift()}return!0}function _W(g,v,b){E4(g)&&b.delete(v)}function z_e(){xO=!1,Zh!==null&&E4(Zh)&&(Zh=null),Qh!==null&&E4(Qh)&&(Qh=null),Jh!==null&&E4(Jh)&&(Jh=null),Ex.forEach(_W),Ox.forEach(_W)}function O4(g,v){g.blockedOn===v&&(g.blockedOn=null,xO||(xO=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,z_e)))}var D4=null;function TW(g){D4!==g&&(D4=g,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){D4===g&&(D4=null);for(var v=0;v<g.length;v+=3){var b=g[v],E=g[v+1],R=g[v+2];if(typeof E!="function"){if(yO(E||b)===null)continue;break}var N=Fo(b);N!==null&&(g.splice(v,3),v-=3,y7(N,{pending:!0,data:R,method:b.method,action:E},E,R))}}))}function Mx(g){function v(Se){return O4(Se,g)}Zh!==null&&O4(Zh,g),Qh!==null&&O4(Qh,g),Jh!==null&&O4(Jh,g),Ex.forEach(v),Ox.forEach(v);for(var b=0;b<eg.length;b++){var E=eg[b];E.blockedOn===g&&(E.blockedOn=null)}for(;0<eg.length&&(b=eg[0],b.blockedOn===null);)CW(b),b.blockedOn===null&&eg.shift();if(b=(g.ownerDocument||g).$$reactFormReplay,b!=null)for(E=0;E<b.length;E+=3){var R=b[E],N=b[E+1],Z=R[Gt]||null;if(typeof N=="function")Z||TW(b);else if(Z){var ce=null;if(N&&N.hasAttribute("formAction")){if(R=N,Z=N[Gt]||null)ce=Z.formAction;else if(yO(R)!==null)continue}else ce=Z.action;typeof ce=="function"?b[E+1]=ce:(b.splice(E,3),E-=3),TW(b)}}}function wO(g){this._internalRoot=g}M4.prototype.render=wO.prototype.render=function(g){var v=this._internalRoot;if(v===null)throw Error(r(409));var b=v.current,E=tl();yW(b,E,g,v,null,null)},M4.prototype.unmount=wO.prototype.unmount=function(){var g=this._internalRoot;if(g!==null){this._internalRoot=null;var v=g.containerInfo;yW(g.current,2,null,g,null,null),u4(),v[Ut]=null}};function M4(g){this._internalRoot=g}M4.prototype.unstable_scheduleHydration=function(g){if(g){var v=wi();g={blockedOn:null,target:g,priority:v};for(var b=0;b<eg.length&&v!==0&&v<eg[b].priority;b++);eg.splice(b,0,g),b===0&&CW(g)}};var EW=e.version;if(EW!=="19.1.1")throw Error(r(527,EW,"19.1.1"));Y.findDOMNode=function(g){var v=g._reactInternals;if(v===void 0)throw typeof g.render=="function"?Error(r(188)):(g=Object.keys(g).join(","),Error(r(268,g)));return g=c(v),g=g!==null?l(g):null,g=g===null?null:g.stateNode,g};var G_e={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var R4=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!R4.isDisabled&&R4.supportsFiber)try{Re=R4.inject(G_e),et=R4}catch{}}return Ix.createRoot=function(g,v){if(!i(g))throw Error(r(299));var b=!1,E="",R=Bz,N=zz,Z=Gz,ce=null;return v!=null&&(v.unstable_strictMode===!0&&(b=!0),v.identifierPrefix!==void 0&&(E=v.identifierPrefix),v.onUncaughtError!==void 0&&(R=v.onUncaughtError),v.onCaughtError!==void 0&&(N=v.onCaughtError),v.onRecoverableError!==void 0&&(Z=v.onRecoverableError),v.unstable_transitionCallbacks!==void 0&&(ce=v.unstable_transitionCallbacks)),v=mW(g,1,!1,null,null,b,E,R,N,Z,ce,null),g[Ut]=v.current,nO(g),new wO(v)},Ix.hydrateRoot=function(g,v,b){if(!i(g))throw Error(r(299));var E=!1,R="",N=Bz,Z=zz,ce=Gz,Se=null,$e=null;return b!=null&&(b.unstable_strictMode===!0&&(E=!0),b.identifierPrefix!==void 0&&(R=b.identifierPrefix),b.onUncaughtError!==void 0&&(N=b.onUncaughtError),b.onCaughtError!==void 0&&(Z=b.onCaughtError),b.onRecoverableError!==void 0&&(ce=b.onRecoverableError),b.unstable_transitionCallbacks!==void 0&&(Se=b.unstable_transitionCallbacks),b.formState!==void 0&&($e=b.formState)),v=mW(g,1,!0,v,b??null,E,R,N,Z,ce,Se,$e),v.context=vW(null),b=v.current,E=tl(),E=Bn(E),R=Vh(E),R.callback=null,$h(b,R,E),b=E,v.current.lanes=b,Kn(v,b),zf(v),g[Ut]=v.current,nO(g),new M4(v)},Ix.version="19.1.1",Ix}var LW;function tTe(){if(LW)return SO.exports;LW=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(),SO.exports=eTe(),SO.exports}var nTe=tTe(),D=Jy();const Ce=ka(D),Bk=H_e({__proto__:null,default:Ce},[D]),Nn=t=>typeof t=="string",Nx=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},VW=t=>t==null?"":""+t,rTe=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},iTe=/###/g,$W=t=>t&&t.indexOf("###")>-1?t.replace(iTe,"."):t,jW=t=>!t||Nn(t),P5=(t,e,n)=>{const r=Nn(e)?e.split("."):e;let i=0;for(;i<r.length-1;){if(jW(t))return{};const a=$W(r[i]);!t[a]&&n&&(t[a]=new n),Object.prototype.hasOwnProperty.call(t,a)?t=t[a]:t={},++i}return jW(t)?{}:{obj:t,k:$W(r[i])}},UW=(t,e,n)=>{const{obj:r,k:i}=P5(t,e,Object);if(r!==void 0||e.length===1){r[i]=n;return}let a=e[e.length-1],o=e.slice(0,e.length-1),s=P5(t,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=P5(t,o,Object),s?.obj&&typeof s.obj[`${s.k}.${a}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},aTe=(t,e,n,r)=>{const{obj:i,k:a}=P5(t,e,Object);i[a]=i[a]||[],i[a].push(n)},n_=(t,e)=>{const{obj:n,k:r}=P5(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},oTe=(t,e,n)=>{const r=n_(t,n);return r!==void 0?r:n_(e,n)},Ire=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?Nn(t[r])||t[r]instanceof String||Nn(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):Ire(t[r],e[r],n):t[r]=e[r]);return t},av=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var sTe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const cTe=t=>Nn(t)?t.replace(/[&<>"'\/]/g,e=>sTe[e]):t;class lTe{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const uTe=[" ",",","?","!",";"],fTe=new lTe(20),dTe=(t,e,n)=>{e=e||"",n=n||"";const r=uTe.filter(o=>e.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const i=fTe.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let a=!i.test(t);if(!a){const o=t.indexOf(n);o>0&&!i.test(t.substring(0,o))&&(a=!0)}return a},_I=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const r=e.split(n);let i=t;for(let a=0;a<r.length;){if(!i||typeof i!="object")return;let o,s="";for(let c=a;c<r.length;++c)if(c!==a&&(s+=n),s+=r[c],o=i[s],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<r.length-1)continue;a+=c-a+1;break}i=o}return i},sw=t=>t?.replace("_","-"),hTe={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class r_{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||hTe,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,r,i){return i&&!this.debug?null:(Nn(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new r_(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new r_(this.logger,e)}}var ad=new r_;let w6=class{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const i=this.observers[r].get(n)||0;this.observers[r].set(n,i+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([i,a])=>{for(let o=0;o<a;o++)i(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,a])=>{for(let o=0;o<a;o++)i.apply(i,[e,...n])})}};class FW extends w6{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r,i={}){const a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let s;e.indexOf(".")>-1?s=e.split("."):(s=[e,n],r&&(Array.isArray(r)?s.push(...r):Nn(r)&&a?s.push(...r.split(a)):s.push(r)));const c=n_(this.data,s);return!c&&!n&&!r&&e.indexOf(".")>-1&&(e=s[0],n=s[1],r=s.slice(2).join(".")),c||!o||!Nn(r)?c:_I(this.data?.[e]?.[n],r,a)}addResource(e,n,r,i,a={silent:!1}){const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let s=[e,n];r&&(s=s.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(s=e.split("."),i=n,n=s[1]),this.addNamespaces(n),UW(this.data,s,i),a.silent||this.emit("added",e,n,r,i)}addResources(e,n,r,i={silent:!1}){for(const a in r)(Nn(r[a])||Array.isArray(r[a]))&&this.addResource(e,n,a,r[a],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,a,o={silent:!1,skipCopy:!1}){let s=[e,n];e.indexOf(".")>-1&&(s=e.split("."),i=r,r=n,n=s[1]),this.addNamespaces(n);let c=n_(this.data,s)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?Ire(c,r,a):c={...c,...r},UW(this.data,s,c),o.silent||this.emit("added",e,n,r)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var Nre={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(a=>{e=this.processors[a]?.process(e,n,r,i)??e}),e}};const Pre=Symbol("i18next/PATH_KEY");function gTe(){const t=[],e=Object.create(null);let n;return e.get=(r,i)=>(n?.revoke?.(),i===Pre?t:(t.push(i),n=Proxy.revocable(r,e),n.proxy)),Proxy.revocable(Object.create(null),e).proxy}function i_(t,e){const{[Pre]:n}=t(gTe());return n.join(e?.keySeparator??".")}const BW={},OO=t=>!Nn(t)&&typeof t!="boolean"&&typeof t!="number";class a_ extends w6{constructor(e,n={}){super(),rTe(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ad.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const r={...n};if(e==null)return!1;const i=this.resolve(e,r);if(i?.res===void 0)return!1;const a=OO(i.res);return!(r.returnObjects===!1&&a)}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let a=n.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!dTe(e,r,i);if(o&&!s){const c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:Nn(a)?[a]:a};const l=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(l[0])>-1)&&(a=l.shift()),e=l.join(i)}return{key:e,namespaces:Nn(a)?[a]:a}}translate(e,n,r){let i=typeof n=="object"?{...n}:n;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i={...i}),i||(i={}),e==null)return"";typeof e=="function"&&(e=i_(e,{...this.options,...i})),Array.isArray(e)||(e=[String(e)]);const a=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:s,namespaces:c}=this.extractFromKey(e[e.length-1],i),l=c[c.length-1];let u=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");const f=i.lng||this.language,d=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()==="cimode")return d?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:f,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:f,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;const h=this.resolve(e,i);let m=h?.res;const p=h?.usedKey||s,y=h?.exactUsedKey||s,x=["[object Number]","[object Function]","[object RegExp]"],S=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,C=!this.i18nFormat||this.i18nFormat.handleAsObject,_=i.count!==void 0&&!Nn(i.count),T=a_.hasDefaultValue(i),O=_?this.pluralResolver.getSuffix(f,i.count,i):"",M=i.ordinal&&_?this.pluralResolver.getSuffix(f,i.count,{ordinal:!1}):"",I=_&&!i.ordinal&&i.count===0,V=I&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${O}`]||i[`defaultValue${M}`]||i.defaultValue;let k=m;C&&!m&&T&&(k=V);const L=OO(k),$=Object.prototype.toString.apply(k);if(C&&k&&L&&x.indexOf($)<0&&!(Nn(S)&&Array.isArray(k))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const W=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,k,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(h.res=W,h.usedParams=this.getUsedParamsDetails(i),h):W}if(o){const W=Array.isArray(k),G=W?[]:{},oe=W?y:p;for(const U in k)if(Object.prototype.hasOwnProperty.call(k,U)){const Y=`${oe}${o}${U}`;T&&!m?G[U]=this.translate(Y,{...i,defaultValue:OO(V)?V[U]:void 0,joinArrays:!1,ns:c}):G[U]=this.translate(Y,{...i,joinArrays:!1,ns:c}),G[U]===Y&&(G[U]=k[U])}m=G}}else if(C&&Nn(S)&&Array.isArray(m))m=m.join(S),m&&(m=this.extendTranslation(m,e,i,r));else{let W=!1,G=!1;!this.isValidLookup(m)&&T&&(W=!0,m=V),this.isValidLookup(m)||(G=!0,m=s);const U=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&G?void 0:m,Y=T&&V!==m&&this.options.updateMissing;if(G||W||Y){if(this.logger.log(Y?"updateKey":"missingKey",f,l,s,Y?V:m),o){const ae=this.resolve(s,{...i,keySeparator:!1});ae&&ae.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let J=[];const ne=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ne&&ne[0])for(let ae=0;ae<ne.length;ae++)J.push(ne[ae]);else this.options.saveMissingTo==="all"?J=this.languageUtils.toResolveHierarchy(i.lng||this.language):J.push(i.lng||this.language);const F=(ae,re,te)=>{const ye=T&&te!==m?te:U;this.options.missingKeyHandler?this.options.missingKeyHandler(ae,l,re,ye,Y,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(ae,l,re,ye,Y,i),this.emit("missingKey",ae,l,re,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&_?J.forEach(ae=>{const re=this.pluralResolver.getSuffixes(ae,i);I&&i[`defaultValue${this.options.pluralSeparator}zero`]&&re.indexOf(`${this.options.pluralSeparator}zero`)<0&&re.push(`${this.options.pluralSeparator}zero`),re.forEach(te=>{F([ae],s+te,i[`defaultValue${te}`]||V)})}):F(J,s,V))}m=this.extendTranslation(m,e,i,h,r),G&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(G||W)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,W?m:void 0,i))}return a?(h.res=m,h.usedParams=this.getUsedParamsDetails(i),h):m}extendTranslation(e,n,r,i,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const c=Nn(e)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let l;if(c){const f=e.match(this.interpolator.nestingRegexp);l=f&&f.length}let u=r.replace&&!Nn(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),e=this.interpolator.interpolate(e,u,r.lng||this.language||i.usedLng,r),c){const f=e.match(this.interpolator.nestingRegexp),d=f&&f.length;l<d&&(r.nest=!1)}!r.lng&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,(...f)=>a?.[0]===f[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${n[0]}`),null):this.translate(...f,n),r)),r.interpolation&&this.interpolator.reset()}const o=r.postProcess||this.options.postProcess,s=Nn(o)?[o]:o;return e!=null&&s?.length&&r.applyPostProcessor!==!1&&(e=Nre.handle(s,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,n={}){let r,i,a,o,s;return Nn(e)&&(e=[e]),e.forEach(c=>{if(this.isValidLookup(r))return;const l=this.extractFromKey(c,n),u=l.key;i=u;let f=l.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const d=n.count!==void 0&&!Nn(n.count),h=d&&!n.ordinal&&n.count===0,m=n.context!==void 0&&(Nn(n.context)||typeof n.context=="number")&&n.context!=="",p=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(y=>{this.isValidLookup(r)||(s=y,!BW[`${p[0]}-${y}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(BW[`${p[0]}-${y}`]=!0,this.logger.warn(`key "${i}" for languages "${p.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(x=>{if(this.isValidLookup(r))return;o=x;const S=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(S,u,x,y,n);else{let _;d&&(_=this.pluralResolver.getSuffix(x,n.count,n));const T=`${this.options.pluralSeparator}zero`,O=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(n.ordinal&&_.indexOf(O)===0&&S.push(u+_.replace(O,this.options.pluralSeparator)),S.push(u+_),h&&S.push(u+T)),m){const M=`${u}${this.options.contextSeparator||"_"}${n.context}`;S.push(M),d&&(n.ordinal&&_.indexOf(O)===0&&S.push(M+_.replace(O,this.options.pluralSeparator)),S.push(M+_),h&&S.push(M+T))}}let C;for(;C=S.pop();)this.isValidLookup(r)||(a=C,r=this.getResource(x,y,C,n))}))})}),{res:r,usedKey:i,exactUsedKey:a,usedLng:o,usedNS:s}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,n,r,i):this.resourceStore.getResource(e,n,r,i)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!Nn(e.replace);let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const a of n)delete i[a]}return i}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n===r.substring(0,n.length)&&e[r]!==void 0)return!0;return!1}}class zW{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ad.create("languageUtils")}getScriptPartFromCode(e){if(e=sw(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=sw(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(Nn(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getScriptPartFromCode(r);if(this.isSupportedCode(i))return n=i;const a=this.getLanguagePartFromCode(r);if(this.isSupportedCode(a))return n=a;n=this.options.supportedLngs.find(o=>{if(o===a)return o;if(!(o.indexOf("-")<0&&a.indexOf("-")<0)&&(o.indexOf("-")>0&&a.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===a||o.indexOf(a)===0&&a.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),Nn(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),i=[],a=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return Nn(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(e))):Nn(e)&&a(this.formatLanguageCode(e)),r.forEach(o=>{i.indexOf(o)<0&&a(this.formatLanguageCode(o))}),i}}const GW={zero:0,one:1,two:2,few:3,many:4,other:5},WW={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class pTe{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=ad.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,n){this.rules[e]=n}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const r=sw(e==="dev"?"en":e),i=n.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:r,type:i});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];let o;try{o=new Intl.PluralRules(r,{type:i})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),WW;if(!e.match(/-|_/))return WW;const c=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(c,n)}return this.pluralRulesCache[a]=o,o}needsPlural(e,n={}){let r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,n,r={}){return this.getSuffixes(e,r).map(i=>`${n}${i}`)}getSuffixes(e,n={}){let r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((i,a)=>GW[i]-GW[a]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,n,r={}){const i=this.getRule(e,r);return i?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,r))}}const HW=(t,e,n,r=".",i=!0)=>{let a=oTe(t,e,n);return!a&&i&&Nn(n)&&(a=_I(t,n,r),a===void 0&&(a=_I(e,n,r))),a},DO=t=>t.replace(/\$/g,"$$$$");class mTe{constructor(e={}){this.logger=ad.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(n=>n),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:i,prefix:a,prefixEscaped:o,suffix:s,suffixEscaped:c,formatSeparator:l,unescapeSuffix:u,unescapePrefix:f,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:m,nestingSuffixEscaped:p,nestingOptionsSeparator:y,maxReplaces:x,alwaysFormat:S}=e.interpolation;this.escape=n!==void 0?n:cTe,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=a?av(a):o||"{{",this.suffix=s?av(s):c||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=d?av(d):h||av("$t("),this.nestingSuffix=m?av(m):p||av(")"),this.nestingOptionsSeparator=y||",",this.maxReplaces=x||1e3,this.alwaysFormat=S!==void 0?S:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,r)=>n?.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,r,i){let a,o,s;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=h=>{if(h.indexOf(this.formatSeparator)<0){const x=HW(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(x,void 0,r,{...i,...n,interpolationkey:h}):x}const m=h.split(this.formatSeparator),p=m.shift().trim(),y=m.join(this.formatSeparator).trim();return this.format(HW(n,c,p,this.options.keySeparator,this.options.ignoreJSONStructure),y,r,{...i,...n,interpolationkey:p})};this.resetRegExp();const u=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>DO(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?DO(this.escape(h)):DO(h)}].forEach(h=>{for(s=0;a=h.regex.exec(e);){const m=a[1].trim();if(o=l(m),o===void 0)if(typeof u=="function"){const y=u(e,a,i);o=Nn(y)?y:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))o="";else if(f){o=a[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`),o="";else!Nn(o)&&!this.useRawValueToEscape&&(o=VW(o));const p=h.safeValue(o);if(e=e.replace(a[0],p),f?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=a[0].length):h.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),e}nest(e,n,r={}){let i,a,o;const s=(c,l)=>{const u=this.nestingOptionsSeparator;if(c.indexOf(u)<0)return c;const f=c.split(new RegExp(`${u}[ ]*{`));let d=`{${f[1]}`;c=f[0],d=this.interpolate(d,o);const h=d.match(/'/g),m=d.match(/"/g);((h?.length??0)%2===0&&!m||m.length%2!==0)&&(d=d.replace(/'/g,'"'));try{o=JSON.parse(d),l&&(o={...l,...o})}catch(p){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,p),`${c}${u}${d}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;i=this.nestingRegexp.exec(e);){let c=[];o={...r},o=o.replace&&!Nn(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const l=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(l!==-1&&(c=i[1].slice(l).split(this.formatSeparator).map(u=>u.trim()).filter(Boolean),i[1]=i[1].slice(0,l)),a=n(s.call(this,i[1].trim(),o),o),a&&i[0]===e&&!Nn(a))return a;Nn(a)||(a=VW(a)),a||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),a=""),c.length&&(a=c.reduce((u,f)=>this.format(u,f,r.lng,{...r,interpolationkey:i[1].trim()}),a.trim())),e=e.replace(i[0],a),this.regexp.lastIndex=0}return e}}const vTe=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const r=t.split("(");e=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);e==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(o){const[s,...c]=o.split(":"),l=c.join(":").trim().replace(/^'+|'+$/g,""),u=s.trim();n[u]||(n[u]=l),l==="false"&&(n[u]=!1),l==="true"&&(n[u]=!0),isNaN(l)||(n[u]=parseInt(l,10))}})}return{formatName:e,formatOptions:n}},qW=t=>{const e={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});const o=r+JSON.stringify(a);let s=e[o];return s||(s=t(sw(r),i),e[o]=s),s(n)}},yTe=t=>(e,n,r)=>t(sw(n),r)(e);class xTe{constructor(e={}){this.logger=ad.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?qW:yTe;this.formats={number:r((i,a)=>{const o=new Intl.NumberFormat(i,{...a});return s=>o.format(s)}),currency:r((i,a)=>{const o=new Intl.NumberFormat(i,{...a,style:"currency"});return s=>o.format(s)}),datetime:r((i,a)=>{const o=new Intl.DateTimeFormat(i,{...a});return s=>o.format(s)}),relativetime:r((i,a)=>{const o=new Intl.RelativeTimeFormat(i,{...a});return s=>o.format(s,a.range||"day")}),list:r((i,a)=>{const o=new Intl.ListFormat(i,{...a});return s=>o.format(s)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=qW(n)}format(e,n,r,i={}){const a=n.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&a[0].indexOf(")")<0&&a.find(s=>s.indexOf(")")>-1)){const s=a.findIndex(c=>c.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,s)].join(this.formatSeparator)}return a.reduce((s,c)=>{const{formatName:l,formatOptions:u}=vTe(c);if(this.formats[l]){let f=s;try{const d=i?.formatParams?.[i.interpolationkey]||{},h=d.locale||d.lng||i.locale||i.lng||r;f=this.formats[l](s,h,{...u,...i,...d})}catch(d){this.logger.warn(d)}return f}else this.logger.warn(`there was no format function for ${l}`);return s},e)}}const wTe=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class bTe extends w6{constructor(e,n,r,i={}){super(),this.backend=e,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=ad.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,i.backend,i)}queueLoad(e,n,r,i){const a={},o={},s={},c={};return e.forEach(l=>{let u=!0;n.forEach(f=>{const d=`${l}|${f}`;!r.reload&&this.store.hasResourceBundle(l,f)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?o[d]===void 0&&(o[d]=!0):(this.state[d]=1,u=!1,o[d]===void 0&&(o[d]=!0),a[d]===void 0&&(a[d]=!0),c[f]===void 0&&(c[f]=!0)))}),u||(s[l]=!0)}),(Object.keys(a).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(a),pending:Object.keys(o),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(c)}}loaded(e,n,r){const i=e.split("|"),a=i[0],o=i[1];n&&this.emit("failedLoading",a,o,n),!n&&r&&this.store.addResourceBundle(a,o,r,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&r&&(this.state[e]=0);const s={};this.queue.forEach(c=>{aTe(c.loaded,[a],o),wTe(c,e),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(l=>{s[l]||(s[l]={});const u=c.loaded[l];u.length&&u.forEach(f=>{s[l][f]===void 0&&(s[l][f]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(c=>!c.done)}read(e,n,r,i=0,a=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:i,wait:a,callback:o});return}this.readingCalls++;const s=(l,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(l&&u&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,r,i+1,a*2,o)},a);return}o(l,u)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const l=c(e,n);l&&typeof l.then=="function"?l.then(u=>s(null,u)).catch(s):s(null,l)}catch(l){s(l)}return}return c(e,n,s)}prepareLoading(e,n,r={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();Nn(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Nn(n)&&(n=[n]);const a=this.queueLoad(e,n,r,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(o=>{this.loadOne(o)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e,n=""){const r=e.split("|"),i=r[0],a=r[1];this.read(i,a,"read",void 0,void 0,(o,s)=>{o&&this.logger.warn(`${n}loading namespace ${a} for language ${i} failed`,o),!o&&s&&this.logger.log(`${n}loaded namespace ${a} for language ${i}`,s),this.loaded(e,o,s)})}saveMissing(e,n,r,i,a,o={},s=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const c={...o,isUpdate:a},l=this.backend.create.bind(this.backend);if(l.length<6)try{let u;l.length===5?u=l(e,n,r,i,c):u=l(e,n,r,i),u&&typeof u.then=="function"?u.then(f=>s(null,f)).catch(s):s(null,u)}catch(u){s(u)}else l(e,n,r,i,s,c)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}const KW=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),Nn(t[1])&&(e.defaultValue=t[1]),Nn(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(r=>{e[r]=n[r]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),YW=t=>(Nn(t.ns)&&(t.ns=[t.ns]),Nn(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Nn(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),I4=()=>{},STe=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class cw extends w6{constructor(e={},n){if(super(),this.options=YW(e),this.services={},this.logger=ad,this.modules={external:[]},STe(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(Nn(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const r=KW();this.options={...r,...this.options,...YW(e)},this.options.interpolation={...r.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const i=l=>l?typeof l=="function"?new l:l:null;if(!this.options.isClone){this.modules.logger?ad.init(i(this.modules.logger),this.options):ad.init(null,this.options);let l;this.modules.formatter?l=this.modules.formatter:l=xTe;const u=new zW(this.options);this.store=new FW(this.options.resources,this.options);const f=this.services;f.logger=ad,f.resourceStore=this.store,f.languageUtils=u,f.pluralResolver=new pTe(u,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),l&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(f.formatter=i(l),f.formatter.init&&f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new mTe(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new bTe(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(h,...m)=>{this.emit(h,...m)}),this.modules.languageDetector&&(f.languageDetector=i(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=i(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new a_(this.services,this.options),this.translator.on("*",(h,...m)=>{this.emit(h,...m)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,n||(n=I4),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&l[0]!=="dev"&&(this.options.lng=l[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(l=>{this[l]=(...u)=>this.store[l](...u)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(l=>{this[l]=(...u)=>(this.store[l](...u),this)});const s=Nx(),c=()=>{const l=(u,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(f),n(u,f)};if(this.languages&&!this.isInitialized)return l(null,this.t.bind(this));this.changeLanguage(this.options.lng,l)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),s}loadResources(e,n=I4){let r=n;const i=Nn(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const a=[],o=s=>{if(!s||s==="cimode")return;this.services.languageUtils.toResolveHierarchy(s).forEach(l=>{l!=="cimode"&&a.indexOf(l)<0&&a.push(l)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>o(c)),this.options.preload?.forEach?.(s=>o(s)),this.services.backendConnector.load(a,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(s)})}else r(null)}reloadResources(e,n,r){const i=Nx();return typeof e=="function"&&(r=e,e=void 0),typeof n=="function"&&(r=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),r||(r=I4),this.services.backendConnector.reload(e,n,a=>{i.resolve(),r(a)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Nre.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const r=Nx();this.emit("languageChanging",e);const i=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},a=(s,c)=>{c?this.isLanguageChangingTo===e&&(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve((...l)=>this.t(...l)),n&&n(s,(...l)=>this.t(...l))},o=s=>{!e&&!s&&this.services.languageDetector&&(s=[]);const c=Nn(s)?s:s&&s[0],l=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(Nn(s)?[s]:s);l&&(this.language||i(l),this.translator.language||this.translator.changeLanguage(l),this.services.languageDetector?.cacheUserLanguage?.(l)),this.loadResources(l,u=>{a(u,l)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),r}getFixedT(e,n,r){const i=(a,o,...s)=>{let c;typeof o!="object"?c=this.options.overloadTranslationOptionHandler([a,o].concat(s)):c={...o},c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||i.keyPrefix);const l=this.options.keySeparator||".";let u;return c.keyPrefix&&Array.isArray(a)?u=a.map(f=>(typeof f=="function"&&(f=i_(f,{...this.options,...o})),`${c.keyPrefix}${l}${f}`)):(typeof a=="function"&&(a=i_(a,{...this.options,...o})),u=c.keyPrefix?`${c.keyPrefix}${l}${a}`:a),this.t(u,c)};return Nn(e)?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=r,i}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,a=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(s,c)=>{const l=this.services.backendConnector.state[`${s}|${c}`];return l===-1||l===0||l===2};if(n.precheck){const s=n.precheck(this,o);if(s!==void 0)return s}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!i||o(a,e)))}loadNamespaces(e,n){const r=Nx();return this.options.ns?(Nn(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=Nx();Nn(e)&&(e=[e]);const i=this.options.preload||[],a=e.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return a.length?(this.options.preload=i.concat(a),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const i=new Intl.Locale(e);if(i&&i.getTextInfo){const a=i.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new zW(KW());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){return new cw(e,n)}cloneInstance(e={},n=I4){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},a=new cw(i);if((e.debug!==void 0||e.prefix!==void 0)&&(a.logger=a.logger.clone(e)),["store","services","language"].forEach(s=>{a[s]=this[s]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r){const s=Object.keys(this.store.data).reduce((c,l)=>(c[l]={...this.store.data[l]},c[l]=Object.keys(c[l]).reduce((u,f)=>(u[f]={...c[l][f]},u),c[l]),c),{});a.store=new FW(s,i),a.services.resourceStore=a.store}return a.translator=new a_(a.services,i),a.translator.on("*",(s,...c)=>{a.emit(s,...c)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const go=cw.createInstance();go.createInstance=cw.createInstance;go.createInstance;go.dir;go.init;go.loadResources;go.reloadResources;go.use;go.changeLanguage;go.getFixedT;go.t;go.exists;go.setDefaultNamespace;go.hasLoadedNamespace;go.loadNamespaces;go.loadLanguages;var MO,XW;function CTe(){return XW||(XW=1,MO={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),MO}var _Te=CTe();const TTe=ka(_Te);var ETe=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ZW(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=t.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(e.name=n[1],(TTe[n[1]]||t.charAt(t.length-2)==="/")&&(e.voidElement=!0),e.name.startsWith("!--"))){var r=t.indexOf("-->");return{type:"comment",comment:r!==-1?t.slice(4,r):""}}for(var i=new RegExp(ETe),a=null;(a=i.exec(t))!==null;)if(a[0].trim())if(a[1]){var o=a[1].trim(),s=[o,""];o.indexOf("=")>-1&&(s=o.split("=")),e.attrs[s[0]]=s[1],i.lastIndex--}else a[2]&&(e.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return e}var OTe=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,DTe=/^\s*$/,MTe=Object.create(null);function kre(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?(function(n){var r=[];for(var i in n)r.push(i+'="'+n[i]+'"');return r.length?" "+r.join(" "):""})(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(kre,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var RTe={parse:function(t,e){e||(e={}),e.components||(e.components=MTe);var n,r=[],i=[],a=-1,o=!1;if(t.indexOf("<")!==0){var s=t.indexOf("<");r.push({type:"text",content:s===-1?t:t.substring(0,s)})}return t.replace(OTe,function(c,l){if(o){if(c!=="</"+n.name+">")return;o=!1}var u,f=c.charAt(1)!=="/",d=c.startsWith("<!--"),h=l+c.length,m=t.charAt(h);if(d){var p=ZW(c);return a<0?(r.push(p),r):((u=i[a]).children.push(p),r)}if(f&&(a++,(n=ZW(c)).type==="tag"&&e.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!m||m==="<"||n.children.push({type:"text",content:t.slice(h,t.indexOf("<",h))}),a===0&&r.push(n),(u=i[a-1])&&u.children.push(n),i[a]=n),(!f||n.voidElement)&&(a>-1&&(n.voidElement||n.name===c.slice(2,-1))&&(a--,n=a===-1?r:i[a]),!o&&m!=="<"&&m)){u=a===-1?r:i[a].children;var y=t.indexOf("<",h),x=t.slice(h,y===-1?void 0:y);DTe.test(x)&&(x=" "),(y>-1&&a+u.length>=0||x!==" ")&&u.push({type:"text",content:x})}}),r},stringify:function(t){return t.reduce(function(e,n){return e+kre("",n)},"")}};const JS=(t,e,n,r)=>{const i=[n,{code:e,...r||{}}];if(t?.services?.logger?.forward)return t.services.logger.forward(i,"warn","react-i18next::",!0);mu(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),t?.services?.logger?.warn?t.services.logger.warn(...i):console?.warn&&console.warn(...i)},QW={},lw=(t,e,n,r)=>{mu(n)&&QW[n]||(mu(n)&&(QW[n]=new Date),JS(t,e,n,r))},Are=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},TI=(t,e,n)=>{t.loadNamespaces(e,Are(t,n))},JW=(t,e,n,r)=>{if(mu(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return TI(t,n,r);n.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,Are(t,r))},ITe=(t,e,n={})=>!e.languages||!e.languages.length?(lw(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:n.lng,precheck:(r,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!i(r.isLanguageChangingTo,t))return!1}}),mu=t=>typeof t=="string",Mg=t=>typeof t=="object"&&t!==null,NTe=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,PTe={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},kTe=t=>PTe[t],ATe=t=>t.replace(NTe,kTe);let EI={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:ATe};const LTe=(t={})=>{EI={...EI,...t}},Lre=()=>EI;let Vre;const VTe=t=>{Vre=t},zk=()=>Vre,RO=(t,e)=>{if(!t)return!1;const n=t.props?.children??t.children;return e?n.length>0:!!n},IO=t=>{if(!t)return[];const e=t.props?.children??t.children;return t.props?.i18nIsDynamicList?Vv(e):e},$Te=t=>Array.isArray(t)&&t.every(D.isValidElement),Vv=t=>Array.isArray(t)?t:[t],jTe=(t,e)=>{const n={...e};return n.props=Object.assign(t.props,e.props),n},$re=(t,e,n,r)=>{if(!t)return"";let i="";const a=Vv(t),o=e?.transSupportBasicHtmlNodes?e.transKeepBasicHtmlNodesFor??[]:[];return a.forEach((s,c)=>{if(mu(s)){i+=`${s}`;return}if(D.isValidElement(s)){const{props:l,type:u}=s,f=Object.keys(l).length,d=o.indexOf(u)>-1,h=l.children;if(!h&&d&&!f){i+=`<${u}/>`;return}if(!h&&(!d||f)||l.i18nIsDynamicList){i+=`<${c}></${c}>`;return}if(d&&f===1&&mu(h)){i+=`<${u}>${h}</${u}>`;return}const m=$re(h,e,n,r);i+=`<${c}>${m}</${c}>`;return}if(s===null){JS(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(Mg(s)){const{format:l,...u}=s,f=Object.keys(u);if(f.length===1){const d=l?`${f[0]}, ${l}`:f[0];i+=`{{${d}}}`;return}JS(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:s});return}JS(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:s})}),i},UTe=(t,e,n,r,i,a,o)=>{if(n==="")return[];const s=i.transKeepBasicHtmlNodesFor||[],c=n&&new RegExp(s.map(x=>`<${x}`).join("|")).test(n);if(!t&&!e&&!c&&!o)return[n];const l=e??{},u=x=>{Vv(x).forEach(C=>{mu(C)||(RO(C)?u(IO(C)):Mg(C)&&!D.isValidElement(C)&&Object.assign(l,C))})};u(t);const f=RTe.parse(`<0>${n}</0>`),d={...l,...a},h=(x,S,C)=>{const _=IO(x),T=p(_,S.children,C);return $Te(_)&&T.length===0||x.props?.i18nIsDynamicList?_:T},m=(x,S,C,_,T)=>{x.dummy?(x.children=S,C.push(D.cloneElement(x,{key:_},T?void 0:S))):C.push(...D.Children.map([x],O=>{const M={...O.props};return delete M.i18nIsDynamicList,D.createElement(O.type,{...M,key:_,ref:O.props.ref??O.ref},T?null:S)}))},p=(x,S,C)=>{const _=Vv(x);return Vv(S).reduce((O,M,I)=>{const V=M.children?.[0]?.content&&r.services.interpolator.interpolate(M.children[0].content,d,r.language);if(M.type==="tag"){let k=_[parseInt(M.name,10)];!k&&e&&(k=e[M.name]),C.length===1&&!k&&(k=C[0][M.name]),k||(k={});const L=Object.keys(M.attrs).length!==0?jTe({props:M.attrs},k):k,$=D.isValidElement(L),W=$&&RO(M,!0)&&!M.voidElement,G=c&&Mg(L)&&L.dummy&&!$,oe=Mg(e)&&Object.hasOwnProperty.call(e,M.name);if(mu(L)){const U=r.services.interpolator.interpolate(L,d,r.language);O.push(U)}else if(RO(L)||W){const U=h(L,M,C);m(L,U,O,I)}else if(G){const U=p(_,M.children,C);m(L,U,O,I)}else if(Number.isNaN(parseFloat(M.name)))if(oe){const U=h(L,M,C);m(L,U,O,I,M.voidElement)}else if(i.transSupportBasicHtmlNodes&&s.indexOf(M.name)>-1)if(M.voidElement)O.push(D.createElement(M.name,{key:`${M.name}-${I}`}));else{const U=p(_,M.children,C);O.push(D.createElement(M.name,{key:`${M.name}-${I}`},U))}else if(M.voidElement)O.push(`<${M.name} />`);else{const U=p(_,M.children,C);O.push(`<${M.name}>${U}</${M.name}>`)}else if(Mg(L)&&!$){const U=M.children[0]?V:null;U&&O.push(U)}else m(L,V,O,I,M.children.length!==1||!V)}else if(M.type==="text"){const k=i.transWrapTextNodes,L=o?i.unescape(r.services.interpolator.interpolate(M.content,d,r.language)):r.services.interpolator.interpolate(M.content,d,r.language);k?O.push(D.createElement(k,{key:`${M.name}-${I}`},L)):O.push(L)}return O},[])},y=p([{dummy:!0,children:t||[]}],f,Vv(t||[]));return IO(y[0])},jre=(t,e,n)=>{const r=t.key||e,i=D.cloneElement(t,{key:r});if(!i.props||!i.props.children||n.indexOf(`${e}/>`)<0&&n.indexOf(`${e} />`)<0)return i;function a(){return D.createElement(D.Fragment,null,i)}return D.createElement(a,{key:r})},FTe=(t,e)=>t.map((n,r)=>jre(n,r,e)),BTe=(t,e)=>{const n={};return Object.keys(t).forEach(r=>{Object.assign(n,{[r]:jre(t[r],r,e)})}),n},zTe=(t,e,n,r)=>t?Array.isArray(t)?FTe(t,e):Mg(t)?BTe(t,e):(lw(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,GTe=t=>!Mg(t)||Array.isArray(t)?!1:Object.keys(t).reduce((e,n)=>e&&Number.isNaN(Number.parseFloat(n)),!0);function WTe({children:t,count:e,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:f,shouldUnescape:d,...h}){const m=u||zk();if(!m)return lw(m,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),t;const p=f||m.t.bind(m)||(G=>G),y={...Lre(),...m.options?.react};let x=l||p.ns||m.options?.defaultNS;x=mu(x)?[x]:x||["translation"];const S=$re(t,y,m,r),C=s||S||y.transEmptyNodeValue||(typeof r=="function"?i_(r):r),{hashTransKey:_}=y,T=r||(_?_(S||C):S||C);m.options?.interpolation?.defaultVariables&&(o=o&&Object.keys(o).length>0?{...o,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables});const O=o||e!==void 0&&!m.options?.interpolation?.alwaysFormat||!t?a.interpolation:{interpolation:{...a.interpolation,prefix:"#$?",suffix:"?$#"}},M={...a,context:i||a.context,count:e,...o,...O,defaultValue:C,ns:x},I=T?p(T,M):C,V=zTe(c,I,m,r);let k=V||t,L=null;GTe(V)&&(L=V,k=t);const $=UTe(k,L,I,m,y,M,d),W=n??y.defaultTransParent;return W?D.createElement(W,h,$):$}const HTe={type:"3rdParty",init(t){LTe(t.options.react),VTe(t)}},Gk=D.createContext();class qTe{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function KTe({children:t,count:e,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:f,shouldUnescape:d,...h}){const{i18n:m,defaultNS:p}=D.useContext(Gk)||{},y=u||m||zk(),x=f||y?.t.bind(y);return WTe({children:t,count:e,parent:n,i18nKey:r,context:i,tOptions:a,values:o,defaults:s,components:c,ns:l||x?.ns||p||y?.options?.defaultNS,i18n:y,t:f,shouldUnescape:d,...h})}const YTe=(t,e)=>{const n=D.useRef();return D.useEffect(()=>{n.current=t},[t,e]),n.current},Ure=(t,e,n,r)=>t.getFixedT(e,n,r),XTe=(t,e,n,r)=>D.useCallback(Ure(t,e,n,r),[t,e,n,r]),Hn=(t,e={})=>{const{i18n:n}=e,{i18n:r,defaultNS:i}=D.useContext(Gk)||{},a=n||r||zk();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new qTe),!a){lw(a,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const _=(O,M)=>mu(M)?M:Mg(M)&&mu(M.defaultValue)?M.defaultValue:Array.isArray(O)?O[O.length-1]:O,T=[_,{},!1];return T.t=_,T.i18n={},T.ready=!1,T}a.options.react?.wait&&lw(a,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...Lre(),...a.options.react,...e},{useSuspense:s,keyPrefix:c}=o;let l=t||i||a.options?.defaultNS;l=mu(l)?[l]:l||["translation"],a.reportNamespaces.addUsedNamespaces?.(l);const u=(a.isInitialized||a.initializedStoreOnce)&&l.every(_=>ITe(_,a,o)),f=XTe(a,e.lng||null,o.nsMode==="fallback"?l:l[0],c),d=()=>f,h=()=>Ure(a,e.lng||null,o.nsMode==="fallback"?l:l[0],c),[m,p]=D.useState(d);let y=l.join();e.lng&&(y=`${e.lng}${y}`);const x=YTe(y),S=D.useRef(!0);D.useEffect(()=>{const{bindI18n:_,bindI18nStore:T}=o;S.current=!0,!u&&!s&&(e.lng?JW(a,e.lng,l,()=>{S.current&&p(h)}):TI(a,l,()=>{S.current&&p(h)})),u&&x&&x!==y&&S.current&&p(h);const O=()=>{S.current&&p(h)};return _&&a?.on(_,O),T&&a?.store.on(T,O),()=>{S.current=!1,a&&_&&_?.split(" ").forEach(M=>a.off(M,O)),T&&a&&T.split(" ").forEach(M=>a.store.off(M,O))}},[a,y]),D.useEffect(()=>{S.current&&u&&p(d)},[a,c,u]);const C=[m,a,u];if(C.t=m,C.i18n=a,C.ready=u,u||!u&&!s)return C;throw new Promise(_=>{e.lng?JW(a,e.lng,l,()=>_()):TI(a,l,()=>_())})};function ZTe({i18n:t,defaultNS:e,children:n}){const r=D.useMemo(()=>({i18n:t,defaultNS:e}),[t,e]);return D.createElement(Gk.Provider,{value:r},n)}const{slice:QTe,forEach:JTe}=[];function e6e(t){return JTe.call(QTe.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}function t6e(t){return typeof t!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(t))}const eH=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,n6e=function(t,e){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},i=encodeURIComponent(e);let a=`${t}=${i}`;if(r.maxAge>0){const o=r.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");a+=`; Max-Age=${Math.floor(o)}`}if(r.domain){if(!eH.test(r.domain))throw new TypeError("option domain is invalid");a+=`; Domain=${r.domain}`}if(r.path){if(!eH.test(r.path))throw new TypeError("option path is invalid");a+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r.partitioned&&(a+="; Partitioned"),a},tH={create(t,e,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+n*60*1e3)),r&&(i.domain=r),document.cookie=n6e(t,e,i)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let i=n[r];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return i.substring(e.length,i.length)}return null},remove(t,e){this.create(t,"",-1,e)}};var r6e={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return tH.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:r,cookieDomain:i,cookieOptions:a}=e;n&&typeof document<"u"&&tH.create(n,t,r,i,a)}},i6e={name:"querystring",lookup(t){let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:r}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));const a=r.substring(1).split("&");for(let o=0;o<a.length;o++){const s=a[o].indexOf("=");s>0&&a[o].substring(0,s)===e&&(n=a[o].substring(s+1))}}return n}},a6e={name:"hash",lookup(t){let{lookupHash:e,lookupFromHashIndex:n}=t,r;if(typeof window<"u"){const{hash:i}=window.location;if(i&&i.length>2){const a=i.substring(1);if(e){const o=a.split("&");for(let s=0;s<o.length;s++){const c=o[s].indexOf("=");c>0&&o[s].substring(0,c)===e&&(r=o[s].substring(c+1))}}if(r)return r;if(!r&&n>-1){const o=i.match(/\/([a-zA-Z-]*)/g);return Array.isArray(o)?o[typeof n=="number"?n:0]?.replace("/",""):void 0}}}return r}};let ov=null;const nH=()=>{if(ov!==null)return ov;try{if(ov=typeof window<"u"&&window.localStorage!==null,!ov)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{ov=!1}return ov};var o6e={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&nH())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&nH()&&window.localStorage.setItem(n,t)}};let sv=null;const rH=()=>{if(sv!==null)return sv;try{if(sv=typeof window<"u"&&window.sessionStorage!==null,!sv)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{sv=!1}return sv};var s6e={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&rH())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&rH()&&window.sessionStorage.setItem(n,t)}},c6e={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:i}=navigator;if(n)for(let a=0;a<n.length;a++)e.push(n[a]);r&&e.push(r),i&&e.push(i)}return e.length>0?e:void 0}},l6e={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const r=e||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},u6e={name:"path",lookup(t){let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?n[typeof e=="number"?e:0]?.replace("/",""):void 0}},f6e={name:"subdomain",lookup(t){let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,r=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};let Fre=!1;try{document.cookie,Fre=!0}catch{}const Bre=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Fre||Bre.splice(1,1);const d6e=()=>({order:Bre,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class zre{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=e6e(n,this.options||{},d6e()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=i=>i.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(r6e),this.addDetector(i6e),this.addDetector(o6e),this.addDetector(s6e),this.addDetector(c6e),this.addDetector(l6e),this.addDetector(u6e),this.addDetector(f6e),this.addDetector(a6e)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(r=>{if(this.detectors[r]){let i=this.detectors[r].lookup(this.options);i&&typeof i=="string"&&(i=[i]),i&&(n=n.concat(i))}}),n=n.filter(r=>r!=null&&!t6e(r)).map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(e,this.options)}))}}zre.type="languageDetector";const h6e={default_title:"No data found",default_description:"No results found with the specified parameters. Try changing your search criteria.",reset_button:"Reset"},g6e={title:"Something went wrong",description:"Failed to load data. Please try again.",retry:"Retry"},p6e={title:"Page not found",description:"The requested page does not exist or has been moved. You may not have access to this section.",back_button:"Go back",home_button:"Go to home"},m6e={DX:"Digital Radiography (DX)",MG:"Mammography (MG)",unknown:"Unknown modality"},v6e={empty_state:h6e,error_state:g6e,not_found_page:p6e,modalities:m6e},y6e={default_title:"Данные не найдены",default_description:"По указанным параметрам не найдено ни одного результата. Попробуйте изменить параметры поиска.",reset_button:"Сбросить"},x6e={title:"Произошла ошибка",description:"Не удалось загрузить данные. Пожалуйста, попробуйте еще раз.",retry:"Повторить попытку"},w6e={title:"Страница не найдена",description:"Запрашиваемая страница не существует или была перемещена. Возможно у вас нет доступа к этому разделу.",back_button:"Вернуться назад",home_button:"На главную"},b6e={DX:"Рентгенография (DX)",MG:"Маммография (MG)",unknown:"Неизвестная модальность"},S6e={empty_state:y6e,error_state:x6e,not_found_page:w6e,modalities:b6e},C6e={default_title:"Không tìm thấy dữ liệu",default_description:"Không tìm thấy kết quả nào với các tham số được chỉ định. Hãy thử thay đổi tiêu chí tìm kiếm của bạn.",reset_button:"Đặt lại"},_6e={title:"Đã xảy ra lỗi",description:"Không thể tải dữ liệu. Vui lòng thử lại.",retry:"Thử lại"},T6e={title:"Trang không tìm thấy",description:"Trang được yêu cầu không tồn tại hoặc đã được di chuyển. Bạn có thể không có quyền truy cập vào phần này.",back_button:"Quay lại",home_button:"Về trang chủ"},E6e={DX:"X-quang kỹ thuật số (DX)",MG:"Chụp nhũ ảnh (MG)",unknown:"Phương thức không xác định"},O6e={empty_state:C6e,error_state:_6e,not_found_page:T6e,modalities:E6e},D6e="SAMSON IDS",M6e="Dashboard",R6e="Devices list",I6e="Studies list",N6e="Study",P6e="Analytics",k6e="Work list",A6e="Event Log",L6e="Logout",V6e="Expand sidebar",$6e="Collapse sidebar",j6e="Light theme",U6e="Dark theme",F6e="System theme",B6e={title:D6e,dashboard:M6e,devices:R6e,studies:I6e,study:N6e,analytics:P6e,worklist:k6e,logs:A6e,logout:L6e,toggle_expand:V6e,toggle_collapse:$6e,light_theme:j6e,dark_theme:U6e,system_theme:F6e},z6e="САМСОН ИДС",G6e="Главная",W6e="Список устройств",H6e="Список исследований",q6e="Исследование",K6e="Аналитика",Y6e="Очередь исследований",X6e="Журнал событий",Z6e="Выйти",Q6e="Раскрыть сайдбар",J6e="Свернуть сайдбар",e8e="Светлая тема",t8e="Темная тема",n8e="Системная тема",r8e={title:z6e,dashboard:G6e,devices:W6e,studies:H6e,study:q6e,analytics:K6e,worklist:Y6e,logs:X6e,logout:Z6e,toggle_expand:Q6e,toggle_collapse:J6e,light_theme:e8e,dark_theme:t8e,system_theme:n8e},i8e="SAMSON IDS",a8e="Phân tích",o8e="Thiết bị",s8e="Nghiên cứu",c8e="Hàng đợi nghiên cứu",l8e="Nhật Ký Sự Kiện",u8e="Đăng xuất",f8e="Mở rộng thanh bên",d8e="Thu gọn thanh bên",h8e="Chủ đề sáng",g8e="Chủ đề tối",p8e="Chủ đề hệ thống",m8e={title:i8e,analytics:a8e,devices:o8e,studies:s8e,worklist:c8e,logs:l8e,logout:u8e,toggle_expand:f8e,toggle_collapse:d8e,light_theme:h8e,dark_theme:g8e,system_theme:p8e},v8e="Analytics",y8e="Research and system usage statistics",x8e={placeholder:"Period","1w":"Last week","1m":"Last month","3m":"Last 3 months","6m":"Last 6 months","1y":"Last year"},w8e={studies:{title:"Studies conducted",description:"for the selected period"},pacs:{title:"Images transferred to PACS",description:"for the selected period"},storage:{title:"Storage volume",description:"current volume, TB",of:"of"}},b8e={studies:{title:"Studies by month",description:"Dynamics of the number of studies per year",label:"Studies:ㅤ"},pacs:{title:"Transferred to PACS",description:"number of transferred studies",label:"Transferred:ㅤ"},storage:{title:"Storage volume growth",description:"Daily change in data volume (GB)",label:"Growth (GB):ㅤ",periodGrowth:"Period growth"}},S8e={tb:"TB"},C8e={description:"An error occurred when loading the analytics page. Check your network connection and try again."},_8e={title:v8e,description:y8e,period:x8e,kpi:w8e,charts:b8e,units:S8e,errors:C8e},T8e="Аналитика",E8e="Статистика исследований и использования системы",O8e={placeholder:"Период","1w":"За неделю","1m":"За месяц","3m":"За 3 месяца","6m":"За полгода","1y":"За год"},D8e={studies:{title:"Проведено исследований",description:"за выбранный период"},pacs:{title:"Передано снимков в ЦАМИ",description:"за выбранный период"},storage:{title:"Объем хранилища",description:"текущий объем, ТБ",of:"из"}},M8e={studies:{title:"Исследования по месяцам",description:"Динамика количества исследований за год",label:"Исследований:ㅤ"},pacs:{title:"Передано в ЦАМИ",description:"количество переданных исследований",label:"Передано:ㅤ"},storage:{title:"Рост объема хранилища",description:"Ежедневное изменение объема данных (ГБ)",label:"Прирост (ГБ):ㅤ",periodGrowth:"За период"}},R8e={tb:"ТБ"},I8e={description:"Произошла ошибка при загрузке страницы аналитики. Проверьте подключение к сети и попробуйте снова."},N8e={title:T8e,description:E8e,period:O8e,kpi:D8e,charts:M8e,units:R8e,errors:I8e},P8e="Phân tích",k8e="Thống kê nghiên cứu và sử dụng hệ thống",A8e={placeholder:"Kỳ","1w":"Tuần trước","1m":"Tháng trước","3m":"3 tháng trước","6m":"Nửa năm trước","1y":"Năm trước"},L8e={studies:{title:"Nghiên cứu đã thực hiện",description:"trong kỳ đã chọn"},pacs:{title:"Hình ảnh chuyển đến PACS",description:"trong kỳ đã chọn"},storage:{title:"Dung lượng lưu trữ",description:"dung lượng hiện tại, TB",of:"trên"}},V8e={studies:{title:"Nghiên cứu theo tháng",description:"Động lực số lượng nghiên cứu mỗi năm",label:"Nghiên cứu:ㅤ"},pacs:{title:"Đã chuyển đến PACS",description:"số lượng nghiên cứu đã chuyển",label:"Đã chuyển:ㅤ"},storage:{title:"Tăng trưởng dung lượng lưu trữ",description:"Thay đổi hàng ngày về khối lượng dữ liệu (GB)",label:"Mức tăng (GB):ㅤ",periodGrowth:"Tăng trưởng kỳ"}},$8e={tb:"TB"},j8e={description:"Đã xảy ra lỗi khi tải trang analytics. Kiểm tra kết nối mạng của bạn và thử lại."},U8e={title:P8e,description:k8e,period:A8e,kpi:L8e,charts:V8e,units:$8e,errors:j8e},F8e="Devices list",B8e="Information about connected medical devices",z8e="Total devices: ",G8e="Create device",W8e="You don't have access to this section!",H8e={cami:"Central storage",medical:"Medical devices",external:"External viewers"},q8e={ae_title:"AE Title:",last_study:{cami:"Last send date",default:"Last study"},view_studies:"View studies",edit:"Edit",note:"Note",delete:"Delete"},K8e={delete:{title:"Delete device?",description:"Are you sure you want to delete <1>{{name}}</1> ({{aetitle}})? This action cannot be undone.",cancel:"Cancel",confirm:"Delete",loading:"Deleting..."}},Y8e={create_success:"Device {{name}} successfully created!",create_error:"An error occurred while creating the device",update_success:"Device updated successfully",update_error:"An error occurred while updating the device",delete_success:"Device {{aetitle}} successfully deleted",delete_error:"Failed to delete device. Please try again later."},X8e={description:"An error occurred when loading the devices page. Check your network connection and try again."},Z8e={create_title:"Device settings",edit_title:"Edit: {{name}}",sections:{main:"Main settings and Network",encoding:"Encoding and text",worklist:"Worklist settings",logic:"Processing logic",mapping:"Data mapping"},fields:{name:"Device name",aetitle:"AET (Application Entity Title)",host:"Host / IP address",port:"Port",pacsaetitle:"PACS Proxy AET",autoroute:"Auto routing",encoding:"Device encoding",translitLang:"Transliteration language",wlEncoding:"Worklist encoding",modalityTag:"Modality Tag",roundSRValues:"Rounding (SR)",property_separator:"Property separator"},placeholders:{name:"Example: CT_Philips_Room_1",aetitle:"CT_SCANNER",host:"192.168.1.50",port:"104",pacsaetitle:"ARCHIVE_AET",encoding:"Windows-1251",translitLang:"ru",wlEncoding:"ISO_IR 100",modalityTag:"CT",roundSRValues:"1",property_separator:"\\n",autoroute:"Select recipients...",search:"Search by name...",mapping_key:"Example: Findings Finding",mapping_value:"Example: mis_field_name"},descriptions:{pacsaetitle:"For AET substitution when sending to archive",autoroute:"Where to forward received images",wlEncoding:"Target character encoding",modalityTag:"Forced type setting",roundSRValues:"Number of decimal places",property_separator:"Character for separating values"},switch:{isSource:"Is a source of studies",translit:"Enable transliteration",translit_desc:"Convert Cyrillic to Latin",uppercase:"Uppercase",uppercase_desc:"Convert data in Worklist responses",generateStudyUID:"Generate Study UID",generateStudyUID_desc:"Create UID on server side",ignoreActionName:"Exclude description",ignoreActionName_desc:"Do not send study description in WL",wlFullName:"Full patient name",wlFullName_desc:"Include full name in responses",wlShortName2:"Short name",wlShortName2_desc:"Single line format without separators",mergeByAccessionNumber:"Merge by AccessionNumber",mergeByAccessionNumber_desc:"Group images into one study",snilsAsId:"SNILS as ID",snilsAsId_desc:"Expect SNILS in PatientID field",fillEmptyStudyDate:"Fill empty date",fillEmptyStudyDate_desc:"Use current date if not in DICOM",accessionWorkaround:"PatientID parsing",accessionWorkaround_desc:"Extract AccessionNumber from ID",electronSR:"Electron SR format",electronSR_desc:"Specific report parsing"},buttons:{cancel:"Cancel",save:"Save",update:"Update",add_rule:"Add rule"},autoroute:{selected:"Selected: {{count}}",empty:"No devices found."},mapping:{srTags:"Structured Reports mapping (SR Tags)",srTags_desc:"Mapping: DICOM path -> HIS field",saveTags:"Direct tags saving (Save Tags)",saveTags_desc:"Mapping: Tag -> HIS field"},validation:{key_required:"Key is required",value_required:"Value is required",name_required:"Name is required",host_required:"Host is required",aet_required:"AET is required"}},Q8e={title:"Device Note",description:"Additional information for {{name}} ({{aetitle}})",fields:{commissioning_date:"Commissioning Date",warranty_date:"Warranty Expiration",last_maintenance_date:"Last Maintenance",notes:"Notes"},placeholders:{select_date:"Pick a date",notes_input:"Enter additional information..."}},J8e={title:F8e,description:B8e,total_devices:z8e,create_button:G8e,no_access:W8e,sections:H8e,card:q8e,alert:K8e,notifications:Y8e,errors:X8e,settings_modal:Z8e,note_modal:Q8e},eEe="Список аппаратов",tEe="Информация о подключенных медицинских аппаратах",nEe="Всего аппаратов:",rEe="Создать аппарат",iEe="У вас нет доступа к этому разделу!",aEe={cami:"Центральное хранилище",medical:"Медицинские аппараты",external:"Сторонние просмотровщики"},oEe={ae_title:"AE Title:",last_study:{cami:"Дата последней отправки",default:"Последнее исследование"},view_studies:"Просмотр исследований",edit:"Редактировать",note:"Примечание",delete:"Удалить"},sEe={delete:{title:"Удалить устройство?",description:"Вы действительно хотите удалить <1>{{name}}</1> ({{aetitle}})? Это действие нельзя отменить.",cancel:"Отмена",confirm:"Удалить",loading:"Удаление..."}},cEe={create_success:"Оборудование {{name}} успешно создано!",create_error:"Произошла ошибка при создании оборудования",update_success:"Оборудование успешно обновлено",update_error:"Произошла ошибка при обновлении оборудования",delete_success:"Оборудование {{aetitle}} успешно удалено",delete_error:"Не удалось удалить оборудование. Попробуйте позже."},lEe={description:"Произошла ошибка при загрузке страницы списка аппаратов. Проверьте подключение к сети и попробуйте снова."},uEe={create_title:"Настройки оборудования",edit_title:"Редактирование: {{name}}",sections:{main:"Основные настройки и Сеть",encoding:"Кодировка и текст",worklist:"Настройки Worklist",logic:"Логика обработки",mapping:"Маппинг данных"},fields:{name:"Название оборудования",aetitle:"AET (Application Entity Title)",host:"Хост / IP-адрес",port:"Порт",pacsaetitle:"PACS Proxy AET",autoroute:"Автоматическая пересылка",encoding:"Кодировка оборудования",translitLang:"Язык транслитерации",wlEncoding:"Кодировка для Worklist",modalityTag:"Modality Tag",roundSRValues:"Округление (SR)",property_separator:"Разделитель свойств"},placeholders:{name:"Например: CT_Philips_Room_1",aetitle:"CT_SCANNER",host:"192.168.1.50",port:"104",pacsaetitle:"ARCHIVE_AET",encoding:"Windows-1251",translitLang:"ru",wlEncoding:"ISO_IR 100",modalityTag:"CT",roundSRValues:"1",property_separator:"\\n",autoroute:"Выберите получателей...",search:"Поиск по названию...",mapping_key:"Например: Findings Finding",mapping_value:"Например: mis_field_name"},descriptions:{pacsaetitle:"Для подмены AET при отправке в архив",autoroute:"Куда пересылать полученные снимки",wlEncoding:"Целевая кодировка символов",modalityTag:"Принудительная установка типа",roundSRValues:"Кол-во знаков после запятой",property_separator:"Символ для разделения значений"},switch:{isSource:"Является источником исследований",translit:"Включить транслитерацию",translit_desc:"Конвертация кириллицы в латиницу",uppercase:"Верхний регистр (UPPERCASE)",uppercase_desc:"Преобразовать данные в ответах Worklist",generateStudyUID:"Генерировать Study UID",generateStudyUID_desc:"Создавать UID на стороне сервера",ignoreActionName:"Исключить описание",ignoreActionName_desc:"Не отправлять описание исследования в WL",wlFullName:"Полное имя пациента",wlFullName_desc:"Включать полное имя в ответы",wlShortName2:"Сокращенное имя",wlShortName2_desc:"Формат одной строки без разделителей",mergeByAccessionNumber:"Объединять по AccessionNumber",mergeByAccessionNumber_desc:"Группировка снимков в одно исследование",snilsAsId:"СНИЛС как ID",snilsAsId_desc:"Ожидать СНИЛС в поле PatientID",fillEmptyStudyDate:"Заполнять пустую дату",fillEmptyStudyDate_desc:"Использовать текущую, если нет в DICOM",accessionWorkaround:"Парсинг PatientID",accessionWorkaround_desc:"Извлекать AccessionNumber из ID",electronSR:"Формат Electron SR",electronSR_desc:"Специфичный парсинг отчетов"},buttons:{cancel:"Отмена",save:"Сохранить",update:"Обновить",add_rule:"Добавить правило"},autoroute:{selected:"Выбрано: {{count}}",empty:"Устройства не найдены."},mapping:{srTags:"Маппинг Структурированных Отчетов (SR Tags)",srTags_desc:"Сопоставление: DICOM путь -> Поле МИС",saveTags:"Прямое сохранение тегов (Save Tags)",saveTags_desc:"Сопоставление: Тег -> Поле МИС"},validation:{key_required:"Ключ обязателен",value_required:"Значение обязательно",name_required:"Название обязательно",host_required:"Хост обязателен",aet_required:"AET обязателен"}},fEe={title:"Примечание к оборудованию",description:"Дополнительная информация для {{name}} ({{aetitle}})",fields:{commissioning_date:"Дата ввода в эксплуатацию",warranty_date:"Окончание гарантии",last_maintenance_date:"Последнее обслуживание",notes:"Заметки"},placeholders:{select_date:"Выберите дату",notes_input:"Введите дополнительную информацию..."}},dEe={title:eEe,description:tEe,total_devices:nEe,create_button:rEe,no_access:iEe,sections:aEe,card:oEe,alert:sEe,notifications:cEe,errors:lEe,settings_modal:uEe,note_modal:fEe},hEe="Danh sách thiết bị",gEe="Thông tin về các thiết bị y tế được kết nối",pEe="Tổng số thiết bị: ",mEe="Tạo thiết bị",vEe="Bạn không có quyền truy cập vào phần này!",yEe={cami:"Lưu trữ trung tâm",medical:"Thiết bị y tế",external:"Trình xem bên ngoài"},xEe={ae_title:"AE Title:",last_study:{cami:"Ngày gửi cuối cùng",default:"Nghiên cứu cuối cùng"},view_studies:"Xem nghiên cứu",edit:"Chỉnh sửa",note:"Lưu ý",delete:"Xóa"},wEe={delete:{title:"Xóa thiết bị?",description:"Bạn có chắc chắn muốn xóa <1>{{name}}</1> ({{aetitle}})? Hành động này không thể hoàn tác.",cancel:"Hủy",confirm:"Xóa",loading:"Đang xóa..."}},bEe={create_success:"Thiết bị {{name}} đã được tạo thành công!",create_error:"Đã xảy ra lỗi khi tạo thiết bị",update_success:"Thiết bị đã được cập nhật thành công",update_error:"Đã xảy ra lỗi khi cập nhật thiết bị",delete_success:"Thiết bị {{aetitle}} đã được xóa thành công",delete_error:"Không thể xóa thiết bị. Vui lòng thử lại sau."},SEe={description:"Đã xảy ra lỗi khi tải trang danh sách thiết bị. Kiểm tra kết nối mạng của bạn và thử lại."},CEe={create_title:"Cài đặt thiết bị",edit_title:"Chỉnh sửa: {{name}}",sections:{main:"Cài đặt chính và Mạng",encoding:"Mã hóa và văn bản",worklist:"Cài đặt Worklist",logic:"Logic xử lý",mapping:"Ánh xạ dữ liệu"},fields:{name:"Tên thiết bị",aetitle:"AET (Application Entity Title)",host:"Máy chủ / Địa chỉ IP",port:"Cổng",pacsaetitle:"PACS Proxy AET",autoroute:"Định tuyến tự động",encoding:"Mã hóa thiết bị",translitLang:"Ngôn ngữ chuyển tự",wlEncoding:"Mã hóa Worklist",modalityTag:"Modality Tag",roundSRValues:"Làm tròn (SR)",property_separator:"Dấu phân cách thuộc tính"},placeholders:{name:"Ví dụ: CT_Philips_Room_1",aetitle:"CT_SCANNER",host:"192.168.1.50",port:"104",pacsaetitle:"ARCHIVE_AET",encoding:"Windows-1251",translitLang:"ru",wlEncoding:"ISO_IR 100",modalityTag:"CT",roundSRValues:"1",property_separator:"\\n",autoroute:"Chọn người nhận...",search:"Tìm kiếm theo tên...",mapping_key:"Ví dụ: Findings Finding",mapping_value:"Ví dụ: mis_field_name"},descriptions:{pacsaetitle:"Để thay thế AET khi gửi đến kho lưu trữ",autoroute:"Nơi chuyển tiếp hình ảnh nhận được",wlEncoding:"Mã hóa ký tự đích",modalityTag:"Thiết lập loại bắt buộc",roundSRValues:"Số chữ số sau dấu thập phân",property_separator:"Ký tự phân tách giá trị"},switch:{isSource:"Là nguồn nghiên cứu",translit:"Bật chuyển tự",translit_desc:"Chuyển đổi Cyrillic sang Latin",uppercase:"Chữ hoa (UPPERCASE)",uppercase_desc:"Chuyển đổi dữ liệu trong phản hồi Worklist",generateStudyUID:"Tạo Study UID",generateStudyUID_desc:"Tạo UID ở phía máy chủ",ignoreActionName:"Loại trừ mô tả",ignoreActionName_desc:"Không gửi mô tả nghiên cứu trong WL",wlFullName:"Tên bệnh nhân đầy đủ",wlFullName_desc:"Bao gồm tên đầy đủ trong phản hồi",wlShortName2:"Tên rút gọn",wlShortName2_desc:"Định dạng một dòng không có dấu phân cách",mergeByAccessionNumber:"Gộp theo AccessionNumber",mergeByAccessionNumber_desc:"Nhóm hình ảnh thành một nghiên cứu",snilsAsId:"SNILS làm ID",snilsAsId_desc:"Kỳ vọng SNILS trong trường PatientID",fillEmptyStudyDate:"Điền ngày trống",fillEmptyStudyDate_desc:"Sử dụng ngày hiện tại nếu không có trong DICOM",accessionWorkaround:"Phân tích PatientID",accessionWorkaround_desc:"Trích xuất AccessionNumber từ ID",electronSR:"Định dạng Electron SR",electronSR_desc:"Phân tích báo cáo cụ thể"},buttons:{cancel:"Hủy",save:"Lưu",update:"Cập nhật",add_rule:"Thêm quy tắc"},autoroute:{selected:"Đã chọn: {{count}}",empty:"Không tìm thấy thiết bị."},mapping:{srTags:"Ánh xạ Báo cáo Cấu trúc (SR Tags)",srTags_desc:"Ánh xạ: Đường dẫn DICOM -> Trường HIS",saveTags:"Lưu trực tiếp thẻ (Save Tags)",saveTags_desc:"Ánh xạ: Thẻ -> Trường HIS"},validation:{key_required:"Khóa là bắt buộc",value_required:"Giá trị là bắt buộc",name_required:"Tên là bắt buộc",host_required:"Máy chủ là bắt buộc",aet_required:"AET là bắt buộc"}},_Ee={title:"Ghi chú thiết bị",description:"Thông tin bổ sung cho {{name}} ({{aetitle}})",fields:{commissioning_date:"Ngày đưa vào vận hành",warranty_date:"Hết hạn bảo hành",last_maintenance_date:"Bảo trì lần cuối",notes:"Ghi chú"},placeholders:{select_date:"Chọn ngày",notes_input:"Nhập thông tin bổ sung..."}},TEe={title:hEe,description:gEe,total_devices:pEe,create_button:mEe,no_access:vEe,sections:yEe,card:xEe,alert:wEe,notifications:bEe,errors:SEe,settings_modal:CEe,note_modal:_Ee},EEe="Studies list",OEe="Information about studies",DEe="Search by patient name...",MEe="Devices",REe="Export to Excel",IEe="Select devices",NEe={title:"No studies found",description:"No studies found with the specified parameters. Try changing your search criteria."},PEe={select_all:"Select all",select_row:"Select row",name:"Name",patient:"Patient",date_time:"Date and time",no_data:"No data"},kEe={description:"An error occurred when loading the studies page. Check your network connection and try again."},AEe={title:EEe,description:OEe,search_placeholder:DEe,equipment:MEe,export_excel:REe,select_equipment:IEe,empty_state:NEe,table:PEe,errors:kEe},LEe="Список исследований",VEe="Информация о исследованиях",$Ee="Поиск по ФИО пациента...",jEe="Оборудование",UEe="Экспорт в Excel",FEe="Выберите оборудование",BEe={title:"Исследования не найдены",description:"По указанным параметрам не найдено ни одного исследования. Попробуйте изменить параметры поиска."},zEe={select_all:"Выбрать все",select_row:"Выбрать строку",name:"Наименование",patient:"Пациент",date_time:"Дата и время",no_data:"Нет данных"},GEe={description:"Произошла ошибка при загрузке страницы списка исследований. Проверьте подключение к сети и попробуйте снова."},WEe={title:LEe,description:VEe,search_placeholder:$Ee,equipment:jEe,export_excel:UEe,select_equipment:FEe,empty_state:BEe,table:zEe,errors:GEe},HEe="Danh sách nghiên cứu",qEe="Thông tin về nghiên cứu",KEe="Tìm kiếm theo tên bệnh nhân...",YEe="Thiết bị",XEe="Xuất ra Excel",ZEe="Chọn thiết bị",QEe={title:"Không tìm thấy nghiên cứu",description:"Không tìm thấy nghiên cứu nào với các tham số được chỉ định. Hãy thử thay đổi tiêu chí tìm kiếm của bạn."},JEe={select_all:"Chọn tất cả",select_row:"Chọn hàng",name:"Tên",patient:"Bệnh nhân",date_time:"Ngày và giờ",no_data:"Không có dữ liệu"},e9e={description:"Đã xảy ra lỗi khi tải trang danh sách nghiên cứu. Kiểm tra kết nối mạng của bạn và thử lại."},t9e={title:HEe,description:qEe,search_placeholder:KEe,equipment:YEe,export_excel:XEe,select_equipment:ZEe,empty_state:QEe,table:JEe,errors:e9e},n9e="SAMSON: Viewer",r9e="Study",i9e={single:"Single view",twoVertical:"Two vertical",twoHorizontal:"Two horizontal",fourGrid:"Four views"},a9e={title:"Series:",empty:"No series",studies:{title:"Studies",loading:"Loading...",empty:"No other studies",currentBadge:"Current"},viewMode:{list:"List",grid:"Grid"},toggle:{hide:"Hide the panel",show:"Show the panel"}},o9e={loadingSeries:"Loading series...",loadingImage:"Loading image...",seriesLabel:"Series",dragDropPlaceholder:"[ Drag images here ]"},s9e={series:"Loading...",image:"Loading image...",preview:"Loading preview...",slices:"Loading slices: "},c9e={window_level:"Brightness/Contrast",pan:"Pan",length:"Ruler",probe:"Probe",rectangleROI:"Rectangle ROI",ellipticalROI:"Elliptical ROI",magnify:"Magnify",angle:"Angle measurement",cobbAngle:"Cobb's Angle",zoom_in:"Zoom In",zoom_out:"Zoom Out",rotate:"Rotate 90°",invert:"Invert Colors",reset:"Reset View",clearAnnotations:"Clear annotations",fullscreen:"Fullscreen",download:"Download",conclusion:"Conclusion"},l9e={title:"Conclusion",empty:"No conclusion available",patient:"Patient",sex:"Sex",age:"Age",doctor:"Doctor",male:"Male",female:"Female",date:"Completion Date",status:{0:"Started",1:"Waiting",2:"Finished",3:"Cancelled",4:"No Result",5:"Scheduled",6:"Refused",label:"Status"},description:{label:"Description",placeholder:"Enter description..."},conclusion:{label:"Conclusion",placeholder:"Enter conclusion..."},notifications:{save_success:"Description saved successfully",save_error:"Error saving description",locked:"Event is locked by user: {{name}}"},submit:"Save",cancel:"Close",notLinked:"Study is not linked to MIS"},u9e={patient_id:"ID:",study_description:"Description:",window_width:"WW",window_center:"WC",zoom:"Zoom"},f9e={title:"Study not found",message:"Unfortunately, the requested study does not exist or has been deleted",back_button:"Go back"},d9e={title:"Download Options",description:"Select format and files to download",imagesCount:"{{count}} images in series",downloadZip:"Download all (ZIP)",preparing:"Preparing archive...",studyId:"Study ID:"},h9e={title:n9e,fallbackDescription:r9e,layout:i9e,sidebar:a9e,viewport:o9e,loading:s9e,tools:c9e,conclusion:l9e,overlay:u9e,not_found:f9e,downloadModal:d9e},g9e="САМСОН: Просмотр снимков",p9e="Исследование",m9e={single:"Один снимок",twoVertical:"Два по вертикали",twoHorizontal:"Два по горизонтали",fourGrid:"Четыре снимка"},v9e={title:"Серии:",empty:"Нет серий",studies:{title:"Исследования",loading:"Загрузка...",empty:"Нет других исследований",currentBadge:"Текущее"},viewMode:{list:"Список",grid:"Сетка"},toggle:{hide:"Скрыть панель",show:"Показать панель"}},y9e={loadingSeries:"Загрузка серии...",loadingImage:"Загрузка изображения...",seriesLabel:"Серия ",dragDropPlaceholder:"[ Перетащите снимки сюда ]"},x9e={series:"Загрузка...",image:"Загрузка снимка…",preview:"Загрузка превью...",slices:"Загрузка срезов: "},w9e={window_level:"Яркость/Контраст",pan:"Перемещение (Pan)",length:"Линейка",probe:"Зонд (Probe)",rectangleROI:"Область (ROI)",ellipticalROI:"Эллипс (ROI)",magnify:"Лупа",angle:"Измерение угла",cobbAngle:"Угол Кобба",zoom_in:"Увеличить",zoom_out:"Уменьшить",rotate:"Повернуть на 90°",invert:"Инвертировать цвета",reset:"Сбросить вид",clearAnnotations:"Очистить аннотации",fullscreen:"Полноэкранный режим",download:"Скачать",conclusion:"Заключение"},b9e={title:"Заключение",empty:"Заключение отсутствует",patient:"Пациент",sex:"Пол",age:"Возраст",doctor:"Врач",male:"Мужской",female:"Женский",date:"Дата выполнения",status:{0:"Начато",1:"Ожидание",2:"Закончено",3:"Отменено",4:"Без результата",5:"Назначено",6:"Отказ",label:"Статус"},description:{label:"Описание",placeholder:"Введите описание..."},conclusion:{label:"Заключение",placeholder:"Введите заключение..."},notifications:{save_success:"Описание успешно сохранено",save_error:"Ошибка при сохранении описания",locked:"Событие заблокировано пользователем: {{name}}"},submit:"Сохранить",cancel:"Закрыть",notLinked:"Исследование не связано с МИС"},S9e={patient_id:"ID:",study_description:"Описание:",window_width:"WW",window_center:"WC",zoom:"Zoom"},C9e={title:"Исследование не найдено",message:"К сожалению, запрашиваемое исследование не существует или было удалено",back_button:"Вернуться назад"},_9e={title:"Параметры загрузки",description:"Выберите формат и файлы для скачивания",imagesCount:"{{count}} изображений в серии",downloadZip:"Скачать всё (ZIP)",preparing:"Подготовка архива...",studyId:"ID исследования:"},T9e={title:g9e,fallbackDescription:p9e,layout:m9e,sidebar:v9e,viewport:y9e,loading:x9e,tools:w9e,conclusion:b9e,overlay:S9e,not_found:C9e,downloadModal:_9e},E9e="SAMSON: Xem ảnh chụp nhanh",O9e="Nghiên cứu",D9e={single:"Một chế độ xem",twoVertical:"Hai theo chiều dọc",twoHorizontal:"Hai theo chiều ngang",fourGrid:"Bốn chế độ xem"},M9e={title:"Chuỗi:",empty:"Không có chuỗi",studies:{title:"Các nghiên cứu",loading:"Đang tải...",empty:"Không có nghiên cứu nào khác",currentBadge:"Hiện tại"},viewMode:{list:"Danh sách",grid:"Lưới điện"},toggle:{hide:"Ẩn bảng điều khiển",show:"Hiển thị bảng điều khiển"}},R9e={loadingSeries:"Đang tải chuỗi...",loadingImage:"Đang tải hình ảnh...",seriesLabel:"Chuỗi {{number}}",dragDropPlaceholder:"[ Kéo hình ảnh vào đây ]"},I9e={series:"Đang tải...",image:"Đang tải hình ảnh...",preview:"Đang tải xem trước...",slices:"Đang tải lát cắt: "},N9e={window_level:"Độ sáng/Độ tương phản",pan:"Di chuyển (Pan)",length:"Thước kẻ",probe:"Đầu dò",rectangleROI:"Vùng quan tâm chữ nhật",ellipticalROI:"Vùng quan tâm elip",magnify:"Kính lúp",angle:"Đo góc",cobbAngle:"Góc của Cobb",zoom_in:"Phóng to",zoom_out:"Thu nhỏ",rotate:"Xoay 90°",invert:"Đảo ngược màu",reset:"Đặt lại chế độ xem",clearAnnotations:"Chú thích rõ ràng",fullscreen:"Toàn màn hình",download:"Tải xuống",conclusion:"Kết luận"},P9e={title:"Kết luận",empty:"Không có kết luận",patient:"Bệnh nhân",sex:"Giới tính",age:"Tuổi",doctor:"Bác sĩ",male:"Nam",female:"Nữ",date:"Ngày hoàn thành",status:{0:"Đã bắt đầu",1:"Đang chờ",2:"Đã xong",3:"Đã hủy",4:"Không có kết quả",5:"Đã lên lịch",6:"Từ chối",label:"Trạng thái"},description:{label:"Mô tả",placeholder:"Nhập mô tả..."},conclusion:{label:"Kết luận",placeholder:"Nhập kết luận..."},notifications:{save_success:"Mô tả đã được lưu thành công",save_error:"Lỗi khi lưu mô tả",locked:"Sự kiện bị khóa bởi người dùng: {{name}}"},submit:"Lưu",cancel:"Đóng",notLinked:"Nghiên cứu không được liên kết với MIS"},k9e={patient_id:"ID:",study_description:"Mô tả:",window_width:"WW",window_center:"WC",zoom:"Zoom"},A9e={title:"Không tìm thấy nghiên cứu",message:"Thật không may, nghiên cứu được yêu cầu không tồn tại hoặc đã bị xóa",back_button:"Quay lại"},L9e={title:"Tùy chọn tải xuống",description:"Chọn định dạng và tệp để tải xuống",imagesCount:"{{count}} hình ảnh trong chuỗi",downloadZip:"Tải xuống tất cả (ZIP)",preparing:"Đang chuẩn bị tệp nén...",studyId:"ID nghiên cứu:"},V9e={title:E9e,fallbackDescription:O9e,layout:D9e,sidebar:M9e,viewport:R9e,loading:I9e,tools:N9e,conclusion:P9e,overlay:k9e,not_found:A9e,downloadModal:L9e},$9e={title:"Login to your account",description:"Enter your login below to access your account"},j9e={login_label:"Login",login_placeholder:"Enter your login",password_label:"Password",password_placeholder:"Enter your password",submit_button:"Sign in"},U9e={title:"Select user",description:"Multiple accounts are associated with your login and password. Please select the one you need."},F9e={loading:"Signing in...",success:"You have successfully signed in!",select_profile:"Select profile to sign in",completed:"Authorization completed",error_prefix:"An error occurred:",invalid_credentials:"Invalid login and/or password",unauthorized:"Invalid credentials",forbidden:"No available profiles for this login",not_found:"User not found",server_error:"Server error"},B9e={title:"Are you sure you want to log out?",description:"Logging out will end your current session, and you will need to log in again to continue.",cancel:"Cancel",confirm:"Log out",loading:"Logging out...",error:"Failed to log out. Please try again."},z9e={login_card:$9e,login_form:j9e,person_select_modal:U9e,authorization:F9e,logout:B9e},G9e={title:"Вход в учетную запись",description:"Введите свой логин ниже, чтобы войти в свою учетную запись"},W9e={login_label:"Логин",login_placeholder:"Введите логин",password_label:"Пароль",password_placeholder:"Введите пароль",submit_button:"Вход"},H9e={title:"Выберите пользователя",description:"С вашим логином и паролем связано несколько учетных записей. Пожалуйста, выберите нужную."},q9e={loading:"Вход в систему...",success:"Вы успешно авторизовались!",select_profile:"Выберите профиль для входа",completed:"Авторизация завершена",error_prefix:"Произошла ошибка:",invalid_credentials:"Неверный логин и/или пароль",unauthorized:"Неверные учетные данные",forbidden:"Нет доступных персон для данного логина",not_found:"Пользователь не найден",server_error:"Ошибка сервера"},K9e={title:"Вы уверены, что хотите выйти?",description:"При выходе из системы ваша текущая сессия будет завершена, и вам потребуется повторно авторизоваться для продолжения работы.",cancel:"Отмена",confirm:"Выйти",loading:"Выход...",error:"Не удалось выйти из системы. Попробуйте снова."},Y9e={login_card:G9e,login_form:W9e,person_select_modal:H9e,authorization:q9e,logout:K9e},X9e={title:"Đăng nhập vào tài khoản",description:"Nhập thông tin đăng nhập của bạn bên dưới để truy cập tài khoản"},Z9e={login_label:"Tên đăng nhập",login_placeholder:"Nhập tên đăng nhập",password_label:"Mật khẩu",password_placeholder:"Nhập mật khẩu",submit_button:"Đăng nhập"},Q9e={title:"Chọn người dùng",description:"Có một số tài khoản được liên kết với tên người dùng và mật khẩu của bạn. Vui lòng chọn một trong những thích hợp."},J9e={loading:"Đang đăng nhập...",success:"Bạn đã đăng nhập thành công!",select_profile:"Chọn hồ sơ để đăng nhập",completed:"Xác thực hoàn tất",error_prefix:"Đã xảy ra lỗi:",invalid_credentials:"Sai tên đăng nhập và/hoặc mật khẩu",unauthorized:"Thông tin đăng nhập không hợp lệ",forbidden:"Không có hồ sơ nào khả dụng cho tên đăng nhập này",not_found:"Không tìm thấy người dùng",server_error:"Lỗi máy chủ"},e7e={title:"Bạn có chắc chắn muốn đăng xuất?",description:"Đăng xuất sẽ kết thúc phiên làm việc hiện tại của bạn, và bạn sẽ cần đăng nhập lại để tiếp tục.",cancel:"Hủy",confirm:"Đăng xuất",loading:"Đang đăng xuất...",error:"Không thể đăng xuất. Vui lòng thử lại."},t7e={login_card:X9e,login_form:Z9e,person_select_modal:Q9e,authorization:J9e,logout:e7e},n7e="Study Worklist",r7e="Study information",i7e="Search by patient name...",a7e="Search by patient ID...",o7e="Equipment",s7e="Export to Excel",c7e="Select equipment",l7e="Or",u7e="New study",f7e={title:"No studies found",description:"No studies were found with the specified parameters. Try changing your search parameters."},d7e={select_all:"Select all",select_row:"Select row",study:"Study",patient:"Patient",birth_date:"Birth Date",sex:"Sex",client_id:"ID",ticket_date:"Ticket Date",male:"Male",female:"Female",unknown:"—",no_data:"No data"},h7e={description:"An error occurred while loading the study worklist page. Check your network connection and try again."},g7e={title:"Perform Study",patient_age:"Patient Age",sex:"Sex",patient_id:"Patient ID",study:"Study",sex_m:"Male",sex_f:"Female",received_images:"Received series:",waiting_images_title:"Waiting for images",study_started:"Study started",images_auto_appear:"Images will appear automatically once received from the device",waiting:"Waiting...",close:"Close",start:"Start Study",waiting_btn:"Waiting for images...",finish:"Finish Study",finishing:"Finishing study..."},p7e={title:"Abort study?",description:"You are about to close the study window. The current session will be cancelled and received images (if any) will be deleted.",cancel:"Cancel",confirm:"Abort"},m7e={start_error:"Failed to start study",cancel_success:"Study cancelled successfully!",cancel_error:"Error cancelling study",finish_success:"Study completed successfully!",finish_error:"Error saving study",create_success:"Study created successfully!",create_error:"Error creating study"},v7e={title:"Create Study",patient_section:"Patient Information",study_section:"Study Information",schedule_section:"Schedule",pat_name:"Patient Name",pat_name_placeholder:"John Doe",pat_id:"Patient ID",pat_id_placeholder:"Enter ID",pat_sex:"Sex",pat_sex_placeholder:"Select sex",sex_m:"Male",sex_f:"Female",sex_o:"Other",pat_birth:"Date of Birth",modality:"Modality",modality_placeholder:"Select modality",station_aet:"Equipment",station_aet_placeholder:"Select device",acc_num:"Accession Number",acc_num_placeholder:"Enter number",req_desc:"Study Description",req_desc_placeholder:"Enter description",sched_date:"Study Date",sched_time:"Study Time",select_date:"Select date",cancel:"Cancel",create:"Create",creating:"Creating...",validation:{pat_name_required:"Enter patient name",pat_id_required:"Enter patient ID",pat_birth_required:"Select date of birth",pat_sex_required:"Select sex",sched_date_required:"Select study date"}},y7e={title:n7e,description:r7e,search_placeholder:i7e,search_placeholder_id:a7e,equipment:o7e,export_excel:s7e,select_equipment:c7e,or:l7e,create_btn:u7e,empty_state:f7e,table:d7e,errors:h7e,launch_study:g7e,confirm_close:p7e,notifications:m7e,create_new_study:v7e},x7e="Очередь исследований",w7e="Информация о исследованиях",b7e="Поиск по ФИО пациента...",S7e="Поиск по ID пациента...",C7e="Оборудование",_7e="Экспорт в Excel",T7e="Выберите оборудование",E7e="Или",O7e="Новое исследование",D7e={title:"Исследования не найдены",description:"По указанным параметрам не найдено ни одного исследования. Попробуйте изменить параметры поиска."},M7e={select_all:"Выбрать все",select_row:"Выбрать строку",study:"Исследование",patient:"Пациент",birth_date:"Дата рождения",sex:"Пол",client_id:"ID",ticket_date:"Дата талона",male:"Мужской",female:"Женский",unknown:"—",no_data:"Нет данных"},R7e={description:"Произошла ошибка при загрузке страницы очереди исследований. Проверьте подключение к сети и попробуйте снова."},I7e={title:"Проведение исследования",patient_age:"Возраст пациента",sex:"Пол",patient_id:"ID пациента",study:"Исследование",sex_m:"Мужской",sex_f:"Женский",received_images:"Полученные серии:",waiting_images_title:"Ожидание снимков",study_started:"Исследование запущено",images_auto_appear:"Снимки появятся автоматически после получения с устройства",waiting:"Ожидание...",close:"Закрыть",start:"Начать исследование",waiting_btn:"Ожидание снимков...",finish:"Завершить исследование",finishing:"Завершение исследования..."},N7e={title:"Прервать исследование?",description:"Вы собираетесь закрыть окно проведения исследования. Текущая сессия будет отменена, а полученные снимки (если есть) удалены.",cancel:"Отмена",confirm:"Прервать"},P7e={start_error:"Не удалось начать исследование",cancel_success:"Исследование успешно отменено!",cancel_error:"Ошибка при отмене исследования",finish_success:"Исследование успешно завершено!",finish_error:"Ошибка при сохранении исследования",create_success:"Исследование успешно создано!",create_error:"Ошибка при создании исследования"},k7e={title:"Создание исследования",patient_section:"Данные пациента",study_section:"Данные исследования",schedule_section:"Расписание",pat_name:"ФИО пациента",pat_name_placeholder:"Иванов Иван Иванович",pat_id:"ID пациента",pat_id_placeholder:"Введите ID",pat_sex:"Пол",pat_sex_placeholder:"Выберите пол",sex_m:"Мужской",sex_f:"Женский",sex_o:"Другой",pat_birth:"Дата рождения",modality:"Модальность",modality_placeholder:"Выберите модальность",station_aet:"Оборудование",station_aet_placeholder:"Выберите устройство",acc_num:"Номер направления",acc_num_placeholder:"Введите номер",req_desc:"Описание исследования",req_desc_placeholder:"Введите описание",sched_date:"Дата исследования",sched_time:"Время исследования",select_date:"Выберите дату",cancel:"Отмена",create:"Создать",creating:"Создание...",validation:{pat_name_required:"Введите ФИО пациента",pat_id_required:"Введите ID пациента",pat_birth_required:"Выберите дату рождения",pat_sex_required:"Выберите пол",sched_date_required:"Выберите дату исследования"}},A7e={title:x7e,description:w7e,search_placeholder:b7e,search_placeholder_id:S7e,equipment:C7e,export_excel:_7e,select_equipment:T7e,or:E7e,create_btn:O7e,empty_state:D7e,table:M7e,errors:R7e,launch_study:I7e,confirm_close:N7e,notifications:P7e,create_new_study:k7e},L7e="Danh sách nghiên cứu",V7e="Thông tin nghiên cứu",$7e="Tìm kiếm theo tên bệnh nhân...",j7e="Tìm kiếm theo ID bệnh nhân...",U7e="Thiết bị",F7e="Xuất ra Excel",B7e="Chọn thiết bị",z7e="hoặc",G7e="Nghiên cứu mới",W7e={title:"Không tìm thấy nghiên cứu",description:"Không tìm thấy nghiên cứu nào với các tham số đã chỉ định. Hãy thử thay đổi tham số tìm kiếm của bạn."},H7e={select_all:"Chọn tất cả",select_row:"Chọn hàng",study:"Nghiên cứu",patient:"Bệnh nhân",birth_date:"Ngày sinh",sex:"Giới tính",client_id:"ID",ticket_date:"Ngày đặt lịch",male:"Nam",female:"Nữ",unknown:"—",no_data:"Không có dữ liệu"},q7e={description:"Đã xảy ra lỗi khi tải trang danh sách nghiên cứu. Kiểm tra kết nối mạng của bạn và thử lại."},K7e={title:"Thực hiện nghiên cứu",patient_age:"Tuổi bệnh nhân",sex:"Giới tính",patient_id:"ID bệnh nhân",study:"Nghiên cứu",sex_m:"Nam",sex_f:"Nữ",received_images:"Loạt ảnh đã nhận:",waiting_images_title:"Đang chờ hình ảnh",study_started:"Nghiên cứu đã bắt đầu",images_auto_appear:"Hình ảnh sẽ tự động xuất hiện sau khi nhận được từ thiết bị",waiting:"Đang chờ...",close:"Đóng",start:"Bắt đầu nghiên cứu",waiting_btn:"Đang chờ hình ảnh...",finish:"Hoàn thành nghiên cứu",finishing:"Đang hoàn thành..."},Y7e={title:"Hủy bỏ nghiên cứu?",description:"Bạn sắp đóng cửa sổ nghiên cứu. Phiên hiện tại sẽ bị hủy và các hình ảnh đã nhận (nếu có) sẽ bị xóa.",cancel:"Hủy",confirm:"Hủy bỏ"},X7e={start_error:"Không thể bắt đầu nghiên cứu",cancel_success:"Nghiên cứu đã hủy thành công!",cancel_error:"Lỗi khi hủy nghiên cứu",finish_success:"Nghiên cứu đã hoàn thành thành công!",finish_error:"Lỗi khi lưu nghiên cứu",create_success:"Nghiên cứu đã tạo thành công!",create_error:"Lỗi khi tạo nghiên cứu"},Z7e={title:"Tạo nghiên cứu",patient_section:"Thông tin bệnh nhân",study_section:"Thông tin nghiên cứu",schedule_section:"Lịch trình",pat_name:"Tên bệnh nhân",pat_name_placeholder:"Nguyễn Văn A",pat_id:"ID bệnh nhân",pat_id_placeholder:"Nhập ID",pat_sex:"Giới tính",pat_sex_placeholder:"Chọn giới tính",sex_m:"Nam",sex_f:"Nữ",sex_o:"Khác",pat_birth:"Ngày sinh",modality:"Phương thức",modality_placeholder:"Chọn phương thức",station_aet:"Thiết bị",station_aet_placeholder:"Chọn thiết bị",acc_num:"Số giấy chuyển",acc_num_placeholder:"Nhập số",req_desc:"Mô tả nghiên cứu",req_desc_placeholder:"Nhập mô tả",sched_date:"Ngày nghiên cứu",sched_time:"Giờ nghiên cứu",select_date:"Chọn ngày",cancel:"Hủy",create:"Tạo",creating:"Đang tạo...",validation:{pat_name_required:"Nhập tên bệnh nhân",pat_id_required:"Nhập ID bệnh nhân",pat_birth_required:"Chọn ngày sinh",pat_sex_required:"Chọn giới tính",sched_date_required:"Chọn ngày nghiên cứu"}},Q7e={title:L7e,description:V7e,search_placeholder:$7e,search_placeholder_id:j7e,equipment:U7e,export_excel:F7e,select_equipment:B7e,or:z7e,create_btn:G7e,empty_state:W7e,table:H7e,errors:q7e,launch_study:K7e,confirm_close:Y7e,notifications:X7e,create_new_study:Z7e},J7e="Event log",eOe="System activity and actions monitoring",tOe="Select period",nOe="Reset",rOe="From",iOe="To",aOe="Keyword search...",oOe={title:J7e,description:eOe,select_period:tOe,reset:nOe,from:rOe,to:iOe,search_placeholder:aOe},sOe="Журнал событий",cOe="Мониторинг активности системы и действий",lOe="Выберите период",uOe="Сбросить",fOe="С",dOe="До",hOe="Поиск по ключевым словам...",gOe={title:sOe,description:cOe,select_period:lOe,reset:uOe,from:fOe,to:dOe,search_placeholder:hOe},pOe="Nhật ký sự kiện",mOe="Giám sát hoạt động hệ thống và hành động",vOe="Chọn khoảng thời gian",yOe="Đặt lại",xOe="Từ",wOe="Đến",bOe="Tìm kiếm từ khóa....",SOe={title:pOe,description:mOe,select_period:vOe,reset:yOe,from:xOe,to:wOe,search_placeholder:bOe},COe={en:{common:v6e,sidebar:B6e,analytics:_8e,devices:J8e,studies:AEe,study:h9e,login:z9e,worklist:y7e,logs:oOe},ru:{common:S6e,sidebar:r8e,analytics:N8e,devices:dEe,studies:WEe,study:T9e,login:Y9e,worklist:A7e,logs:gOe},vi:{common:O6e,sidebar:m8e,analytics:U8e,devices:TEe,studies:t9e,study:V9e,login:t7e,worklist:Q7e,logs:SOe}};go.use(zre).use(HTe).init({resources:COe,fallbackLng:"ru",defaultNS:"common",interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});const _Oe=({children:t})=>w.jsx(ZTe,{i18n:go,children:t});var y1=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(){}},TOe={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},EOe=class{#t=TOe;#e=!1;setTimeoutProvider(t){this.#t=t}setTimeout(t,e){return this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}},hm=new EOe;function OOe(t){setTimeout(t,0)}var Fm=typeof window>"u"||"Deno"in globalThis;function bs(){}function DOe(t,e){return typeof t=="function"?t(e):t}function OI(t){return typeof t=="number"&&t>=0&&t!==1/0}function Gre(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Lg(t,e){return typeof t=="function"?t(e):t}function uu(t,e){return typeof t=="function"?t(e):t}function iH(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=t;if(o){if(r){if(e.queryHash!==Wk(o,e.options))return!1}else if(!uw(e.queryKey,o))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof s=="boolean"&&e.isStale()!==s||i&&i!==e.state.fetchStatus||a&&!a(e))}function aH(t,e){const{exact:n,status:r,predicate:i,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(n){if(Bm(e.options.mutationKey)!==Bm(a))return!1}else if(!uw(e.options.mutationKey,a))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Wk(t,e){return(e?.queryKeyHashFn||Bm)(t)}function Bm(t){return JSON.stringify(t,(e,n)=>DI(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function uw(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>uw(t[n],e[n])):!1}var MOe=Object.prototype.hasOwnProperty;function Hk(t,e){if(t===e)return t;const n=oH(t)&&oH(e);if(!n&&!(DI(t)&&DI(e)))return e;const i=(n?t:Object.keys(t)).length,a=n?e:Object.keys(e),o=a.length,s=n?new Array(o):{};let c=0;for(let l=0;l<o;l++){const u=n?l:a[l],f=t[u],d=e[u];if(f===d){s[u]=f,(n?l<i:MOe.call(t,u))&&c++;continue}if(f===null||d===null||typeof f!="object"||typeof d!="object"){s[u]=d;continue}const h=Hk(f,d);s[u]=h,h===f&&c++}return i===o&&c===i?t:s}function fw(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 oH(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function DI(t){if(!sH(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!sH(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function sH(t){return Object.prototype.toString.call(t)==="[object Object]"}function ROe(t){return new Promise(e=>{hm.setTimeout(e,t)})}function MI(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Hk(t,e):e}function IOe(t){return t}function NOe(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function POe(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var qk=Symbol();function Wre(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===qk?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Hre(t,e){return typeof t=="function"?t(...e):!!t}var kOe=class extends y1{#t;#e;#n;constructor(){super(),this.#n=t=>{if(!Fm&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#n=t,this.#e?.(),this.#e=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},Kk=new kOe;function RI(){let t,e;const n=new Promise((i,a)=>{t=i,e=a});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 AOe=OOe;function LOe(){let t=[],e=0,n=s=>{s()},r=s=>{s()},i=AOe;const a=s=>{e?t.push(s):i(()=>{n(s)})},o=()=>{const s=t;t=[],s.length&&i(()=>{r(()=>{s.forEach(c=>{n(c)})})})};return{batch:s=>{let c;e++;try{c=s()}finally{e--,e||o()}return c},batchCalls:s=>(...c)=>{a(()=>{s(...c)})},schedule:a,setNotifyFunction:s=>{n=s},setBatchNotifyFunction:s=>{r=s},setScheduler:s=>{i=s}}}var ga=LOe(),VOe=class extends y1{#t=!0;#e;#n;constructor(){super(),this.#n=t=>{if(!Fm&&window.addEventListener){const e=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#n=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#t!==t&&(this.#t=t,this.listeners.forEach(n=>{n(t)}))}isOnline(){return this.#t}},o_=new VOe;function $Oe(t){return Math.min(1e3*2**t,3e4)}function qre(t){return(t??"online")==="online"?o_.isOnline():!0}var II=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function Kre(t){let e=!1,n=0,r;const i=RI(),a=()=>i.status!=="pending",o=p=>{if(!a()){const y=new II(p);d(y),t.onCancel?.(y)}},s=()=>{e=!0},c=()=>{e=!1},l=()=>Kk.isFocused()&&(t.networkMode==="always"||o_.isOnline())&&t.canRun(),u=()=>qre(t.networkMode)&&t.canRun(),f=p=>{a()||(r?.(),i.resolve(p))},d=p=>{a()||(r?.(),i.reject(p))},h=()=>new Promise(p=>{r=y=>{(a()||l())&&p(y)},t.onPause?.()}).then(()=>{r=void 0,a()||t.onContinue?.()}),m=()=>{if(a())return;let p;const y=n===0?t.initialPromise:void 0;try{p=y??t.fn()}catch(x){p=Promise.reject(x)}Promise.resolve(p).then(f).catch(x=>{if(a())return;const S=t.retry??(Fm?0:3),C=t.retryDelay??$Oe,_=typeof C=="function"?C(n,x):C,T=S===!0||typeof S=="number"&&n<S||typeof S=="function"&&S(n,x);if(e||!T){d(x);return}n++,t.onFail?.(n,x),ROe(_).then(()=>l()?void 0:h()).then(()=>{e?d(x):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():h().then(m),i)}}var Yre=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),OI(this.gcTime)&&(this.#t=hm.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Fm?1/0:300*1e3))}clearGcTimeout(){this.#t&&(hm.clearTimeout(this.#t),this.#t=void 0)}},jOe=class extends Yre{#t;#e;#n;#i;#r;#a;#s;constructor(t){super(),this.#s=!1,this.#a=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#i=t.client,this.#n=this.#i.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=cH(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(t){if(this.options={...this.#a,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=cH(this.options);e.data!==void 0&&(this.setData(e.data,{updatedAt:e.dataUpdatedAt,manual:!0}),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(t,e){const n=MI(this.state.data,t,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),n}setState(t,e){this.#o({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#r?.promise;return this.#r?.cancel(t),e?e.then(bs).catch(bs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(t=>uu(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===qk||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Lg(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Gre(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#r&&(this.#s?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(t&&this.setOptions(t),!this.options.queryFn){const s=this.observers.find(c=>c.options.queryFn);s&&this.setOptions(s.options)}const n=new AbortController,r=s=>{Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{const s=Wre(this.options,e),l=(()=>{const u={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#s=!1,this.options.persister?this.options.persister(s,l,this):s(l)},o=(()=>{const s={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(s),s})();this.options.behavior?.onFetch(o,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#o({type:"fetch",meta:o.fetchOptions?.meta}),this.#r=Kre({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:s=>{s instanceof II&&s.revert&&this.setState({...this.#e,fetchStatus:"idle"}),n.abort()},onFail:(s,c)=>{this.#o({type:"failed",failureCount:s,error:c})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const s=await this.#r.start();if(s===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(s),this.#n.config.onSuccess?.(s,this),this.#n.config.onSettled?.(s,this.state.error,this),s}catch(s){if(s instanceof II){if(s.silent)return this.#r.promise;if(s.revert){if(this.state.data===void 0)throw s;return this.state.data}}throw this.#o({type:"error",error:s}),this.#n.config.onError?.(s,this),this.#n.config.onSettled?.(this.state.data,s,this),s}finally{this.scheduleGc()}}#o(t){const e=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Xre(n.data,this.options),fetchMeta:t.meta??null};case"success":const r={...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=t.manual?r:void 0,r;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=e(this.state),ga.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:t})})}};function Xre(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qre(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function cH(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 b6=class extends y1{constructor(t,e){super(),this.options=e,this.#t=t,this.#o=null,this.#s=RI(),this.bindMethods(),this.setOptions(e)}#t;#e=void 0;#n=void 0;#i=void 0;#r;#a;#s;#o;#h;#f;#d;#l;#u;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),lH(this.#e,this.options)?this.#g():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return NI(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return NI(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#b(),this.#e.removeObserver(this)}setOptions(t){const e=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof uu(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#e.setOptions(this.options),e._defaulted&&!fw(this.options,e)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&uH(this.#e,n,this.options,e)&&this.#g(),this.updateResult(),r&&(this.#e!==n||uu(this.options.enabled,this.#e)!==uu(e.enabled,this.#e)||Lg(this.options.staleTime,this.#e)!==Lg(e.staleTime,this.#e))&&this.#m();const i=this.#v();r&&(this.#e!==n||uu(this.options.enabled,this.#e)!==uu(e.enabled,this.#e)||i!==this.#c)&&this.#y(i)}getOptimisticResult(t){const e=this.#t.getQueryCache().build(this.#t,t),n=this.createResult(e,t);return FOe(this,n)&&(this.#i=n,this.#a=this.options,this.#r=this.#e.state),n}getCurrentResult(){return this.#i}trackResult(t,e){return new Proxy(t,{get:(n,r)=>(this.trackProp(r),e?.(r),r==="promise"&&!this.options.experimental_prefetchInRender&&this.#s.status==="pending"&&this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(n,r))})}trackProp(t){this.#p.add(t)}getCurrentQuery(){return this.#e}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#t.defaultQueryOptions(t),n=this.#t.getQueryCache().build(this.#t,e);return n.fetch().then(()=>this.createResult(n,e))}fetch(t){return this.#g({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#g(t){this.#S();let e=this.#e.fetch(this.options,t);return t?.throwOnError||(e=e.catch(bs)),e}#m(){this.#w();const t=Lg(this.options.staleTime,this.#e);if(Fm||this.#i.isStale||!OI(t))return;const n=Gre(this.#i.dataUpdatedAt,t)+1;this.#l=hm.setTimeout(()=>{this.#i.isStale||this.updateResult()},n)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(t){this.#b(),this.#c=t,!(Fm||uu(this.options.enabled,this.#e)===!1||!OI(this.#c)||this.#c===0)&&(this.#u=hm.setInterval(()=>{(this.options.refetchIntervalInBackground||Kk.isFocused())&&this.#g()},this.#c))}#x(){this.#m(),this.#y(this.#v())}#w(){this.#l&&(hm.clearTimeout(this.#l),this.#l=void 0)}#b(){this.#u&&(hm.clearInterval(this.#u),this.#u=void 0)}createResult(t,e){const n=this.#e,r=this.options,i=this.#i,a=this.#r,o=this.#a,c=t!==n?t.state:this.#n,{state:l}=t;let u={...l},f=!1,d;if(e._optimisticResults){const I=this.hasListeners(),V=!I&&lH(t,e),k=I&&uH(t,n,e,r);(V||k)&&(u={...u,...Xre(l.data,t.options)}),e._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:h,errorUpdatedAt:m,status:p}=u;d=u.data;let y=!1;if(e.placeholderData!==void 0&&d===void 0&&p==="pending"){let I;i?.isPlaceholderData&&e.placeholderData===o?.placeholderData?(I=i.data,y=!0):I=typeof e.placeholderData=="function"?e.placeholderData(this.#d?.state.data,this.#d):e.placeholderData,I!==void 0&&(p="success",d=MI(i?.data,I,e),f=!0)}if(e.select&&d!==void 0&&!y)if(i&&d===a?.data&&e.select===this.#h)d=this.#f;else try{this.#h=e.select,d=e.select(d),d=MI(i?.data,d,e),this.#f=d,this.#o=null}catch(I){this.#o=I}this.#o&&(h=this.#o,d=this.#f,m=Date.now(),p="error");const x=u.fetchStatus==="fetching",S=p==="pending",C=p==="error",_=S&&x,T=d!==void 0,M={status:p,fetchStatus:u.fetchStatus,isPending:S,isSuccess:p==="success",isError:C,isInitialLoading:_,isLoading:_,data:d,dataUpdatedAt:u.dataUpdatedAt,error:h,errorUpdatedAt:m,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!S,isLoadingError:C&&!T,isPaused:u.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:C&&T,isStale:Yk(t,e),refetch:this.refetch,promise:this.#s,isEnabled:uu(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=L=>{M.status==="error"?L.reject(M.error):M.data!==void 0&&L.resolve(M.data)},V=()=>{const L=this.#s=M.promise=RI();I(L)},k=this.#s;switch(k.status){case"pending":t.queryHash===n.queryHash&&I(k);break;case"fulfilled":(M.status==="error"||M.data!==k.value)&&V();break;case"rejected":(M.status!=="error"||M.error!==k.reason)&&V();break}}return M}updateResult(){const t=this.#i,e=this.createResult(this.#e,this.options);if(this.#r=this.#e.state,this.#a=this.options,this.#r.data!==void 0&&(this.#d=this.#e),fw(e,t))return;this.#i=e;const n=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#p.size)return!0;const a=new Set(i??this.#p);return this.options.throwOnError&&a.add("error"),Object.keys(this.#i).some(o=>{const s=o;return this.#i[s]!==t[s]&&a.has(s)})};this.#C({listeners:n()})}#S(){const t=this.#t.getQueryCache().build(this.#t,this.options);if(t===this.#e)return;const e=this.#e;this.#e=t,this.#n=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#C(t){ga.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#i)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function UOe(t,e){return uu(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function lH(t,e){return UOe(t,e)||t.state.data!==void 0&&NI(t,e,e.refetchOnMount)}function NI(t,e,n){if(uu(e.enabled,t)!==!1&&Lg(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Yk(t,e)}return!1}function uH(t,e,n,r){return(t!==e||uu(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Yk(t,n)}function Yk(t,e){return uu(e.enabled,t)!==!1&&t.isStaleByTime(Lg(e.staleTime,t))}function FOe(t,e){return!fw(t.getCurrentResult(),e)}function s_(t){return{onFetch:(e,n)=>{const r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let s={pages:[],pageParams:[]},c=0;const l=async()=>{let u=!1;const f=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(e.signal.aborted?u=!0:e.signal.addEventListener("abort",()=>{u=!0}),e.signal)})},d=Wre(e.options,e.fetchOptions),h=async(m,p,y)=>{if(u)return Promise.reject();if(p==null&&m.pages.length)return Promise.resolve(m);const S=(()=>{const O={client:e.client,queryKey:e.queryKey,pageParam:p,direction:y?"backward":"forward",meta:e.options.meta};return f(O),O})(),C=await d(S),{maxPages:_}=e.options,T=y?POe:NOe;return{pages:T(m.pages,C,_),pageParams:T(m.pageParams,p,_)}};if(i&&a.length){const m=i==="backward",p=m?Zre:PI,y={pages:a,pageParams:o},x=p(r,y);s=await h(y,x,m)}else{const m=t??a.length;do{const p=c===0?o[0]??r.initialPageParam:PI(r,s);if(c>0&&p==null)break;s=await h(s,p),c++}while(c<m)}return s};e.options.persister?e.fetchFn=()=>e.options.persister?.(l,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n):e.fetchFn=l}}}function PI(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 Zre(t,{pages:e,pageParams:n}){return e.length>0?t.getPreviousPageParam?.(e[0],e,n[0],n):void 0}function BOe(t,e){return e?PI(t,e)!=null:!1}function zOe(t,e){return!e||!t.getPreviousPageParam?!1:Zre(t,e)!=null}var GOe=class extends b6{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:s_()})}getOptimisticResult(t){return t.behavior=s_(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){const{state:n}=t,r=super.createResult(t,e),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c==="forward",u=i&&c==="forward",f=o&&c==="backward",d=i&&c==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:BOe(e,n.data),hasPreviousPage:zOe(e,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:f,isFetchingPreviousPage:d,isRefetchError:s&&!l&&!f,isRefetching:a&&!u&&!d}}},WOe=class extends Yre{#t;#e;#n;#i;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#n=t.mutationCache,this.#e=[],this.state=t.state||Qre(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#r({type:"continue"})},n={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=Kre({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(a,o)=>{this.#r({type:"failed",failureCount:a,error:o})},onPause:()=>{this.#r({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",i=!this.#i.canStart();try{if(r)e();else{this.#r({type:"pending",variables:t,isPaused:i}),await this.#n.config.onMutate?.(t,this,n);const o=await this.options.onMutate?.(t,n);o!==this.state.context&&this.#r({type:"pending",context:o,variables:t,isPaused:i})}const a=await this.#i.start();return await this.#n.config.onSuccess?.(a,t,this.state.context,this,n),await this.options.onSuccess?.(a,t,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,t,this.state.context,n),this.#r({type:"success",data:a}),a}catch(a){try{throw await this.#n.config.onError?.(a,t,this.state.context,this,n),await this.options.onError?.(a,t,this.state.context,n),await this.#n.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,a,t,this.state.context,n),a}finally{this.#r({type:"error",error:a})}}finally{this.#n.runNext(this)}}#r(t){const e=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),ga.batch(()=>{this.#e.forEach(n=>{n.onMutationUpdate(t)}),this.#n.notify({mutation:this,type:"updated",action:t})})}};function Qre(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var HOe=class extends y1{constructor(t={}){super(),this.config=t,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(t,e,n){const r=new WOe({client:t,mutationCache:this,mutationId:++this.#n,options:t.defaultMutationOptions(e),state:n});return this.add(r),r}add(t){this.#t.add(t);const e=N4(t);if(typeof e=="string"){const n=this.#e.get(e);n?n.push(t):this.#e.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#t.delete(t)){const e=N4(t);if(typeof e=="string"){const n=this.#e.get(e);if(n)if(n.length>1){const r=n.indexOf(t);r!==-1&&n.splice(r,1)}else n[0]===t&&this.#e.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=N4(t);if(typeof e=="string"){const r=this.#e.get(e)?.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){const e=N4(t);return typeof e=="string"?this.#e.get(e)?.find(r=>r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ga.batch(()=>{this.#t.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(t){const e={exact:!0,...t};return this.getAll().find(n=>aH(e,n))}findAll(t={}){return this.getAll().filter(e=>aH(t,e))}notify(t){ga.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return ga.batch(()=>Promise.all(t.map(e=>e.continue().catch(bs))))}};function N4(t){return t.options.scope?.id}var qOe=class extends y1{#t;#e=void 0;#n;#i;constructor(e,n){super(),this.#t=e,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const n=this.options;this.options=this.#t.defaultMutationOptions(e),fw(this.options,n)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&Bm(n.mutationKey)!==Bm(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#r(),this.#a(e)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#a()}mutate(e,n){return this.#i=n,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(e)}#r(){const e=this.#n?.state??Qre();this.#e={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#a(e){ga.batch(()=>{if(this.#i&&this.hasListeners()){const n=this.#e.variables,r=this.#e.context,i={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type==="success"?(this.#i.onSuccess?.(e.data,n,r,i),this.#i.onSettled?.(e.data,null,n,r,i)):e?.type==="error"&&(this.#i.onError?.(e.error,n,r,i),this.#i.onSettled?.(void 0,e.error,n,r,i))}this.listeners.forEach(n=>{n(this.#e)})})}};function fH(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function KOe(t,e,n){const r=t.slice(0);return r[e]=n,r}var YOe=class extends y1{#t;#e;#n;#i;#r;#a;#s;#o;#h=[];constructor(t,e,n){super(),this.#t=t,this.#i=n,this.#n=[],this.#r=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#r.forEach(t=>{t.subscribe(e=>{this.#u(t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#r.forEach(t=>{t.destroy()})}setQueries(t,e){this.#n=t,this.#i=e,ga.batch(()=>{const n=this.#r,r=this.#l(this.#n);this.#h=r,r.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const i=r.map(u=>u.observer),a=i.map(u=>u.getCurrentResult()),o=n.length!==i.length,s=i.some((u,f)=>u!==n[f]),c=o||s,l=c?!0:a.some((u,f)=>{const d=this.#e[f];return!d||!fw(u,d)});!c&&!l||(c&&(this.#r=i),this.#e=a,this.hasListeners()&&(c&&(fH(n,i).forEach(u=>{u.destroy()}),fH(i,n).forEach(u=>{u.subscribe(f=>{this.#u(u,f)})})),this.#c()))})}getCurrentResult(){return this.#e}getQueries(){return this.#r.map(t=>t.getCurrentQuery())}getObservers(){return this.#r}getOptimisticResult(t,e){const n=this.#l(t),r=n.map(i=>i.observer.getOptimisticResult(i.defaultedQueryOptions));return[r,i=>this.#d(i??r,e),()=>this.#f(r,n)]}#f(t,e){return e.map((n,r)=>{const i=t[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,a=>{e.forEach(o=>{o.observer.trackProp(a)})})})}#d(t,e){return e?((!this.#a||this.#e!==this.#o||e!==this.#s)&&(this.#s=e,this.#o=this.#e,this.#a=Hk(this.#a,e(t))),this.#a):t}#l(t){const e=new Map(this.#r.map(r=>[r.options.queryHash,r])),n=[];return t.forEach(r=>{const i=this.#t.defaultQueryOptions(r),a=e.get(i.queryHash);a?n.push({defaultedQueryOptions:i,observer:a}):n.push({defaultedQueryOptions:i,observer:new b6(this.#t,i)})}),n}#u(t,e){const n=this.#r.indexOf(t);n!==-1&&(this.#e=KOe(this.#e,n,e),this.#c())}#c(){if(this.hasListeners()){const t=this.#a,e=this.#f(this.#e,this.#h),n=this.#d(e,this.#i?.combine);t!==n&&ga.batch(()=>{this.listeners.forEach(r=>{r(this.#e)})})}}},XOe=class extends y1{constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,e,n){const r=e.queryKey,i=e.queryHash??Wk(r,e);let a=this.get(i);return a||(a=new jOe({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:n,defaultOptions:t.getQueryDefaults(r)}),this.add(a)),a}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#t.get(t.queryHash);e&&(t.destroy(),e===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ga.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(n=>iH(e,n))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(n=>iH(t,n)):e}notify(t){ga.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){ga.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ga.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ZOe=class{#t;#e;#n;#i;#r;#a;#s;#o;constructor(t={}){this.#t=t.queryCache||new XOe,this.#e=t.mutationCache||new HOe,this.#n=t.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#s=Kk.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#o=o_.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#s?.(),this.#s=void 0,this.#o?.(),this.#o=void 0)}isFetching(t){return this.#t.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=this.#t.build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(Lg(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#t.findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),a=this.#t.get(r.queryHash)?.state.data,o=DOe(e,a);if(o!==void 0)return this.#t.build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return ga.batch(()=>this.#t.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state}removeQueries(t){const e=this.#t;ga.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=this.#t;return ga.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=ga.batch(()=>this.#t.findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(bs).catch(bs)}invalidateQueries(t,e={}){return ga.batch(()=>(this.#t.findAll(t).forEach(n=>{n.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=ga.batch(()=>this.#t.findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let a=i.fetch(void 0,n);return n.throwOnError||(a=a.catch(bs)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(bs)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=this.#t.build(this,e);return n.isStaleByTime(Lg(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(bs).catch(bs)}fetchInfiniteQuery(t){return t.behavior=s_(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(bs).catch(bs)}ensureInfiniteQueryData(t){return t.behavior=s_(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return o_.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(t){this.#n=t}setQueryDefaults(t,e){this.#i.set(Bm(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#i.values()],n={};return e.forEach(r=>{uw(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){this.#r.set(Bm(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#r.values()],n={};return e.forEach(r=>{uw(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#n.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Wk(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===qk&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#n.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},Jre=D.createContext(void 0),$c=t=>{const e=D.useContext(Jre);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},QOe=({client:t,children:e})=>(D.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),w.jsx(Jre.Provider,{value:t,children:e})),eie=D.createContext(!1),tie=()=>D.useContext(eie);eie.Provider;function JOe(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var eDe=D.createContext(JOe()),nie=()=>D.useContext(eDe),rie=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},iie=t=>{D.useEffect(()=>{t.clearReset()},[t])},aie=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||Hre(n,[t.error,r])),oie=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))}},sie=(t,e)=>t.isLoading&&t.isFetching&&!e,kI=(t,e)=>t?.suspense&&e.isPending,c_=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function tDe({queries:t,...e},n){const r=$c(),i=tie(),a=nie(),o=D.useMemo(()=>t.map(p=>{const y=r.defaultQueryOptions(p);return y._optimisticResults=i?"isRestoring":"optimistic",y}),[t,r,i]);o.forEach(p=>{oie(p),rie(p,a)}),iie(a);const[s]=D.useState(()=>new YOe(r,o,e)),[c,l,u]=s.getOptimisticResult(o,e.combine),f=!i&&e.subscribed!==!1;D.useSyncExternalStore(D.useCallback(p=>f?s.subscribe(ga.batchCalls(p)):bs,[s,f]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),D.useEffect(()=>{s.setQueries(o,e)},[o,e,s]);const h=c.some((p,y)=>kI(o[y],p))?c.flatMap((p,y)=>{const x=o[y];if(x){const S=new b6(r,x);if(kI(x,p))return c_(x,S,a);sie(p,i)&&c_(x,S,a)}return[]}):[];if(h.length>0)throw Promise.all(h);const m=c.find((p,y)=>{const x=o[y];return x&&aie({result:p,errorResetBoundary:a,throwOnError:x.throwOnError,query:r.getQueryCache().get(x.queryHash),suspense:x.suspense})});if(m?.error)throw m.error;return l(u())}function cie(t,e,n){const r=tie(),i=nie(),a=$c(),o=a.defaultQueryOptions(t);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=r?"isRestoring":"optimistic",oie(o),rie(o,i),iie(i);const s=!a.getQueryCache().get(o.queryHash),[c]=D.useState(()=>new e(a,o)),l=c.getOptimisticResult(o),u=!r&&t.subscribed!==!1;if(D.useSyncExternalStore(D.useCallback(f=>{const d=u?c.subscribe(ga.batchCalls(f)):bs;return c.updateResult(),d},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),D.useEffect(()=>{c.setOptions(o)},[o,c]),kI(o,l))throw c_(o,c,i);if(aie({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!Fm&&sie(l,r)&&(s?c_(o,c,i):a.getQueryCache().get(o.queryHash)?.promise)?.catch(bs).finally(()=>{c.updateResult()}),o.notifyOnChangeProps?l:c.trackResult(l)}function Sh(t,e){return cie(t,b6)}function jc(t,e){const n=$c(),[r]=D.useState(()=>new qOe(n,t));D.useEffect(()=>{r.setOptions(t)},[r,t]);const i=D.useSyncExternalStore(D.useCallback(o=>r.subscribe(ga.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=D.useCallback((o,s)=>{r.mutate(o,s).catch(bs)},[r]);if(i.error&&Hre(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function nDe(t,e){return cie(t,GOe)}const rDe=({children:t})=>{const e=new ZOe;return w.jsx(QOe,{client:e,children:t})},iDe={theme:"dark",setTheme:()=>null},lie=D.createContext(iDe);function aDe({children:t,defaultTheme:e="dark",storageKey:n="vite-ui-theme",...r}){const[i,a]=D.useState(()=>localStorage.getItem(n)||e);D.useEffect(()=>{const s=window.document.documentElement;if(s.classList.remove("light","dark"),i==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";s.classList.add(c);return}s.classList.add(i)},[i]);const o={theme:i,setTheme:s=>{localStorage.setItem(n,s),a(s)}};return w.jsx(lie.Provider,{...r,value:o,children:t})}const Xk=()=>{const t=D.useContext(lie);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},uie=D.createContext(void 0),oDe=()=>{const t=D.useContext(uie);if(!t)throw new Error("useSidebar must be used within a SidebarProvider");return t},sDe=({children:t})=>{const[e,n]=D.useState(!1),r=()=>{n(i=>!i)};return w.jsx(uie.Provider,{value:{collapsed:e,toggleCollapsed:r},children:t})};var cDe=(t,e,n,r,i,a,o,s)=>{let c=document.documentElement,l=["light","dark"];function u(h){(Array.isArray(t)?t:[t]).forEach(m=>{let p=m==="class",y=p&&a?i.map(x=>a[x]||x):i;p?(c.classList.remove(...y),c.classList.add(a&&a[h]?a[h]:h)):c.setAttribute(m,h)}),f(h)}function f(h){s&&l.includes(h)&&(c.style.colorScheme=h)}function d(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)u(r);else try{let h=localStorage.getItem(e)||n,m=o&&h==="system"?d():h;u(m)}catch{}},lDe=D.createContext(void 0),uDe={setTheme:t=>{},themes:[]},fDe=()=>{var t;return(t=D.useContext(lDe))!=null?t:uDe};D.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,e,a,t,s,o,r,i]).slice(1,-1);return D.createElement("script",{...l,suppressHydrationWarning:!0,nonce:typeof window>"u"?c:"",dangerouslySetInnerHTML:{__html:`(${cDe.toString()})(${u})`}})});var x1=Rre();const fie=ka(x1);function dDe(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const hDe=t=>{switch(t){case"success":return mDe;case"info":return yDe;case"warning":return vDe;case"error":return xDe;default:return null}},gDe=Array(12).fill(0),pDe=({visible:t,className:e})=>Ce.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},Ce.createElement("div",{className:"sonner-spinner"},gDe.map((n,r)=>Ce.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),mDe=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),vDe=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),yDe=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),xDe=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),wDe=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Ce.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ce.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),bDe=()=>{const[t,e]=Ce.useState(document.hidden);return Ce.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let AI=1;class SDe{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...i}=e,a=typeof e?.id=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:AI++,o=this.toasts.find(c=>c.id===a),s=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(c=>c.id===a?(this.publish({...c,...e,id:a,title:r}),{...c,...e,id:a,dismissible:s,title:r}):c):this.addToast({title:r,...i,dismissible:s,id:a}),a},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(e instanceof Function?e():e);let a=r!==void 0,o;const s=i.then(async l=>{if(o=["resolve",l],Ce.isValidElement(l))a=!1,this.create({id:r,type:"default",message:l});else if(_De(l)&&!l.ok){a=!1;const f=typeof n.error=="function"?await n.error(`HTTP error! status: ${l.status}`):n.error,d=typeof n.description=="function"?await n.description(`HTTP error! status: ${l.status}`):n.description,m=typeof f=="object"&&!Ce.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:d,...m})}else if(l instanceof Error){a=!1;const f=typeof n.error=="function"?await n.error(l):n.error,d=typeof n.description=="function"?await n.description(l):n.description,m=typeof f=="object"&&!Ce.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:d,...m})}else if(n.success!==void 0){a=!1;const f=typeof n.success=="function"?await n.success(l):n.success,d=typeof n.description=="function"?await n.description(l):n.description,m=typeof f=="object"&&!Ce.isValidElement(f)?f:{message:f};this.create({id:r,type:"success",description:d,...m})}}).catch(async l=>{if(o=["reject",l],n.error!==void 0){a=!1;const u=typeof n.error=="function"?await n.error(l):n.error,f=typeof n.description=="function"?await n.description(l):n.description,h=typeof u=="object"&&!Ce.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:f,...h})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((l,u)=>s.then(()=>o[0]==="reject"?u(o[1]):l(o[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:c}:Object.assign(r,{unwrap:c})},this.custom=(e,n)=>{const r=n?.id||AI++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Tc=new SDe,CDe=(t,e)=>{const n=e?.id||AI++;return Tc.addToast({title:t,...e,id:n}),n},_De=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",TDe=CDe,EDe=()=>Tc.toasts,ODe=()=>Tc.getActiveToasts(),Br=Object.assign(TDe,{success:Tc.success,info:Tc.info,warning:Tc.warning,error:Tc.error,custom:Tc.custom,message:Tc.message,promise:Tc.promise,dismiss:Tc.dismiss,loading:Tc.loading},{getHistory:EDe,getToasts:ODe});dDe("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function P4(t){return t.label!==void 0}const DDe=3,MDe="24px",RDe="16px",dH=4e3,IDe=356,NDe=14,PDe=45,kDe=200;function Gf(...t){return t.filter(Boolean).join(" ")}function ADe(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const LDe=t=>{var e,n,r,i,a,o,s,c,l;const{invert:u,toast:f,unstyled:d,interacting:h,setHeights:m,visibleToasts:p,heights:y,index:x,toasts:S,expanded:C,removeToast:_,defaultRichColors:T,closeButton:O,style:M,cancelButtonStyle:I,actionButtonStyle:V,className:k="",descriptionClassName:L="",duration:$,position:W,gap:G,expandByDefault:oe,classNames:U,icons:Y,closeButtonAriaLabel:J="Close toast"}=t,[ne,F]=Ce.useState(null),[ae,re]=Ce.useState(null),[te,ye]=Ce.useState(!1),[we,Oe]=Ce.useState(!1),[Te,Me]=Ce.useState(!1),[be,Ye]=Ce.useState(!1),[ft,je]=Ce.useState(!1),[It,Rt]=Ce.useState(0),[cn,ln]=Ce.useState(0),en=Ce.useRef(f.duration||$||dH),tr=Ce.useRef(null),Ke=Ce.useRef(null),ue=x===0,B=x+1<=p,K=f.type,fe=f.dismissible!==!1,ie=f.className||"",pe=f.descriptionClassName||"",Re=Ce.useMemo(()=>y.findIndex(Xt=>Xt.toastId===f.id)||0,[y,f.id]),et=Ce.useMemo(()=>{var Xt;return(Xt=f.closeButton)!=null?Xt:O},[f.closeButton,O]),wt=Ce.useMemo(()=>f.duration||$||dH,[f.duration,$]),Pt=Ce.useRef(0),Ln=Ce.useRef(0),Sn=Ce.useRef(0),Sr=Ce.useRef(null),[hn,kn]=W.split("-"),Mn=Ce.useMemo(()=>y.reduce((Xt,Un,Bn)=>Bn>=Re?Xt:Xt+Un.height,0),[y,Re]),Ae=bDe(),at=f.invert||u,ct=K==="loading";Ln.current=Ce.useMemo(()=>Re*G+Mn,[Re,Mn]),Ce.useEffect(()=>{en.current=wt},[wt]),Ce.useEffect(()=>{ye(!0)},[]),Ce.useEffect(()=>{const Xt=Ke.current;if(Xt){const Un=Xt.getBoundingClientRect().height;return ln(Un),m(Bn=>[{toastId:f.id,height:Un,position:f.position},...Bn]),()=>m(Bn=>Bn.filter(pr=>pr.toastId!==f.id))}},[m,f.id]),Ce.useLayoutEffect(()=>{if(!te)return;const Xt=Ke.current,Un=Xt.style.height;Xt.style.height="auto";const Bn=Xt.getBoundingClientRect().height;Xt.style.height=Un,ln(Bn),m(pr=>pr.find(Vn=>Vn.toastId===f.id)?pr.map(Vn=>Vn.toastId===f.id?{...Vn,height:Bn}:Vn):[{toastId:f.id,height:Bn,position:f.position},...pr])},[te,f.title,f.description,m,f.id,f.jsx,f.action,f.cancel]);const kt=Ce.useCallback(()=>{Oe(!0),Rt(Ln.current),m(Xt=>Xt.filter(Un=>Un.toastId!==f.id)),setTimeout(()=>{_(f)},kDe)},[f,_,m,Ln]);Ce.useEffect(()=>{if(f.promise&&K==="loading"||f.duration===1/0||f.type==="loading")return;let Xt;return C||h||Ae?(()=>{if(Sn.current<Pt.current){const pr=new Date().getTime()-Pt.current;en.current=en.current-pr}Sn.current=new Date().getTime()})():(()=>{en.current!==1/0&&(Pt.current=new Date().getTime(),Xt=setTimeout(()=>{f.onAutoClose==null||f.onAutoClose.call(f,f),kt()},en.current))})(),()=>clearTimeout(Xt)},[C,h,f,K,Ae,kt]),Ce.useEffect(()=>{f.delete&&(kt(),f.onDismiss==null||f.onDismiss.call(f,f))},[kt,f.delete]);function jt(){var Xt;if(Y?.loading){var Un;return Ce.createElement("div",{className:Gf(U?.loader,f==null||(Un=f.classNames)==null?void 0:Un.loader,"sonner-loader"),"data-visible":K==="loading"},Y.loading)}return Ce.createElement(pDe,{className:Gf(U?.loader,f==null||(Xt=f.classNames)==null?void 0:Xt.loader),visible:K==="loading"})}const gn=f.icon||Y?.[K]||hDe(K);var Kn,rn;return Ce.createElement("li",{tabIndex:0,ref:Ke,className:Gf(k,ie,U?.toast,f==null||(e=f.classNames)==null?void 0:e.toast,U?.default,U?.[K],f==null||(n=f.classNames)==null?void 0:n[K]),"data-sonner-toast":"","data-rich-colors":(Kn=f.richColors)!=null?Kn:T,"data-styled":!(f.jsx||f.unstyled||d),"data-mounted":te,"data-promise":!!f.promise,"data-swiped":ft,"data-removed":we,"data-visible":B,"data-y-position":hn,"data-x-position":kn,"data-index":x,"data-front":ue,"data-swiping":Te,"data-dismissible":fe,"data-type":K,"data-invert":at,"data-swipe-out":be,"data-swipe-direction":ae,"data-expanded":!!(C||oe&&te),"data-testid":f.testId,style:{"--index":x,"--toasts-before":x,"--z-index":S.length-x,"--offset":`${we?It:Ln.current}px`,"--initial-height":oe?"auto":`${cn}px`,...M,...f.style},onDragEnd:()=>{Me(!1),F(null),Sr.current=null},onPointerDown:Xt=>{Xt.button!==2&&(ct||!fe||(tr.current=new Date,Rt(Ln.current),Xt.target.setPointerCapture(Xt.pointerId),Xt.target.tagName!=="BUTTON"&&(Me(!0),Sr.current={x:Xt.clientX,y:Xt.clientY})))},onPointerUp:()=>{var Xt,Un,Bn;if(be||!fe)return;Sr.current=null;const pr=Number(((Xt=Ke.current)==null?void 0:Xt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),wi=Number(((Un=Ke.current)==null?void 0:Un.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Vn=new Date().getTime()-((Bn=tr.current)==null?void 0:Bn.getTime()),mr=ne==="x"?pr:wi,Dt=Math.abs(mr)/Vn;if(Math.abs(mr)>=PDe||Dt>.11){Rt(Ln.current),f.onDismiss==null||f.onDismiss.call(f,f),re(ne==="x"?pr>0?"right":"left":wi>0?"down":"up"),kt(),Ye(!0);return}else{var Gt,Ut;(Gt=Ke.current)==null||Gt.style.setProperty("--swipe-amount-x","0px"),(Ut=Ke.current)==null||Ut.style.setProperty("--swipe-amount-y","0px")}je(!1),Me(!1),F(null)},onPointerMove:Xt=>{var Un,Bn,pr;if(!Sr.current||!fe||((Un=window.getSelection())==null?void 0:Un.toString().length)>0)return;const Vn=Xt.clientY-Sr.current.y,mr=Xt.clientX-Sr.current.x;var Dt;const Gt=(Dt=t.swipeDirections)!=null?Dt:ADe(W);!ne&&(Math.abs(mr)>1||Math.abs(Vn)>1)&&F(Math.abs(mr)>Math.abs(Vn)?"x":"y");let Ut={x:0,y:0};const un=Zr=>1/(1.5+Math.abs(Zr)/20);if(ne==="y"){if(Gt.includes("top")||Gt.includes("bottom"))if(Gt.includes("top")&&Vn<0||Gt.includes("bottom")&&Vn>0)Ut.y=Vn;else{const Zr=Vn*un(Vn);Ut.y=Math.abs(Zr)<Math.abs(Vn)?Zr:Vn}}else if(ne==="x"&&(Gt.includes("left")||Gt.includes("right")))if(Gt.includes("left")&&mr<0||Gt.includes("right")&&mr>0)Ut.x=mr;else{const Zr=mr*un(mr);Ut.x=Math.abs(Zr)<Math.abs(mr)?Zr:mr}(Math.abs(Ut.x)>0||Math.abs(Ut.y)>0)&&je(!0),(Bn=Ke.current)==null||Bn.style.setProperty("--swipe-amount-x",`${Ut.x}px`),(pr=Ke.current)==null||pr.style.setProperty("--swipe-amount-y",`${Ut.y}px`)}},et&&!f.jsx&&K!=="loading"?Ce.createElement("button",{"aria-label":J,"data-disabled":ct,"data-close-button":!0,onClick:ct||!fe?()=>{}:()=>{kt(),f.onDismiss==null||f.onDismiss.call(f,f)},className:Gf(U?.closeButton,f==null||(r=f.classNames)==null?void 0:r.closeButton)},(rn=Y?.close)!=null?rn:wDe):null,(K||f.icon||f.promise)&&f.icon!==null&&(Y?.[K]!==null||f.icon)?Ce.createElement("div",{"data-icon":"",className:Gf(U?.icon,f==null||(i=f.classNames)==null?void 0:i.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||jt():null,f.type!=="loading"?gn:null):null,Ce.createElement("div",{"data-content":"",className:Gf(U?.content,f==null||(a=f.classNames)==null?void 0:a.content)},Ce.createElement("div",{"data-title":"",className:Gf(U?.title,f==null||(o=f.classNames)==null?void 0:o.title)},f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title),f.description?Ce.createElement("div",{"data-description":"",className:Gf(L,pe,U?.description,f==null||(s=f.classNames)==null?void 0:s.description)},typeof f.description=="function"?f.description():f.description):null),Ce.isValidElement(f.cancel)?f.cancel:f.cancel&&P4(f.cancel)?Ce.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||I,onClick:Xt=>{P4(f.cancel)&&fe&&(f.cancel.onClick==null||f.cancel.onClick.call(f.cancel,Xt),kt())},className:Gf(U?.cancelButton,f==null||(c=f.classNames)==null?void 0:c.cancelButton)},f.cancel.label):null,Ce.isValidElement(f.action)?f.action:f.action&&P4(f.action)?Ce.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||V,onClick:Xt=>{P4(f.action)&&(f.action.onClick==null||f.action.onClick.call(f.action,Xt),!Xt.defaultPrevented&&kt())},className:Gf(U?.actionButton,f==null||(l=f.classNames)==null?void 0:l.actionButton)},f.action.label):null)};function hH(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function VDe(t,e){const n={};return[t,e].forEach((r,i)=>{const a=i===1,o=a?"--mobile-offset":"--offset",s=a?RDe:MDe;function c(l){["top","right","bottom","left"].forEach(u=>{n[`${o}-${u}`]=typeof l=="number"?`${l}px`:l})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(l=>{r[l]===void 0?n[`${o}-${l}`]=s:n[`${o}-${l}`]=typeof r[l]=="number"?`${r[l]}px`:r[l]}):c(s)}),n}const $De=Ce.forwardRef(function(e,n){const{id:r,invert:i,position:a="bottom-right",hotkey:o=["altKey","KeyT"],expand:s,closeButton:c,className:l,offset:u,mobileOffset:f,theme:d="light",richColors:h,duration:m,style:p,visibleToasts:y=DDe,toastOptions:x,dir:S=hH(),gap:C=NDe,icons:_,containerAriaLabel:T="Notifications"}=e,[O,M]=Ce.useState([]),I=Ce.useMemo(()=>r?O.filter(te=>te.toasterId===r):O.filter(te=>!te.toasterId),[O,r]),V=Ce.useMemo(()=>Array.from(new Set([a].concat(I.filter(te=>te.position).map(te=>te.position)))),[I,a]),[k,L]=Ce.useState([]),[$,W]=Ce.useState(!1),[G,oe]=Ce.useState(!1),[U,Y]=Ce.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),J=Ce.useRef(null),ne=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=Ce.useRef(null),ae=Ce.useRef(!1),re=Ce.useCallback(te=>{M(ye=>{var we;return(we=ye.find(Oe=>Oe.id===te.id))!=null&&we.delete||Tc.dismiss(te.id),ye.filter(({id:Oe})=>Oe!==te.id)})},[]);return Ce.useEffect(()=>Tc.subscribe(te=>{if(te.dismiss){requestAnimationFrame(()=>{M(ye=>ye.map(we=>we.id===te.id?{...we,delete:!0}:we))});return}setTimeout(()=>{fie.flushSync(()=>{M(ye=>{const we=ye.findIndex(Oe=>Oe.id===te.id);return we!==-1?[...ye.slice(0,we),{...ye[we],...te},...ye.slice(we+1)]:[te,...ye]})})})}),[O]),Ce.useEffect(()=>{if(d!=="system"){Y(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Y("dark"):Y("light")),typeof window>"u")return;const te=window.matchMedia("(prefers-color-scheme: dark)");try{te.addEventListener("change",({matches:ye})=>{Y(ye?"dark":"light")})}catch{te.addListener(({matches:we})=>{try{Y(we?"dark":"light")}catch(Oe){console.error(Oe)}})}},[d]),Ce.useEffect(()=>{O.length<=1&&W(!1)},[O]),Ce.useEffect(()=>{const te=ye=>{var we;if(o.every(Me=>ye[Me]||ye.code===Me)){var Te;W(!0),(Te=J.current)==null||Te.focus()}ye.code==="Escape"&&(document.activeElement===J.current||(we=J.current)!=null&&we.contains(document.activeElement))&&W(!1)};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[o]),Ce.useEffect(()=>{if(J.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,ae.current=!1)}},[J.current]),Ce.createElement("section",{ref:n,"aria-label":`${T} ${ne}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},V.map((te,ye)=>{var we;const[Oe,Te]=te.split("-");return I.length?Ce.createElement("ol",{key:te,dir:S==="auto"?hH():S,tabIndex:-1,ref:J,className:l,"data-sonner-toaster":!0,"data-sonner-theme":U,"data-y-position":Oe,"data-x-position":Te,style:{"--front-toast-height":`${((we=k[0])==null?void 0:we.height)||0}px`,"--width":`${IDe}px`,"--gap":`${C}px`,...p,...VDe(u,f)},onBlur:Me=>{ae.current&&!Me.currentTarget.contains(Me.relatedTarget)&&(ae.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:Me=>{Me.target instanceof HTMLElement&&Me.target.dataset.dismissible==="false"||ae.current||(ae.current=!0,F.current=Me.relatedTarget)},onMouseEnter:()=>W(!0),onMouseMove:()=>W(!0),onMouseLeave:()=>{G||W(!1)},onDragEnd:()=>W(!1),onPointerDown:Me=>{Me.target instanceof HTMLElement&&Me.target.dataset.dismissible==="false"||oe(!0)},onPointerUp:()=>oe(!1)},I.filter(Me=>!Me.position&&ye===0||Me.position===te).map((Me,be)=>{var Ye,ft;return Ce.createElement(LDe,{key:Me.id,icons:_,index:be,toast:Me,defaultRichColors:h,duration:(Ye=x?.duration)!=null?Ye:m,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:i,visibleToasts:y,closeButton:(ft=x?.closeButton)!=null?ft:c,interacting:G,position:te,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:re,toasts:I.filter(je=>je.position==Me.position),heights:k.filter(je=>je.position==Me.position),setHeights:L,expandByDefault:s,gap:C,expanded:$,swipeDirections:e.swipeDirections})})):null}))}),jDe=({...t})=>{const{theme:e="system"}=fDe();return w.jsx($De,{theme:e,className:"toaster group z-50",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...t})},UDe=({children:t})=>w.jsx(_Oe,{children:w.jsx(aDe,{children:w.jsx(rDe,{children:w.jsxs(sDe,{children:[t,w.jsx(jDe,{position:"top-right"})]})})})});/**
 * react-router v7.9.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 gH="popstate";function FDe(t={}){function e(r,i){let{pathname:a,search:o,hash:s}=r.location;return LI("",{pathname:a,search:o,hash:s},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:dw(i)}return zDe(e,n,null,t)}function $i(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function wu(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function BDe(){return Math.random().toString(36).substring(2,10)}function pH(t,e){return{usr:t.state,key:t.key,idx:e}}function LI(t,e,n=null,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?e2(e):e,state:n,key:e&&e.key||r||BDe()}}function dw({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 e2(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 zDe(t,e,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s="POP",c=null,l=u();l==null&&(l=0,o.replaceState({...o.state,idx:l},""));function u(){return(o.state||{idx:null}).idx}function f(){s="POP";let y=u(),x=y==null?null:y-l;l=y,c&&c({action:s,location:p.location,delta:x})}function d(y,x){s="PUSH";let S=LI(p.location,y,x);l=u()+1;let C=pH(S,l),_=p.createHref(S);try{o.pushState(C,"",_)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;i.location.assign(_)}a&&c&&c({action:s,location:p.location,delta:1})}function h(y,x){s="REPLACE";let S=LI(p.location,y,x);l=u();let C=pH(S,l),_=p.createHref(S);o.replaceState(C,"",_),a&&c&&c({action:s,location:p.location,delta:0})}function m(y){return GDe(y)}let p={get action(){return s},get location(){return t(i,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(gH,f),c=y,()=>{i.removeEventListener(gH,f),c=null}},createHref(y){return e(i,y)},createURL:m,encodeLocation(y){let x=m(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:d,replace:h,go(y){return o.go(y)}};return p}function GDe(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),$i(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:dw(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function die(t,e,n="/"){return WDe(t,e,n,!1)}function WDe(t,e,n,r){let i=typeof e=="string"?e2(e):e,a=oh(i.pathname||"/",n);if(a==null)return null;let o=hie(t);HDe(o);let s=null;for(let c=0;s==null&&c<o.length;++c){let l=rMe(a);s=tMe(o[c],l,r)}return s}function hie(t,e=[],n=[],r="",i=!1){let a=(o,s,c=i,l)=>{let u={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(r)&&c)return;$i(u.relativePath.startsWith(r),`Absolute route path "${u.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(r.length)}let f=q0([r,u.relativePath]),d=n.concat(u);o.children&&o.children.length>0&&($i(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),hie(o.children,e,d,f,c)),!(o.path==null&&!o.index)&&e.push({path:f,score:JDe(f,o.index),routesMeta:d})};return t.forEach((o,s)=>{if(o.path===""||!o.path?.includes("?"))a(o,s);else for(let c of gie(o.path))a(o,s,!0,c)}),e}function gie(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=gie(r.join("/")),s=[];return s.push(...o.map(c=>c===""?a:[a,c].join("/"))),i&&s.push(...o),s.map(c=>t.startsWith("/")&&c===""?"/":c)}function HDe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:eMe(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var qDe=/^:[\w-]+$/,KDe=3,YDe=2,XDe=1,ZDe=10,QDe=-2,mH=t=>t==="*";function JDe(t,e){let n=t.split("/"),r=n.length;return n.some(mH)&&(r+=QDe),e&&(r+=YDe),n.filter(i=>!mH(i)).reduce((i,a)=>i+(qDe.test(a)?KDe:a===""?XDe:ZDe),r)}function eMe(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 tMe(t,e,n=!1){let{routesMeta:r}=t,i={},a="/",o=[];for(let s=0;s<r.length;++s){let c=r[s],l=s===r.length-1,u=a==="/"?e:e.slice(a.length)||"/",f=l_({path:c.relativePath,caseSensitive:c.caseSensitive,end:l},u),d=c.route;if(!f&&l&&n&&!r[r.length-1].route.index&&(f=l_({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!f)return null;Object.assign(i,f.params),o.push({params:i,pathname:q0([a,f.pathname]),pathnameBase:sMe(q0([a,f.pathnameBase])),route:d}),f.pathnameBase!=="/"&&(a=q0([a,f.pathnameBase]))}return o}function l_(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=nMe(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,"$1"),s=i.slice(1);return{params:r.reduce((l,{paramName:u,isOptional:f},d)=>{if(u==="*"){let m=s[d]||"";o=a.slice(0,a.length-m.length).replace(/(.)\/+$/,"$1")}const h=s[d];return f&&!h?l[u]=void 0:l[u]=(h||"").replace(/%2F/g,"/"),l},{}),pathname:a,pathnameBase:o,pattern:t}}function nMe(t,e=!1,n=!0){wu(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,s,c)=>(r.push({paramName:s,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)")).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 rMe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return wu(!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 oh(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)||"/"}function iMe(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?e2(t):t;return{pathname:n?n.startsWith("/")?n:aMe(n,e):e,search:cMe(r),hash:lMe(i)}}function aMe(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 NO(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 oMe(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Zk(t){let e=oMe(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function Qk(t,e,n,r=!1){let i;typeof t=="string"?i=e2(t):(i={...t},$i(!i.pathname||!i.pathname.includes("?"),NO("?","pathname","search",i)),$i(!i.pathname||!i.pathname.includes("#"),NO("#","pathname","hash",i)),$i(!i.search||!i.search.includes("#"),NO("#","search","hash",i)));let a=t===""||i.pathname==="",o=a?"/":i.pathname,s;if(o==null)s=n;else{let f=e.length-1;if(!r&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),f-=1;i.pathname=d.join("/")}s=f>=0?e[f]:"/"}let c=iMe(i,s),l=o&&o!=="/"&&o.endsWith("/"),u=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(l||u)&&(c.pathname+="/"),c}var q0=t=>t.join("/").replace(/\/\/+/g,"/"),sMe=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),cMe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,lMe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function uMe(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}var pie=["POST","PUT","PATCH","DELETE"];new Set(pie);var fMe=["GET",...pie];new Set(fMe);var t2=D.createContext(null);t2.displayName="DataRouter";var S6=D.createContext(null);S6.displayName="DataRouterState";D.createContext(!1);var mie=D.createContext({isTransitioning:!1});mie.displayName="ViewTransition";var dMe=D.createContext(new Map);dMe.displayName="Fetchers";var hMe=D.createContext(null);hMe.displayName="Await";var wf=D.createContext(null);wf.displayName="Navigation";var ob=D.createContext(null);ob.displayName="Location";var bf=D.createContext({outlet:null,matches:[],isDataRoute:!1});bf.displayName="Route";var Jk=D.createContext(null);Jk.displayName="RouteError";function gMe(t,{relative:e}={}){$i(n2(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=D.useContext(wf),{hash:i,pathname:a,search:o}=sb(t,{relative:e}),s=a;return n!=="/"&&(s=a==="/"?n:q0([n,a])),r.createHref({pathname:s,search:o,hash:i})}function n2(){return D.useContext(ob)!=null}function Ch(){return $i(n2(),"useLocation() may be used only in the context of a <Router> component."),D.useContext(ob).location}var vie="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function yie(t){D.useContext(wf).static||D.useLayoutEffect(t)}function Sf(){let{isDataRoute:t}=D.useContext(bf);return t?DMe():pMe()}function pMe(){$i(n2(),"useNavigate() may be used only in the context of a <Router> component.");let t=D.useContext(t2),{basename:e,navigator:n}=D.useContext(wf),{matches:r}=D.useContext(bf),{pathname:i}=Ch(),a=JSON.stringify(Zk(r)),o=D.useRef(!1);return yie(()=>{o.current=!0}),D.useCallback((c,l={})=>{if(wu(o.current,vie),!o.current)return;if(typeof c=="number"){n.go(c);return}let u=Qk(c,JSON.parse(a),i,l.relative==="path");t==null&&e!=="/"&&(u.pathname=u.pathname==="/"?e:q0([e,u.pathname])),(l.replace?n.replace:n.push)(u,l.state,l)},[e,n,a,i,t])}D.createContext(null);function mMe(){let{matches:t}=D.useContext(bf),e=t[t.length-1];return e?e.params:{}}function sb(t,{relative:e}={}){let{matches:n}=D.useContext(bf),{pathname:r}=Ch(),i=JSON.stringify(Zk(n));return D.useMemo(()=>Qk(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function vMe(t,e){return xie(t,e)}function xie(t,e,n,r,i){$i(n2(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=D.useContext(wf),{matches:o}=D.useContext(bf),s=o[o.length-1],c=s?s.params:{},l=s?s.pathname:"/",u=s?s.pathnameBase:"/",f=s&&s.route;{let S=f&&f.path||"";wie(l,!f||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${S}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.

Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let d=Ch(),h;if(e){let S=typeof e=="string"?e2(e):e;$i(u==="/"||S.pathname?.startsWith(u),`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 "${u}" but pathname "${S.pathname}" was given in the \`location\` prop.`),h=S}else h=d;let m=h.pathname||"/",p=m;if(u!=="/"){let S=u.replace(/^\//,"").split("/");p="/"+m.replace(/^\//,"").split("/").slice(S.length).join("/")}let y=die(t,{pathname:p});wu(f||y!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),wu(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.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 x=SMe(y&&y.map(S=>Object.assign({},S,{params:Object.assign({},c,S.params),pathname:q0([u,a.encodeLocation?a.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?u:q0([u,a.encodeLocation?a.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),o,n,r,i);return e&&x?D.createElement(ob.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...h},navigationType:"POP"}},x):x}function yMe(){let t=OMe(),e=uMe(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},a={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=D.createElement(D.Fragment,null,D.createElement("p",null,"💿 Hey developer 👋"),D.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",D.createElement("code",{style:a},"ErrorBoundary")," or"," ",D.createElement("code",{style:a},"errorElement")," prop on your route.")),D.createElement(D.Fragment,null,D.createElement("h2",null,"Unexpected Application Error!"),D.createElement("h3",{style:{fontStyle:"italic"}},e),n?D.createElement("pre",{style:i},n):null,o)}var xMe=D.createElement(yMe,null),wMe=class extends D.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.unstable_onError?this.props.unstable_onError(t,e):console.error("React Router caught the following error during render",t)}render(){return this.state.error!==void 0?D.createElement(bf.Provider,{value:this.props.routeContext},D.createElement(Jk.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function bMe({routeContext:t,match:e,children:n}){let r=D.useContext(t2);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),D.createElement(bf.Provider,{value:t},n)}function SMe(t,e=[],n=null,r=null,i=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let a=t,o=n?.errors;if(o!=null){let l=a.findIndex(u=>u.route.id&&o?.[u.route.id]!==void 0);$i(l>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,l+1))}let s=!1,c=-1;if(n)for(let l=0;l<a.length;l++){let u=a[l];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(c=l),u.route.id){let{loaderData:f,errors:d}=n,h=u.route.loader&&!f.hasOwnProperty(u.route.id)&&(!d||d[u.route.id]===void 0);if(u.route.lazy||h){s=!0,c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}return a.reduceRight((l,u,f)=>{let d,h=!1,m=null,p=null;n&&(d=o&&u.route.id?o[u.route.id]:void 0,m=u.route.errorElement||xMe,s&&(c<0&&f===0?(wie("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,p=null):c===f&&(h=!0,p=u.route.hydrateFallbackElement||null)));let y=e.concat(a.slice(0,f+1)),x=()=>{let S;return d?S=m:h?S=p:u.route.Component?S=D.createElement(u.route.Component,null):u.route.element?S=u.route.element:S=l,D.createElement(bMe,{match:u,routeContext:{outlet:l,matches:y,isDataRoute:n!=null},children:S})};return n&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?D.createElement(wMe,{location:n.location,revalidation:n.revalidation,component:m,error:d,children:x(),routeContext:{outlet:null,matches:y,isDataRoute:!0},unstable_onError:r}):x()},null)}function eA(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function CMe(t){let e=D.useContext(t2);return $i(e,eA(t)),e}function _Me(t){let e=D.useContext(S6);return $i(e,eA(t)),e}function TMe(t){let e=D.useContext(bf);return $i(e,eA(t)),e}function tA(t){let e=TMe(t),n=e.matches[e.matches.length-1];return $i(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function EMe(){return tA("useRouteId")}function OMe(){let t=D.useContext(Jk),e=_Me("useRouteError"),n=tA("useRouteError");return t!==void 0?t:e.errors?.[n]}function DMe(){let{router:t}=CMe("useNavigate"),e=tA("useNavigate"),n=D.useRef(!1);return yie(()=>{n.current=!0}),D.useCallback(async(i,a={})=>{wu(n.current,vie),n.current&&(typeof i=="number"?t.navigate(i):await t.navigate(i,{fromRouteId:e,...a}))},[t,e])}var vH={};function wie(t,e,n){!e&&!vH[t]&&(vH[t]=!0,wu(!1,n))}D.memo(MMe);function MMe({routes:t,future:e,state:n,unstable_onError:r}){return xie(t,void 0,n,r,e)}function PO({to:t,replace:e,state:n,relative:r}){$i(n2(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=D.useContext(wf);wu(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=D.useContext(bf),{pathname:o}=Ch(),s=Sf(),c=Qk(t,Zk(a),o,r==="path"),l=JSON.stringify(c);return D.useEffect(()=>{s(JSON.parse(l),{replace:e,state:n,relative:r})},[s,l,r,e,n]),null}function bie(t){$i(!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 RMe({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:a=!1}){$i(!n2(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=t.replace(/^\/*/,"/"),s=D.useMemo(()=>({basename:o,navigator:i,static:a,future:{}}),[o,i,a]);typeof n=="string"&&(n=e2(n));let{pathname:c="/",search:l="",hash:u="",state:f=null,key:d="default"}=n,h=D.useMemo(()=>{let m=oh(c,o);return m==null?null:{location:{pathname:m,search:l,hash:u,state:f,key:d},navigationType:r}},[o,c,l,u,f,d,r]);return wu(h!=null,`<Router basename="${o}"> is not able to match the URL "${c}${l}${u}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:D.createElement(wf.Provider,{value:s},D.createElement(ob.Provider,{children:e,value:h}))}function IMe({children:t,location:e}){return vMe(VI(t),e)}function VI(t,e=[]){let n=[];return D.Children.forEach(t,(r,i)=>{if(!D.isValidElement(r))return;let a=[...e,i];if(r.type===D.Fragment){n.push.apply(n,VI(r.props.children,a));return}$i(r.type===bie,`[${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>`),$i(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,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=VI(r.props.children,a)),n.push(o)}),n}var eC="get",tC="application/x-www-form-urlencoded";function C6(t){return t!=null&&typeof t.tagName=="string"}function NMe(t){return C6(t)&&t.tagName.toLowerCase()==="button"}function PMe(t){return C6(t)&&t.tagName.toLowerCase()==="form"}function kMe(t){return C6(t)&&t.tagName.toLowerCase()==="input"}function AMe(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function LMe(t,e){return t.button===0&&(!e||e==="_self")&&!AMe(t)}function $I(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 VMe(t,e){let n=$I(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(a=>{n.append(i,a)})}),n}var k4=null;function $Me(){if(k4===null)try{new FormData(document.createElement("form"),0),k4=!1}catch{k4=!0}return k4}var jMe=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function kO(t){return t!=null&&!jMe.has(t)?(wu(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${tC}"`),null):t}function UMe(t,e){let n,r,i,a,o;if(PMe(t)){let s=t.getAttribute("action");r=s?oh(s,e):null,n=t.getAttribute("method")||eC,i=kO(t.getAttribute("enctype"))||tC,a=new FormData(t)}else if(NMe(t)||kMe(t)&&(t.type==="submit"||t.type==="image")){let s=t.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=t.getAttribute("formaction")||s.getAttribute("action");if(r=c?oh(c,e):null,n=t.getAttribute("formmethod")||s.getAttribute("method")||eC,i=kO(t.getAttribute("formenctype"))||kO(s.getAttribute("enctype"))||tC,a=new FormData(s,t),!$Me()){let{name:l,type:u,value:f}=t;if(u==="image"){let d=l?`${l}.`:"";a.append(`${d}x`,"0"),a.append(`${d}y`,"0")}else l&&a.append(l,f)}}else{if(C6(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=eC,r=null,i=tC,o=t}return a&&i==="text/plain"&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function nA(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function FMe(t,e,n){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return r.pathname==="/"?r.pathname=`_root.${n}`:e&&oh(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function BMe(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 zMe(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 GMe(t,e,n){let r=await Promise.all(t.map(async i=>{let a=e.routes[i.route.id];if(a){let o=await BMe(a,n);return o.links?o.links():[]}return[]}));return KMe(r.flat(1).filter(zMe).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function yH(t,e,n,r,i,a){let o=(c,l)=>n[l]?c.route.id!==n[l].route.id:!0,s=(c,l)=>n[l].pathname!==c.pathname||n[l].route.path?.endsWith("*")&&n[l].params["*"]!==c.params["*"];return a==="assets"?e.filter((c,l)=>o(c,l)||s(c,l)):a==="data"?e.filter((c,l)=>{let u=r.routes[c.route.id];if(!u||!u.hasLoader)return!1;if(o(c,l)||s(c,l))return!0;if(c.route.shouldRevalidate){let f=c.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function WMe(t,e,{includeHydrateFallback:n}={}){return HMe(t.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let a=[i.module];return i.clientActionModule&&(a=a.concat(i.clientActionModule)),i.clientLoaderModule&&(a=a.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(a=a.concat(i.hydrateFallbackModule)),i.imports&&(a=a.concat(i.imports)),a}).flat(1))}function HMe(t){return[...new Set(t)]}function qMe(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function KMe(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let a=JSON.stringify(qMe(i));return n.has(a)||(n.add(a),r.push({key:a,link:i})),r},[])}function Sie(){let t=D.useContext(t2);return nA(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function YMe(){let t=D.useContext(S6);return nA(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var rA=D.createContext(void 0);rA.displayName="FrameworkContext";function Cie(){let t=D.useContext(rA);return nA(t,"You must render this element inside a <HydratedRouter> element"),t}function XMe(t,e){let n=D.useContext(rA),[r,i]=D.useState(!1),[a,o]=D.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:f}=e,d=D.useRef(null);D.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let p=x=>{x.forEach(S=>{o(S.isIntersecting)})},y=new IntersectionObserver(p,{threshold:.5});return d.current&&y.observe(d.current),()=>{y.disconnect()}}},[t]),D.useEffect(()=>{if(r){let p=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(p)}}},[r]);let h=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?t!=="intent"?[a,d,{}]:[a,d,{onFocus:Px(s,h),onBlur:Px(c,m),onMouseEnter:Px(l,h),onMouseLeave:Px(u,m),onTouchStart:Px(f,h)}]:[!1,d,{}]}function Px(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function ZMe({page:t,...e}){let{router:n}=Sie(),r=D.useMemo(()=>die(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?D.createElement(JMe,{page:t,matches:r,...e}):null}function QMe(t){let{manifest:e,routeModules:n}=Cie(),[r,i]=D.useState([]);return D.useEffect(()=>{let a=!1;return GMe(t,e,n).then(o=>{a||i(o)}),()=>{a=!0}},[t,e,n]),r}function JMe({page:t,matches:e,...n}){let r=Ch(),{manifest:i,routeModules:a}=Cie(),{basename:o}=Sie(),{loaderData:s,matches:c}=YMe(),l=D.useMemo(()=>yH(t,e,c,i,r,"data"),[t,e,c,i,r]),u=D.useMemo(()=>yH(t,e,c,i,r,"assets"),[t,e,c,i,r]),f=D.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let m=new Set,p=!1;if(e.forEach(x=>{let S=i.routes[x.route.id];!S||!S.hasLoader||(!l.some(C=>C.route.id===x.route.id)&&x.route.id in s&&a[x.route.id]?.shouldRevalidate||S.hasClientLoader?p=!0:m.add(x.route.id))}),m.size===0)return[];let y=FMe(t,o,"data");return p&&m.size>0&&y.searchParams.set("_routes",e.filter(x=>m.has(x.route.id)).map(x=>x.route.id).join(",")),[y.pathname+y.search]},[o,s,r,i,l,e,t,a]),d=D.useMemo(()=>WMe(u,i),[u,i]),h=QMe(u);return D.createElement(D.Fragment,null,f.map(m=>D.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...n})),d.map(m=>D.createElement("link",{key:m,rel:"modulepreload",href:m,...n})),h.map(({key:m,link:p})=>D.createElement("link",{key:m,nonce:n.nonce,...p})))}function eRe(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var _ie=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{_ie&&(window.__reactRouterVersion="7.9.1")}catch{}function tRe({basename:t,children:e,window:n}){let r=D.useRef();r.current==null&&(r.current=FDe({window:n,v5Compat:!0}));let i=r.current,[a,o]=D.useState({action:i.action,location:i.location}),s=D.useCallback(c=>{D.startTransition(()=>o(c))},[o]);return D.useLayoutEffect(()=>i.listen(s),[i,s]),D.createElement(RMe,{basename:t,children:e,location:a.location,navigationType:a.action,navigator:i})}var Tie=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Eie=D.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:i,reloadDocument:a,replace:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:f,...d},h){let{basename:m}=D.useContext(wf),p=typeof l=="string"&&Tie.test(l),y,x=!1;if(typeof l=="string"&&p&&(y=l,_ie))try{let V=new URL(window.location.href),k=l.startsWith("//")?new URL(V.protocol+l):new URL(l),L=oh(k.pathname,m);k.origin===V.origin&&L!=null?l=L+k.search+k.hash:x=!0}catch{wu(!1,`<Link to="${l}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let S=gMe(l,{relative:i}),[C,_,T]=XMe(r,d),O=iRe(l,{replace:o,state:s,target:c,preventScrollReset:u,relative:i,viewTransition:f});function M(V){e&&e(V),V.defaultPrevented||O(V)}let I=D.createElement("a",{...d,...T,href:y||S,onClick:x||a?e:M,ref:eRe(h,_),target:c,"data-discover":!p&&n==="render"?"true":void 0});return C&&!p?D.createElement(D.Fragment,null,I,D.createElement(ZMe,{page:S})):I});Eie.displayName="Link";var Oie=D.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:a,to:o,viewTransition:s,children:c,...l},u){let f=sb(o,{relative:l.relative}),d=Ch(),h=D.useContext(S6),{navigator:m,basename:p}=D.useContext(wf),y=h!=null&&uRe(f)&&s===!0,x=m.encodeLocation?m.encodeLocation(f).pathname:f.pathname,S=d.pathname,C=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;n||(S=S.toLowerCase(),C=C?C.toLowerCase():null,x=x.toLowerCase()),C&&p&&(C=oh(C,p)||C);const _=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let T=S===x||!i&&S.startsWith(x)&&S.charAt(_)==="/",O=C!=null&&(C===x||!i&&C.startsWith(x)&&C.charAt(x.length)==="/"),M={isActive:T,isPending:O,isTransitioning:y},I=T?e:void 0,V;typeof r=="function"?V=r(M):V=[r,T?"active":null,O?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let k=typeof a=="function"?a(M):a;return D.createElement(Eie,{...l,"aria-current":I,className:V,ref:u,style:k,to:o,viewTransition:s},typeof c=="function"?c(M):c)});Oie.displayName="NavLink";var nRe=D.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:a,method:o=eC,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:f,...d},h)=>{let m=cRe(),p=lRe(s,{relative:l}),y=o.toLowerCase()==="get"?"get":"post",x=typeof s=="string"&&Tie.test(s),S=C=>{if(c&&c(C),C.defaultPrevented)return;C.preventDefault();let _=C.nativeEvent.submitter,T=_?.getAttribute("formmethod")||o;m(_||C.currentTarget,{fetcherKey:e,method:T,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:f})};return D.createElement("form",{ref:h,method:y,action:p,onSubmit:r?c:S,...d,"data-discover":!x&&t==="render"?"true":void 0})});nRe.displayName="Form";function rRe(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function Die(t){let e=D.useContext(t2);return $i(e,rRe(t)),e}function iRe(t,{target:e,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o}={}){let s=Sf(),c=Ch(),l=sb(t,{relative:a});return D.useCallback(u=>{if(LMe(u,e)){u.preventDefault();let f=n!==void 0?n:dw(c)===dw(l);s(t,{replace:f,state:r,preventScrollReset:i,relative:a,viewTransition:o})}},[c,s,l,n,r,e,t,i,a,o])}function aRe(t){wu(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=D.useRef($I(t)),n=D.useRef(!1),r=Ch(),i=D.useMemo(()=>VMe(r.search,n.current?null:e.current),[r.search]),a=Sf(),o=D.useCallback((s,c)=>{const l=$I(typeof s=="function"?s(new URLSearchParams(i)):s);n.current=!0,a("?"+l,c)},[a,i]);return[i,o]}var oRe=0,sRe=()=>`__${String(++oRe)}__`;function cRe(){let{router:t}=Die("useSubmit"),{basename:e}=D.useContext(wf),n=EMe();return D.useCallback(async(r,i={})=>{let{action:a,method:o,encType:s,formData:c,body:l}=UMe(r,e);if(i.navigate===!1){let u=i.fetcherKey||sRe();await t.fetch(u,n,i.action||a,{preventScrollReset:i.preventScrollReset,formData:c,body:l,formMethod:i.method||o,formEncType:i.encType||s,flushSync:i.flushSync})}else await t.navigate(i.action||a,{preventScrollReset:i.preventScrollReset,formData:c,body:l,formMethod:i.method||o,formEncType:i.encType||s,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[t,e,n])}function lRe(t,{relative:e}={}){let{basename:n}=D.useContext(wf),r=D.useContext(bf);$i(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),a={...sb(t||".",{relative:e})},o=Ch();if(t==null){a.search=o.search;let s=new URLSearchParams(a.search),c=s.getAll("index");if(c.some(u=>u==="")){s.delete("index"),c.filter(f=>f).forEach(f=>s.append("index",f));let u=s.toString();a.search=u?`?${u}`:""}}return(!t||t===".")&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:q0([n,a.pathname])),dw(a)}function uRe(t,{relative:e}={}){let n=D.useContext(mie);$i(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Die("useViewTransitionState"),i=sb(t,{relative:e});if(!n.isTransitioning)return!1;let a=oh(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=oh(n.nextLocation.pathname,r)||n.nextLocation.pathname;return l_(i.pathname,o)!=null||l_(i.pathname,a)!=null}const iA=D.createContext({});function cb(t){const e=D.useRef(null);return e.current===null&&(e.current=t()),e.current}const aA=typeof window<"u",oA=aA?D.useLayoutEffect:D.useEffect,_6=D.createContext(null);function sA(t,e){t.indexOf(e)===-1&&t.push(e)}function T6(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const sh=(t,e,n)=>n>e?e:n<t?t:n;let cA=()=>{};const ch={},Mie=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Rie(t){return typeof t=="object"&&t!==null}const Iie=t=>/^0[^.\s]+$/u.test(t);function lA(t){let e;return()=>(e===void 0&&(e=t()),e)}const vu=t=>t,fRe=(t,e)=>n=>e(t(n)),lb=(...t)=>t.reduce(fRe),by=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class uA{constructor(){this.subscriptions=[]}add(e){return sA(this.subscriptions,e),()=>T6(this.subscriptions,e)}notify(e,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,r);else for(let a=0;a<i;a++){const o=this.subscriptions[a];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const lf=t=>t*1e3,gu=t=>t/1e3;function Nie(t,e){return e?t*(1e3/e):0}const dRe=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t},Pie=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,hRe=1e-7,gRe=12;function pRe(t,e,n,r,i){let a,o,s=0;do o=e+(n-e)/2,a=Pie(o,r,i)-t,a>0?n=o:e=o;while(Math.abs(a)>hRe&&++s<gRe);return o}function ub(t,e,n,r){if(t===e&&n===r)return vu;const i=a=>pRe(a,0,1,t,n);return a=>a===0||a===1?a:Pie(i(a),e,r)}const kie=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Aie=t=>e=>1-t(1-e),Lie=ub(.33,1.53,.69,.99),fA=Aie(Lie),Vie=kie(fA),$ie=t=>(t*=2)<1?.5*fA(t):.5*(2-Math.pow(2,-10*(t-1))),dA=t=>1-Math.sin(Math.acos(t)),jie=Aie(dA),Uie=kie(dA),mRe=ub(.42,0,1,1),vRe=ub(0,0,.58,1),Rg=ub(.42,0,.58,1),Fie=t=>Array.isArray(t)&&typeof t[0]!="number";function Bie(t,e){return Fie(t)?t[dRe(0,t.length,e)]:t}const zie=t=>Array.isArray(t)&&typeof t[0]=="number",yRe={linear:vu,easeIn:mRe,easeInOut:Rg,easeOut:vRe,circIn:dA,circInOut:Uie,circOut:jie,backIn:fA,backInOut:Vie,backOut:Lie,anticipate:$ie},xRe=t=>typeof t=="string",xH=t=>{if(zie(t)){cA(t.length===4);const[e,n,r,i]=t;return ub(e,n,r,i)}else if(xRe(t))return yRe[t];return t},A4=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function wRe(t,e){let n=new Set,r=new Set,i=!1,a=!1;const o=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function c(u){o.has(u)&&(l.schedule(u),t()),u(s)}const l={schedule:(u,f=!1,d=!1)=>{const m=d&&i?n:r;return f&&o.add(u),m.has(u)||m.add(u),u},cancel:u=>{r.delete(u),o.delete(u)},process:u=>{if(s=u,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(c),n.clear(),i=!1,a&&(a=!1,l.process(u))}};return l}const bRe=40;function Gie(t,e){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=A4.reduce((C,_)=>(C[_]=wRe(a),C),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:f,preRender:d,render:h,postRender:m}=o,p=()=>{const C=ch.useManualTiming?i.timestamp:performance.now();n=!1,ch.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(C-i.timestamp,bRe),1)),i.timestamp=C,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),f.process(i),d.process(i),h.process(i),m.process(i),i.isProcessing=!1,n&&e&&(r=!1,t(p))},y=()=>{n=!0,r=!0,i.isProcessing||t(p)};return{schedule:A4.reduce((C,_)=>{const T=o[_];return C[_]=(O,M=!1,I=!1)=>(n||y(),T.schedule(O,M,I)),C},{}),cancel:C=>{for(let _=0;_<A4.length;_++)o[A4[_]].cancel(C)},state:i,steps:o}}const{schedule:Ii,cancel:lh,state:Xo,steps:AO}=Gie(typeof requestAnimationFrame<"u"?requestAnimationFrame:vu,!0);let nC;function SRe(){nC=void 0}const Dc={now:()=>(nC===void 0&&Dc.set(Xo.isProcessing||ch.useManualTiming?Xo.timestamp:performance.now()),nC),set:t=>{nC=t,queueMicrotask(SRe)}},Wie=t=>e=>typeof e=="string"&&e.startsWith(t),hA=Wie("--"),CRe=Wie("var(--"),gA=t=>CRe(t)?_Re.test(t.split("/*")[0].trim()):!1,_Re=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,r2={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},hw={...r2,transform:t=>sh(0,1,t)},L4={...r2,default:1},k5=t=>Math.round(t*1e5)/1e5,pA=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function TRe(t){return t==null}const ERe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,mA=(t,e)=>n=>!!(typeof n=="string"&&ERe.test(n)&&n.startsWith(t)||e&&!TRe(n)&&Object.prototype.hasOwnProperty.call(n,e)),Hie=(t,e,n)=>r=>{if(typeof r!="string")return r;const[i,a,o,s]=r.match(pA);return{[t]:parseFloat(i),[e]:parseFloat(a),[n]:parseFloat(o),alpha:s!==void 0?parseFloat(s):1}},ORe=t=>sh(0,255,t),LO={...r2,transform:t=>Math.round(ORe(t))},gm={test:mA("rgb","red"),parse:Hie("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+LO.transform(t)+", "+LO.transform(e)+", "+LO.transform(n)+", "+k5(hw.transform(r))+")"};function DRe(t){let e="",n="",r="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const jI={test:mA("#"),parse:DRe,transform:gm.transform},fb=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),ug=fb("deg"),fd=fb("%"),En=fb("px"),MRe=fb("vh"),RRe=fb("vw"),wH={...fd,parse:t=>fd.parse(t)/100,transform:t=>fd.transform(t*100)},$v={test:mA("hsl","hue"),parse:Hie("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+fd.transform(k5(e))+", "+fd.transform(k5(n))+", "+k5(hw.transform(r))+")"},Wa={test:t=>gm.test(t)||jI.test(t)||$v.test(t),parse:t=>gm.test(t)?gm.parse(t):$v.test(t)?$v.parse(t):jI.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?gm.transform(t):$v.transform(t),getAnimatableNone:t=>{const e=Wa.parse(t);return e.alpha=0,Wa.transform(e)}},IRe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function NRe(t){return isNaN(t)&&typeof t=="string"&&(t.match(pA)?.length||0)+(t.match(IRe)?.length||0)>0}const qie="number",Kie="color",PRe="var",kRe="var(",bH="${}",ARe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function gw(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},i=[];let a=0;const s=e.replace(ARe,c=>(Wa.test(c)?(r.color.push(a),i.push(Kie),n.push(Wa.parse(c))):c.startsWith(kRe)?(r.var.push(a),i.push(PRe),n.push(c)):(r.number.push(a),i.push(qie),n.push(parseFloat(c))),++a,bH)).split(bH);return{values:n,split:s,indexes:r,types:i}}function Yie(t){return gw(t).values}function Xie(t){const{split:e,types:n}=gw(t),r=e.length;return i=>{let a="";for(let o=0;o<r;o++)if(a+=e[o],i[o]!==void 0){const s=n[o];s===qie?a+=k5(i[o]):s===Kie?a+=Wa.transform(i[o]):a+=i[o]}return a}}const LRe=t=>typeof t=="number"?0:Wa.test(t)?Wa.getAnimatableNone(t):t;function VRe(t){const e=Yie(t);return Xie(t)(e.map(LRe))}const Wg={test:NRe,parse:Yie,createTransformer:Xie,getAnimatableNone:VRe};function VO(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)*(2/3-n)*6:t}function $Re({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let i=0,a=0,o=0;if(!e)i=a=o=n;else{const s=n<.5?n*(1+e):n+e-n*e,c=2*n-s;i=VO(c,s,t+1/3),a=VO(c,s,t),o=VO(c,s,t-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function u_(t,e){return n=>n>0?e:t}const Li=(t,e,n)=>t+(e-t)*n,$O=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},jRe=[jI,gm,$v],URe=t=>jRe.find(e=>e.test(t));function SH(t){const e=URe(t);if(!e)return!1;let n=e.parse(t);return e===$v&&(n=$Re(n)),n}const CH=(t,e)=>{const n=SH(t),r=SH(e);if(!n||!r)return u_(t,e);const i={...n};return a=>(i.red=$O(n.red,r.red,a),i.green=$O(n.green,r.green,a),i.blue=$O(n.blue,r.blue,a),i.alpha=Li(n.alpha,r.alpha,a),gm.transform(i))},UI=new Set(["none","hidden"]);function FRe(t,e){return UI.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function BRe(t,e){return n=>Li(t,e,n)}function vA(t){return typeof t=="number"?BRe:typeof t=="string"?gA(t)?u_:Wa.test(t)?CH:WRe:Array.isArray(t)?Zie:typeof t=="object"?Wa.test(t)?CH:zRe:u_}function Zie(t,e){const n=[...t],r=n.length,i=t.map((a,o)=>vA(a)(a,e[o]));return a=>{for(let o=0;o<r;o++)n[o]=i[o](a);return n}}function zRe(t,e){const n={...t,...e},r={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(r[i]=vA(t[i])(t[i],e[i]));return i=>{for(const a in r)n[a]=r[a](i);return n}}function GRe(t,e){const n=[],r={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],o=t.indexes[a][r[a]],s=t.values[o]??0;n[i]=s,r[a]++}return n}const WRe=(t,e)=>{const n=Wg.createTransformer(e),r=gw(t),i=gw(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?UI.has(t)&&!i.values.length||UI.has(e)&&!r.values.length?FRe(t,e):lb(Zie(GRe(r,i),i.values),n):u_(t,e)};function Qie(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Li(t,e,n):vA(t)(t,e)}const HRe=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Ii.update(e,n),stop:()=>lh(e),now:()=>Xo.isProcessing?Xo.timestamp:Dc.now()}},Jie=(t,e,n=10)=>{let r="";const i=Math.max(Math.round(e/n),2);for(let a=0;a<i;a++)r+=Math.round(t(a/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},f_=2e4;function yA(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<f_;)e+=n,r=t.next(e);return e>=f_?1/0:e}function eae(t,e=100,n){const r=n({...t,keyframes:[0,e]}),i=Math.min(yA(r),f_);return{type:"keyframes",ease:a=>r.next(i*a).value/e,duration:gu(i)}}const qRe=5;function tae(t,e,n){const r=Math.max(e-qRe,0);return Nie(n-t(r),e-r)}const da={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},jO=.001;function KRe({duration:t=da.duration,bounce:e=da.bounce,velocity:n=da.velocity,mass:r=da.mass}){let i,a,o=1-e;o=sh(da.minDamping,da.maxDamping,o),t=sh(da.minDuration,da.maxDuration,gu(t)),o<1?(i=l=>{const u=l*o,f=u*t,d=u-n,h=FI(l,o),m=Math.exp(-f);return jO-d/h*m},a=l=>{const f=l*o*t,d=f*n+n,h=Math.pow(o,2)*Math.pow(l,2)*t,m=Math.exp(-f),p=FI(Math.pow(l,2),o);return(-i(l)+jO>0?-1:1)*((d-h)*m)/p}):(i=l=>{const u=Math.exp(-l*t),f=(l-n)*t+1;return-jO+u*f},a=l=>{const u=Math.exp(-l*t),f=(n-l)*(t*t);return u*f});const s=5/t,c=XRe(i,a,s);if(t=lf(t),isNaN(c))return{stiffness:da.stiffness,damping:da.damping,duration:t};{const l=Math.pow(c,2)*r;return{stiffness:l,damping:o*2*Math.sqrt(r*l),duration:t}}}const YRe=12;function XRe(t,e,n){let r=n;for(let i=1;i<YRe;i++)r=r-t(r)/e(r);return r}function FI(t,e){return t*Math.sqrt(1-e*e)}const ZRe=["duration","bounce"],QRe=["stiffness","damping","mass"];function _H(t,e){return e.some(n=>t[n]!==void 0)}function JRe(t){let e={velocity:da.velocity,stiffness:da.stiffness,damping:da.damping,mass:da.mass,isResolvedFromDuration:!1,...t};if(!_H(t,QRe)&&_H(t,ZRe))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*sh(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:da.mass,stiffness:i,damping:a}}else{const n=KRe(t);e={...e,...n,mass:da.mass},e.isResolvedFromDuration=!0}return e}function pw(t=da.visualDuration,e=da.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:i}=n;const a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:f,velocity:d,isResolvedFromDuration:h}=JRe({...n,velocity:-gu(n.velocity||0)}),m=d||0,p=l/(2*Math.sqrt(c*u)),y=o-a,x=gu(Math.sqrt(c/u)),S=Math.abs(y)<5;r||(r=S?da.restSpeed.granular:da.restSpeed.default),i||(i=S?da.restDelta.granular:da.restDelta.default);let C;if(p<1){const T=FI(x,p);C=O=>{const M=Math.exp(-p*x*O);return o-M*((m+p*x*y)/T*Math.sin(T*O)+y*Math.cos(T*O))}}else if(p===1)C=T=>o-Math.exp(-x*T)*(y+(m+x*y)*T);else{const T=x*Math.sqrt(p*p-1);C=O=>{const M=Math.exp(-p*x*O),I=Math.min(T*O,300);return o-M*((m+p*x*y)*Math.sinh(I)+T*y*Math.cosh(I))/T}}const _={calculatedDuration:h&&f||null,next:T=>{const O=C(T);if(h)s.done=T>=f;else{let M=T===0?m:0;p<1&&(M=T===0?lf(m):tae(C,T,O));const I=Math.abs(M)<=r,V=Math.abs(o-O)<=i;s.done=I&&V}return s.value=s.done?o:O,s},toString:()=>{const T=Math.min(yA(_),f_),O=Jie(M=>_.next(T*M).value,T,30);return T+"ms "+O},toTransition:()=>{}};return _}pw.applyToOptions=t=>{const e=eae(t,100,pw);return t.ease=e.ease,t.duration=lf(e.duration),t.type="keyframes",t};function BI({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){const f=t[0],d={done:!1,value:f},h=I=>s!==void 0&&I<s||c!==void 0&&I>c,m=I=>s===void 0?c:c===void 0||Math.abs(s-I)<Math.abs(c-I)?s:c;let p=n*e;const y=f+p,x=o===void 0?y:o(y);x!==y&&(p=x-f);const S=I=>-p*Math.exp(-I/r),C=I=>x+S(I),_=I=>{const V=S(I),k=C(I);d.done=Math.abs(V)<=l,d.value=d.done?x:k};let T,O;const M=I=>{h(d.value)&&(T=I,O=pw({keyframes:[d.value,m(d.value)],velocity:tae(C,I,d.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return M(0),{calculatedDuration:null,next:I=>{let V=!1;return!O&&T===void 0&&(V=!0,_(I),M(I)),T!==void 0&&I>=T?O.next(I-T):(!V&&_(I),d)}}}function eIe(t,e,n){const r=[],i=n||ch.mix||Qie,a=t.length-1;for(let o=0;o<a;o++){let s=i(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||vu:e;s=lb(c,s)}r.push(s)}return r}function nae(t,e,{clamp:n=!0,ease:r,mixer:i}={}){const a=t.length;if(cA(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const s=eIe(e,r,i),c=s.length,l=u=>{if(o&&u<t[0])return e[0];let f=0;if(c>1)for(;f<t.length-2&&!(u<t[f+1]);f++);const d=by(t[f],t[f+1],u);return s[f](d)};return n?u=>l(sh(t[0],t[a-1],u)):l}function rae(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=by(0,e,r);t.push(Li(n,1,i))}}function iae(t){const e=[0];return rae(e,t.length-1),e}function tIe(t,e){return t.map(n=>n*e)}function nIe(t,e){return t.map(()=>e||Rg).splice(0,t.length-1)}function A5({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=Fie(r)?r.map(xH):xH(r),a={done:!1,value:e[0]},o=tIe(n&&n.length===e.length?n:iae(e),t),s=nae(o,e,{ease:Array.isArray(i)?i:nIe(e,i)});return{calculatedDuration:t,next:c=>(a.value=s(c),a.done=c>=t,a)}}const rIe=t=>t!==null;function xA(t,{repeat:e,repeatType:n="loop"},r,i=1){const a=t.filter(rIe),s=i<0||e&&n!=="loop"&&e%2===1?0:a.length-1;return!s||r===void 0?a[s]:r}const iIe={decay:BI,inertia:BI,tween:A5,keyframes:A5,spring:pw};function aae(t){typeof t.type=="string"&&(t.type=iIe[t.type])}class wA{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const aIe=t=>t/100;class bA extends wA{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==Dc.now()&&this.tick(Dc.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;aae(e);const{type:n=A5,repeat:r=0,repeatDelay:i=0,repeatType:a,velocity:o=0}=e;let{keyframes:s}=e;const c=n||A5;c!==A5&&typeof s[0]!="number"&&(this.mixKeyframes=lb(aIe,Qie(s[0],s[1])),s=[0,100]);const l=c({...e,keyframes:s});a==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...s].reverse(),velocity:-o})),l.calculatedDuration===null&&(l.calculatedDuration=yA(l));const{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=l}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:i,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:s,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:l=0,keyframes:u,repeat:f,repeatType:d,repeatDelay:h,type:m,onUpdate:p,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const x=this.currentTime-l*(this.playbackSpeed>=0?1:-1),S=this.playbackSpeed>=0?x<0:x>i;this.currentTime=Math.max(x,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let C=this.currentTime,_=r;if(f){const I=Math.min(this.currentTime,i)/s;let V=Math.floor(I),k=I%1;!k&&I>=1&&(k=1),k===1&&V--,V=Math.min(V,f+1),!!(V%2)&&(d==="reverse"?(k=1-k,h&&(k-=h/s)):d==="mirror"&&(_=o)),C=sh(0,1,k)*s}const T=S?{done:!1,value:u[0]}:_.next(C);a&&(T.value=a(T.value));let{done:O}=T;!S&&c!==null&&(O=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const M=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&O);return M&&m!==BI&&(T.value=xA(u,this.options,y,this.speed)),p&&p(T.value),M&&this.finish(),T}then(e,n){return this.finished.then(e,n)}get duration(){return gu(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+gu(e)}get time(){return gu(this.currentTime)}set time(e){e=lf(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Dc.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=gu(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=HRe,startTime:n}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Dc.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function oIe(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const pm=t=>t*180/Math.PI,zI=t=>{const e=pm(Math.atan2(t[1],t[0]));return GI(e)},sIe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:zI,rotateZ:zI,skewX:t=>pm(Math.atan(t[1])),skewY:t=>pm(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},GI=t=>(t=t%360,t<0&&(t+=360),t),TH=zI,EH=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),OH=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),cIe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:EH,scaleY:OH,scale:t=>(EH(t)+OH(t))/2,rotateX:t=>GI(pm(Math.atan2(t[6],t[5]))),rotateY:t=>GI(pm(Math.atan2(-t[2],t[0]))),rotateZ:TH,rotate:TH,skewX:t=>pm(Math.atan(t[4])),skewY:t=>pm(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function WI(t){return t.includes("scale")?1:0}function HI(t,e){if(!t||t==="none")return WI(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=cIe,i=n;else{const s=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=sIe,i=s}if(!i)return WI(e);const a=r[e],o=i[1].split(",").map(uIe);return typeof a=="function"?a(o):o[a]}const lIe=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return HI(n,e)};function uIe(t){return parseFloat(t.trim())}const i2=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],a2=new Set(i2),DH=t=>t===r2||t===En,fIe=new Set(["x","y","z"]),dIe=i2.filter(t=>!fIe.has(t));function hIe(t){const e=[];return dIe.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Om={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>HI(e,"x"),y:(t,{transform:e})=>HI(e,"y")};Om.translateX=Om.x;Om.translateY=Om.y;const Dm=new Set;let qI=!1,KI=!1,YI=!1;function oae(){if(KI){const t=Array.from(Dm).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const i=hIe(r);i.length&&(n.set(r,i),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([a,o])=>{r.getValue(a)?.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}KI=!1,qI=!1,Dm.forEach(t=>t.complete(YI)),Dm.clear()}function sae(){Dm.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(KI=!0)})}function gIe(){YI=!0,sae(),oae(),YI=!1}class SA{constructor(e,n,r,i,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=i,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Dm.add(this),qI||(qI=!0,Ii.read(sae),Ii.resolveKeyframes(oae))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:i}=this;if(e[0]===null){const a=i?.get(),o=e[e.length-1];if(a!==void 0)e[0]=a;else if(r&&n){const s=r.readValue(n,o);s!=null&&(e[0]=s)}e[0]===void 0&&(e[0]=o),i&&a===void 0&&i.set(e[0])}oIe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Dm.delete(this)}cancel(){this.state==="scheduled"&&(Dm.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const pIe=t=>t.startsWith("--");function mIe(t,e,n){pIe(e)?t.style.setProperty(e,n):t.style[e]=n}const vIe=lA(()=>window.ScrollTimeline!==void 0),yIe={};function xIe(t,e){const n=lA(t);return()=>yIe[e]??n()}const cae=xIe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),d5=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,MH={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:d5([0,.65,.55,1]),circOut:d5([.55,0,1,.45]),backIn:d5([.31,.01,.66,-.59]),backOut:d5([.33,1.53,.69,.99])};function lae(t,e){if(t)return typeof t=="function"?cae()?Jie(t,e):"ease-out":zie(t)?d5(t):Array.isArray(t)?t.map(n=>lae(n,e)||MH.easeOut):MH[t]}function wIe(t,e,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o="loop",ease:s="easeOut",times:c}={},l=void 0){const u={[e]:n};c&&(u.offset=c);const f=lae(s,i);Array.isArray(f)&&(u.easing=f);const d={delay:r,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"};return l&&(d.pseudoElement=l),t.animate(u,d)}function CA(t){return typeof t=="function"&&"applyToOptions"in t}function bIe({type:t,...e}){return CA(t)&&cae()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class SIe extends wA{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:i,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:s,onComplete:c}=e;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=e,cA(typeof e.type!="string");const l=bIe(e);this.animation=wIe(n,r,i,l,a),l.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const u=xA(i,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(u):mIe(n,r,u),this.animation.cancel()}c?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return gu(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+gu(e)}get time(){return gu(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=lf(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&vIe()?(this.animation.timeline=e,vu):n(this)}}const uae={anticipate:$ie,backInOut:Vie,circInOut:Uie};function CIe(t){return t in uae}function _Ie(t){typeof t.ease=="string"&&CIe(t.ease)&&(t.ease=uae[t.ease])}const RH=10;class TIe extends SIe{constructor(e){_Ie(e),aae(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:i,element:a,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const s=new bA({...o,autoplay:!1}),c=lf(this.finishedTime??this.time);n.setWithVelocity(s.sample(c-RH).value,s.sample(c).value,RH),s.stop()}}const IH=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Wg.test(t)||t==="0")&&!t.startsWith("url("));function EIe(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function OIe(t,e,n,r){const i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;const a=t[t.length-1],o=IH(i,e),s=IH(a,e);return!o||!s?!1:EIe(t)||(n==="spring"||CA(n))&&r}function XI(t){t.duration=0,t.type="keyframes"}const DIe=new Set(["opacity","clipPath","filter","transform"]),MIe=lA(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function RIe(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:l}=e.owner.getProps();return MIe()&&n&&DIe.has(n)&&(n!=="transform"||!l)&&!c&&!r&&i!=="mirror"&&a!==0&&o!=="inertia"}const IIe=40;class NIe extends wA{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:o="loop",keyframes:s,name:c,motionValue:l,element:u,...f}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Dc.now();const d={autoplay:e,delay:n,type:r,repeat:i,repeatDelay:a,repeatType:o,name:c,motionValue:l,element:u,...f},h=u?.KeyframeResolver||SA;this.keyframeResolver=new h(s,(m,p,y)=>this.onKeyframesResolved(m,p,d,!y),c,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,i){this.keyframeResolver=void 0;const{name:a,type:o,velocity:s,delay:c,isHandoff:l,onUpdate:u}=r;this.resolvedAt=Dc.now(),OIe(e,a,o,s)||((ch.instantAnimations||!c)&&u?.(xA(e,r,n)),e[0]=e[e.length-1],XI(r),r.repeat=0);const d={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>IIe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},h=!l&&RIe(d)?new TIe({...d,element:d.motionValue.owner.current}):new bA(d);h.finished.then(()=>this.notifyFinished()).catch(vu),this.pendingTimeline&&(this.stopTimeline=h.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=h}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),gIe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}class PIe{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=n}attachTimeline(e){const n=this.animations.map(r=>r.attachTimeline(e));return()=>{n.forEach((r,i)=>{r&&r(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return NH(this.animations,"duration")}get iterationDuration(){return NH(this.animations,"iterationDuration")}runAll(e){this.animations.forEach(n=>n[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function NH(t,e){let n=0;for(let r=0;r<t.length;r++){const i=t[r][e];i!==null&&i>n&&(n=i)}return n}class kIe extends PIe{then(e,n){return this.finished.finally(e).then(()=>{})}}const AIe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LIe(t){const e=AIe.exec(t);if(!e)return[,];const[,n,r,i]=e;return[`--${n??r}`,i]}function fae(t,e,n=1){const[r,i]=LIe(t);if(!r)return;const a=window.getComputedStyle(e).getPropertyValue(r);if(a){const o=a.trim();return Mie(o)?parseFloat(o):o}return gA(i)?fae(i,e,n+1):i}function _A(t,e){return t?.[e]??t?.default??t}const dae=new Set(["width","height","top","left","right","bottom",...i2]),VIe={test:t=>t==="auto",parse:t=>t},hae=t=>e=>e.test(t),gae=[r2,En,fd,ug,RRe,MRe,VIe],PH=t=>gae.find(hae(t));function $Ie(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Iie(t):!0}const jIe=new Set(["brightness","contrast","saturate","opacity"]);function UIe(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(pA)||[];if(!r)return t;const i=n.replace(r,"");let a=jIe.has(e)?1:0;return r!==n&&(a*=100),e+"("+a+i+")"}const FIe=/\b([a-z-]*)\(.*?\)/gu,ZI={...Wg,getAnimatableNone:t=>{const e=t.match(FIe);return e?e.map(UIe).join(" "):t}},kH={...r2,transform:Math.round},BIe={rotate:ug,rotateX:ug,rotateY:ug,rotateZ:ug,scale:L4,scaleX:L4,scaleY:L4,scaleZ:L4,skew:ug,skewX:ug,skewY:ug,distance:En,translateX:En,translateY:En,translateZ:En,x:En,y:En,z:En,perspective:En,transformPerspective:En,opacity:hw,originX:wH,originY:wH,originZ:En},TA={borderWidth:En,borderTopWidth:En,borderRightWidth:En,borderBottomWidth:En,borderLeftWidth:En,borderRadius:En,radius:En,borderTopLeftRadius:En,borderTopRightRadius:En,borderBottomRightRadius:En,borderBottomLeftRadius:En,width:En,maxWidth:En,height:En,maxHeight:En,top:En,right:En,bottom:En,left:En,padding:En,paddingTop:En,paddingRight:En,paddingBottom:En,paddingLeft:En,margin:En,marginTop:En,marginRight:En,marginBottom:En,marginLeft:En,backgroundPositionX:En,backgroundPositionY:En,...BIe,zIndex:kH,fillOpacity:hw,strokeOpacity:hw,numOctaves:kH},zIe={...TA,color:Wa,backgroundColor:Wa,outlineColor:Wa,fill:Wa,stroke:Wa,borderColor:Wa,borderTopColor:Wa,borderRightColor:Wa,borderBottomColor:Wa,borderLeftColor:Wa,filter:ZI,WebkitFilter:ZI},pae=t=>zIe[t];function mae(t,e){let n=pae(t);return n!==ZI&&(n=Wg),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const GIe=new Set(["auto","none","0"]);function WIe(t,e,n){let r=0,i;for(;r<t.length&&!i;){const a=t[r];typeof a=="string"&&!GIe.has(a)&&gw(a).values.length&&(i=t[r]),r++}if(i&&n)for(const a of e)t[a]=mae(n,i)}class HIe extends SA{constructor(e,n,r,i,a){super(e,n,r,i,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let l=e[c];if(typeof l=="string"&&(l=l.trim(),gA(l))){const u=fae(l,n.current);u!==void 0&&(e[c]=u),c===e.length-1&&(this.finalKeyframe=l)}}if(this.resolveNoneKeyframes(),!dae.has(r)||e.length!==2)return;const[i,a]=e,o=PH(i),s=PH(a);if(o!==s)if(DH(o)&&DH(s))for(let c=0;c<e.length;c++){const l=e[c];typeof l=="string"&&(e[c]=parseFloat(l))}else Om[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let i=0;i<e.length;i++)(e[i]===null||$Ie(e[i]))&&r.push(i);r.length&&WIe(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Om[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&e.getValue(r,i).jump(i,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const i=e.getValue(n);i&&i.jump(this.measuredOrigin,!1);const a=r.length-1,o=r[a];r[a]=Om[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([s,c])=>{e.getValue(s).set(c)}),this.resolveNoneKeyframes()}}function EA(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const i=n?.[t]??r.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}const vae=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function yae(t){return Rie(t)&&"offsetHeight"in t}const AH=30,qIe=t=>!isNaN(parseFloat(t)),L5={current:void 0};class KIe{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const i=Dc.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Dc.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=qIe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new uA);const r=this.events[e].add(n);return e==="change"?()=>{r(),Ii.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return L5.current&&L5.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=Dc.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>AH)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,AH);return Nie(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function zm(t,e){return new KIe(t,e)}const{schedule:OA}=Gie(queueMicrotask,!1),Gu={x:!1,y:!1};function xae(){return Gu.x||Gu.y}function YIe(t){return t==="x"||t==="y"?Gu[t]?null:(Gu[t]=!0,()=>{Gu[t]=!1}):Gu.x||Gu.y?null:(Gu.x=Gu.y=!0,()=>{Gu.x=Gu.y=!1})}function wae(t,e){const n=EA(t),r=new AbortController,i={passive:!0,...e,signal:r.signal};return[n,i,()=>r.abort()]}function LH(t){return!(t.pointerType==="touch"||xae())}function XIe(t,e,n={}){const[r,i,a]=wae(t,n),o=s=>{if(!LH(s))return;const{target:c}=s,l=e(c,s);if(typeof l!="function"||!c)return;const u=f=>{LH(f)&&(l(f),c.removeEventListener("pointerleave",u))};c.addEventListener("pointerleave",u,i)};return r.forEach(s=>{s.addEventListener("pointerenter",o,i)}),a}const bae=(t,e)=>e?t===e?!0:bae(t,e.parentElement):!1,DA=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,ZIe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function QIe(t){return ZIe.has(t.tagName)||t.tabIndex!==-1}const rC=new WeakSet;function VH(t){return e=>{e.key==="Enter"&&t(e)}}function UO(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const JIe=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=VH(()=>{if(rC.has(n))return;UO(n,"down");const i=VH(()=>{UO(n,"up")}),a=()=>UO(n,"cancel");n.addEventListener("keyup",i,e),n.addEventListener("blur",a,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function $H(t){return DA(t)&&!xae()}function eNe(t,e,n={}){const[r,i,a]=wae(t,n),o=s=>{const c=s.currentTarget;if(!$H(s))return;rC.add(c);const l=e(c,s),u=(h,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",d),rC.has(c)&&rC.delete(c),$H(h)&&typeof l=="function"&&l(h,{success:m})},f=h=>{u(h,c===window||c===document||n.useGlobalTarget||bae(c,h.target))},d=h=>{u(h,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",d,i)};return r.forEach(s=>{(n.useGlobalTarget?window:s).addEventListener("pointerdown",o,i),yae(s)&&(s.addEventListener("focus",l=>JIe(l,i)),!QIe(s)&&!s.hasAttribute("tabindex")&&(s.tabIndex=0))}),a}function MA(t){return Rie(t)&&"ownerSVGElement"in t}function Sae(t){return MA(t)&&t.tagName==="svg"}function tNe(...t){const e=!Array.isArray(t[0]),n=e?0:-1,r=t[0+n],i=t[1+n],a=t[2+n],o=t[3+n],s=nae(i,a,o);return e?s(r):s}const Io=t=>!!(t&&t.getVelocity),nNe=[...gae,Wa,Wg],rNe=t=>nNe.find(hae(t)),E6=D.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function jH(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function iNe(...t){return e=>{let n=!1;const r=t.map(i=>{const a=jH(i,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():jH(t[i],null)}}}}function aNe(...t){return D.useCallback(iNe(...t),t)}class oNe extends D.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=n.offsetParent,i=yae(r)&&r.offsetWidth||0,a=this.props.sizeRef.current;a.height=n.offsetHeight||0,a.width=n.offsetWidth||0,a.top=n.offsetTop,a.left=n.offsetLeft,a.right=i-a.width-a.left}return null}componentDidUpdate(){}render(){return this.props.children}}function sNe({children:t,isPresent:e,anchorX:n,root:r}){const i=D.useId(),a=D.useRef(null),o=D.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:s}=D.useContext(E6),c=aNe(a,t?.ref);return D.useInsertionEffect(()=>{const{width:l,height:u,top:f,left:d,right:h}=o.current;if(e||!a.current||!l||!u)return;const m=n==="left"?`left: ${d}`:`right: ${h}`;a.current.dataset.motionPopId=i;const p=document.createElement("style");s&&(p.nonce=s);const y=r??document.head;return y.appendChild(p),p.sheet&&p.sheet.insertRule(`
          [data-motion-pop-id="${i}"] {
            position: absolute !important;
            width: ${l}px !important;
            height: ${u}px !important;
            ${m}px !important;
            top: ${f}px !important;
          }
        `),()=>{y.contains(p)&&y.removeChild(p)}},[e]),w.jsx(oNe,{isPresent:e,childRef:a,sizeRef:o,children:D.cloneElement(t,{ref:c})})}const cNe=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,root:c})=>{const l=cb(lNe),u=D.useId();let f=!0,d=D.useMemo(()=>(f=!1,{id:u,initial:e,isPresent:n,custom:i,onExitComplete:h=>{l.set(h,!0);for(const m of l.values())if(!m)return;r&&r()},register:h=>(l.set(h,!1),()=>l.delete(h))}),[n,l,r]);return a&&f&&(d={...d}),D.useMemo(()=>{l.forEach((h,m)=>l.set(m,!1))},[n]),D.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),o==="popLayout"&&(t=w.jsx(sNe,{isPresent:n,anchorX:s,root:c,children:t})),w.jsx(_6.Provider,{value:d,children:t})};function lNe(){return new Map}function Cae(t=!0){const e=D.useContext(_6);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=e,a=D.useId();D.useEffect(()=>{if(t)return i(a)},[t]);const o=D.useCallback(()=>t&&r&&r(a),[a,r,t]);return!n&&r?[!1,o]:[!0]}const V4=t=>t.key||"";function UH(t){const e=[];return D.Children.forEach(t,n=>{D.isValidElement(n)&&e.push(n)}),e}const yd=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a="sync",propagate:o=!1,anchorX:s="left",root:c})=>{const[l,u]=Cae(o),f=D.useMemo(()=>UH(t),[t]),d=o&&!l?[]:f.map(V4),h=D.useRef(!0),m=D.useRef(f),p=cb(()=>new Map),[y,x]=D.useState(f),[S,C]=D.useState(f);oA(()=>{h.current=!1,m.current=f;for(let O=0;O<S.length;O++){const M=V4(S[O]);d.includes(M)?p.delete(M):p.get(M)!==!0&&p.set(M,!1)}},[S,d.length,d.join("-")]);const _=[];if(f!==y){let O=[...f];for(let M=0;M<S.length;M++){const I=S[M],V=V4(I);d.includes(V)||(O.splice(M,0,I),_.push(I))}return a==="wait"&&_.length&&(O=_),C(UH(O)),x(f),null}const{forceRender:T}=D.useContext(iA);return w.jsx(w.Fragment,{children:S.map(O=>{const M=V4(O),I=o&&!l?!1:f===S||d.includes(M),V=()=>{if(p.has(M))p.set(M,!0);else return;let k=!0;p.forEach(L=>{L||(k=!1)}),k&&(T?.(),C(m.current),o&&u?.(),r&&r())};return w.jsx(cNe,{isPresent:I,initial:!h.current||n?void 0:!1,custom:e,presenceAffectsLayout:i,mode:a,root:c,onExitComplete:I?void 0:V,anchorX:s,children:O},M)})})},_ae=D.createContext({strict:!1}),FH={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Sy={};for(const t in FH)Sy[t]={isEnabled:e=>FH[t].some(n=>!!e[n])};function uNe(t){for(const e in t)Sy[e]={...Sy[e],...t[e]}}const fNe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function d_(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||fNe.has(t)}let Tae=t=>!d_(t);function dNe(t){typeof t=="function"&&(Tae=e=>e.startsWith("on")?!d_(e):t(e))}try{dNe(require("@emotion/is-prop-valid").default)}catch{}function hNe(t,e,n){const r={};for(const i in t)i==="values"&&typeof t.values=="object"||(Tae(i)||n===!0&&d_(i)||!e&&!d_(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}const O6=D.createContext({});function D6(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function mw(t){return typeof t=="string"||Array.isArray(t)}const RA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],IA=["initial",...RA];function M6(t){return D6(t.animate)||IA.some(e=>mw(t[e]))}function Eae(t){return!!(M6(t)||t.variants)}function gNe(t,e){if(M6(t)){const{initial:n,animate:r}=t;return{initial:n===!1||mw(n)?n:void 0,animate:mw(r)?r:void 0}}return t.inherit!==!1?e:{}}function pNe(t){const{initial:e,animate:n}=gNe(t,D.useContext(O6));return D.useMemo(()=>({initial:e,animate:n}),[BH(e),BH(n)])}function BH(t){return Array.isArray(t)?t.join(" "):t}const vw={};function mNe(t){for(const e in t)vw[e]=t[e],hA(e)&&(vw[e].isCSSVariable=!0)}function Oae(t,{layout:e,layoutId:n}){return a2.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!vw[t]||t==="opacity")}const vNe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},yNe=i2.length;function xNe(t,e,n){let r="",i=!0;for(let a=0;a<yNe;a++){const o=i2[a],s=t[o];if(s===void 0)continue;let c=!0;if(typeof s=="number"?c=s===(o.startsWith("scale")?1:0):c=parseFloat(s)===0,!c||n){const l=vae(s,TA[o]);if(!c){i=!1;const u=vNe[o]||o;r+=`${u}(${l}) `}n&&(e[o]=l)}}return r=r.trim(),n?r=n(e,i?"":r):i&&(r="none"),r}function NA(t,e,n){const{style:r,vars:i,transformOrigin:a}=t;let o=!1,s=!1;for(const c in e){const l=e[c];if(a2.has(c)){o=!0;continue}else if(hA(c)){i[c]=l;continue}else{const u=vae(l,TA[c]);c.startsWith("origin")?(s=!0,a[c]=u):r[c]=u}}if(e.transform||(o||n?r.transform=xNe(e,t.transform,n):r.transform&&(r.transform="none")),s){const{originX:c="50%",originY:l="50%",originZ:u=0}=a;r.transformOrigin=`${c} ${l} ${u}`}}const PA=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Dae(t,e,n){for(const r in e)!Io(e[r])&&!Oae(r,n)&&(t[r]=e[r])}function wNe({transformTemplate:t},e){return D.useMemo(()=>{const n=PA();return NA(n,e,t),Object.assign({},n.vars,n.style)},[e])}function bNe(t,e){const n=t.style||{},r={};return Dae(r,n,t),Object.assign(r,wNe(t,e)),r}function SNe(t,e){const n={},r=bNe(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const CNe={offset:"stroke-dashoffset",array:"stroke-dasharray"},_Ne={offset:"strokeDashoffset",array:"strokeDasharray"};function TNe(t,e,n=1,r=0,i=!0){t.pathLength=1;const a=i?CNe:_Ne;t[a.offset]=En.transform(-r);const o=En.transform(e),s=En.transform(n);t[a.array]=`${o} ${s}`}function Mae(t,{attrX:e,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(NA(t,s,l),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:f,style:d}=t;f.transform&&(d.transform=f.transform,delete f.transform),(d.transform||f.transformOrigin)&&(d.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),d.transform&&(d.transformBox=u?.transformBox??"fill-box",delete f.transformBox),e!==void 0&&(f.x=e),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),i!==void 0&&TNe(f,i,a,o,!1)}const Rae=()=>({...PA(),attrs:{}}),Iae=t=>typeof t=="string"&&t.toLowerCase()==="svg";function ENe(t,e,n,r){const i=D.useMemo(()=>{const a=Rae();return Mae(a,e,Iae(r),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};Dae(a,t.style,t),i.style={...a,...i.style}}return i}const ONe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function kA(t){return typeof t!="string"||t.includes("-")?!1:!!(ONe.indexOf(t)>-1||/[A-Z]/u.test(t))}function DNe(t,e,n,{latestValues:r},i,a=!1){const s=(kA(t)?ENe:SNe)(e,r,i,t),c=hNe(e,typeof t=="string",a),l=t!==D.Fragment?{...c,...s,ref:n}:{},{children:u}=e,f=D.useMemo(()=>Io(u)?u.get():u,[u]);return D.createElement(t,{...l,children:f})}function zH(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function AA(t,e,n,r){if(typeof e=="function"){const[i,a]=zH(r);e=e(n!==void 0?n:t.custom,i,a)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,a]=zH(r);e=e(n!==void 0?n:t.custom,i,a)}return e}function iC(t){return Io(t)?t.get():t}function MNe({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,i){return{latestValues:RNe(n,r,i,t),renderState:e()}}function RNe(t,e,n,r){const i={},a=r(t,{});for(const d in a)i[d]=iC(a[d]);let{initial:o,animate:s}=t;const c=M6(t),l=Eae(t);e&&l&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),s===void 0&&(s=e.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const f=u?s:o;if(f&&typeof f!="boolean"&&!D6(f)){const d=Array.isArray(f)?f:[f];for(let h=0;h<d.length;h++){const m=AA(t,d[h]);if(m){const{transitionEnd:p,transition:y,...x}=m;for(const S in x){let C=x[S];if(Array.isArray(C)){const _=u?C.length-1:0;C=C[_]}C!==null&&(i[S]=C)}for(const S in p)i[S]=p[S]}}}return i}const Nae=t=>(e,n)=>{const r=D.useContext(O6),i=D.useContext(_6),a=()=>MNe(t,e,r,i);return n?a():cb(a)};function LA(t,e,n){const{style:r}=t,i={};for(const a in r)(Io(r[a])||e.style&&Io(e.style[a])||Oae(a,t)||n?.getValue(a)?.liveStyle!==void 0)&&(i[a]=r[a]);return i}const INe=Nae({scrapeMotionValuesFromProps:LA,createRenderState:PA});function Pae(t,e,n){const r=LA(t,e,n);for(const i in t)if(Io(t[i])||Io(e[i])){const a=i2.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[a]=t[i]}return r}const NNe=Nae({scrapeMotionValuesFromProps:Pae,createRenderState:Rae}),PNe=Symbol.for("motionComponentSymbol");function jv(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function kNe(t,e,n){return D.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):jv(n)&&(n.current=r))},[e])}const VA=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ANe="framerAppearId",kae="data-"+VA(ANe),Aae=D.createContext({});function LNe(t,e,n,r,i){const{visualElement:a}=D.useContext(O6),o=D.useContext(_ae),s=D.useContext(_6),c=D.useContext(E6).reducedMotion,l=D.useRef(null);r=r||o.renderer,!l.current&&r&&(l.current=r(t,{visualState:e,parent:a,props:n,presenceContext:s,blockInitialAnimation:s?s.initial===!1:!1,reducedMotionConfig:c}));const u=l.current,f=D.useContext(Aae);u&&!u.projection&&i&&(u.type==="html"||u.type==="svg")&&VNe(l.current,n,i,f);const d=D.useRef(!1);D.useInsertionEffect(()=>{u&&d.current&&u.update(n,s)});const h=n[kae],m=D.useRef(!!h&&!window.MotionHandoffIsComplete?.(h)&&window.MotionHasOptimisedAnimation?.(h));return oA(()=>{u&&(d.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),m.current&&u.animationState&&u.animationState.animateChanges())}),D.useEffect(()=>{u&&(!m.current&&u.animationState&&u.animationState.animateChanges(),m.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(h)}),m.current=!1),u.enteringChildren=void 0)}),u}function VNe(t,e,n,r){const{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutCrossfade:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Lae(t.parent)),t.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&jv(s),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:u,layoutScroll:c,layoutRoot:l})}function Lae(t){if(t)return t.options.allowProjection!==!1?t.projection:Lae(t.parent)}function FO(t,{forwardMotionProps:e=!1}={},n,r){n&&uNe(n);const i=kA(t)?NNe:INe;function a(s,c){let l;const u={...D.useContext(E6),...s,layoutId:$Ne(s)},{isStatic:f}=u,d=pNe(s),h=i(s,f);if(!f&&aA){jNe();const m=UNe(u);l=m.MeasureLayout,d.visualElement=LNe(t,h,u,r,m.ProjectionNode)}return w.jsxs(O6.Provider,{value:d,children:[l&&d.visualElement?w.jsx(l,{visualElement:d.visualElement,...u}):null,DNe(t,s,kNe(h,d.visualElement,c),h,f,e)]})}a.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=D.forwardRef(a);return o[PNe]=t,o}function $Ne({layoutId:t}){const e=D.useContext(iA).id;return e&&t!==void 0?e+"-"+t:t}function jNe(t,e){D.useContext(_ae).strict}function UNe(t){const{drag:e,layout:n}=Sy;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function FNe(t,e){if(typeof Proxy>"u")return FO;const n=new Map,r=(a,o)=>FO(a,o,t,e),i=(a,o)=>r(a,o);return new Proxy(i,{get:(a,o)=>o==="create"?r:(n.has(o)||n.set(o,FO(o,void 0,t,e)),n.get(o))})}function Vae({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function BNe({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function zNe(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function BO(t){return t===void 0||t===1}function QI({scale:t,scaleX:e,scaleY:n}){return!BO(t)||!BO(e)||!BO(n)}function Qp(t){return QI(t)||$ae(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function $ae(t){return GH(t.x)||GH(t.y)}function GH(t){return t&&t!=="0%"}function h_(t,e,n){const r=t-n,i=e*r;return n+i}function WH(t,e,n,r,i){return i!==void 0&&(t=h_(t,i,r)),h_(t,n,r)+e}function JI(t,e=0,n=1,r,i){t.min=WH(t.min,e,n,r,i),t.max=WH(t.max,e,n,r,i)}function jae(t,{x:e,y:n}){JI(t.x,e.translate,e.scale,e.originPoint),JI(t.y,n.translate,n.scale,n.originPoint)}const HH=.999999999999,qH=1.0000000000001;function GNe(t,e,n,r=!1){const i=n.length;if(!i)return;e.x=e.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;const{visualElement:c}=a.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&Fv(t,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,jae(t,o)),r&&Qp(a.latestValues)&&Fv(t,a.latestValues))}e.x<qH&&e.x>HH&&(e.x=1),e.y<qH&&e.y>HH&&(e.y=1)}function Uv(t,e){t.min=t.min+e,t.max=t.max+e}function KH(t,e,n,r,i=.5){const a=Li(t.min,t.max,i);JI(t,e,n,a,r)}function Fv(t,e){KH(t.x,e.x,e.scaleX,e.scale,e.originX),KH(t.y,e.y,e.scaleY,e.scale,e.originY)}function Uae(t,e){return Vae(zNe(t.getBoundingClientRect(),e))}function WNe(t,e,n){const r=Uae(t,n),{scroll:i}=e;return i&&(Uv(r.x,i.offset.x),Uv(r.y,i.offset.y)),r}const YH=()=>({translate:0,scale:1,origin:0,originPoint:0}),Bv=()=>({x:YH(),y:YH()}),XH=()=>({min:0,max:0}),fa=()=>({x:XH(),y:XH()}),eN={current:null},Fae={current:!1};function HNe(){if(Fae.current=!0,!!aA)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>eN.current=t.matches;t.addEventListener("change",e),e()}else eN.current=!1}const yw=new WeakMap;function qNe(t,e,n){for(const r in e){const i=e[r],a=n[r];if(Io(i))t.addValue(r,i);else if(Io(a))t.addValue(r,zm(i,{owner:t}));else if(a!==i)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(r);t.addValue(r,zm(o!==void 0?o:i,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const ZH=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Bae{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=SA,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const d=Dc.now();this.renderScheduledAt<d&&(this.renderScheduledAt=d,Ii.render(this.render,!1,!0))};const{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=M6(n),this.isVariantNode=Eae(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const d in f){const h=f[d];c[d]!==void 0&&Io(h)&&h.set(c[d])}}mount(e){this.current=e,yw.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),Fae.current||HNe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:eN.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),lh(this.notifyUpdate),lh(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=a2.has(e);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Ii.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{i(),a&&a(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Sy){const n=Sy[e];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[e]&&i&&r(this.props)&&(this.features[e]=new i(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):fa()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<ZH.length;r++){const i=ZH[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const a="on"+i,o=e[a];o&&(this.propEventSubscriptions[i]=this.on(i,o))}this.prevMotionValues=qNe(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=zm(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(Mie(r)||Iie(r))?r=parseFloat(r):!rNe(r)&&Wg.test(n)&&(r=mae(e,n)),this.setBaseTarget(e,Io(r)?r.get():r)),Io(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const a=AA(this.props,n,this.presenceContext?.custom);a&&(r=a[e])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Io(i)?i:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new uA),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){OA.render(this.render)}}class zae extends Bae{constructor(){super(...arguments),this.KeyframeResolver=HIe}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Io(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Gae(t,{style:e,vars:n},r,i){const a=t.style;let o;for(o in e)a[o]=e[o];i?.applyProjectionStyles(a,r);for(o in n)a.setProperty(o,n[o])}function KNe(t){return window.getComputedStyle(t)}class Wae extends zae{constructor(){super(...arguments),this.type="html",this.renderInstance=Gae}readValueFromInstance(e,n){if(a2.has(n))return this.projection?.isProjecting?WI(n):lIe(e,n);{const r=KNe(e),i=(hA(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Uae(e,n)}build(e,n,r){NA(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return LA(e,n,r)}}const Hae=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function YNe(t,e,n,r){Gae(t,e,void 0,r);for(const i in e.attrs)t.setAttribute(Hae.has(i)?i:VA(i),e.attrs[i])}class qae extends zae{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=fa}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(a2.has(n)){const r=pae(n);return r&&r.default||0}return n=Hae.has(n)?n:VA(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return Pae(e,n,r)}build(e,n,r){Mae(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,i){YNe(e,n,r,i)}mount(e){this.isSVGTag=Iae(e.tagName),super.mount(e)}}const XNe=(t,e)=>kA(t)?new qae(e):new Wae(e,{allowProjection:t!==D.Fragment});function ry(t,e,n){const r=t.getProps();return AA(r,e,n!==void 0?n:r.custom,t)}const tN=t=>Array.isArray(t);function ZNe(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,zm(n))}function QNe(t){return tN(t)?t[t.length-1]||0:t}function JNe(t,e){const n=ry(t,e);let{transitionEnd:r={},transition:i={},...a}=n||{};a={...a,...r};for(const o in a){const s=QNe(a[o]);ZNe(t,o,s)}}function ePe(t){return!!(Io(t)&&t.add)}function nN(t,e){const n=t.getValue("willChange");if(ePe(n))return n.add(e);if(!n&&ch.WillChange){const r=new ch.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function Kae(t){return t.props[kae]}const tPe=t=>t!==null;function nPe(t,{repeat:e,repeatType:n="loop"},r){const i=t.filter(tPe),a=e&&n!=="loop"&&e%2===1?0:i.length-1;return i[a]}const rPe={type:"spring",stiffness:500,damping:25,restSpeed:10},iPe=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),aPe={type:"keyframes",duration:.8},oPe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},sPe=(t,{keyframes:e})=>e.length>2?aPe:a2.has(t)?t.startsWith("scale")?iPe(e[1]):rPe:oPe;function cPe({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:s,from:c,elapsed:l,...u}){return!!Object.keys(u).length}const $A=(t,e,n,r={},i,a)=>o=>{const s=_A(r,t)||{},c=s.delay||r.delay||0;let{elapsed:l=0}=r;l=l-lf(c);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...s,delay:-l,onUpdate:d=>{e.set(d),s.onUpdate&&s.onUpdate(d)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:t,motionValue:e,element:a?void 0:i};cPe(s)||Object.assign(u,sPe(t,u)),u.duration&&(u.duration=lf(u.duration)),u.repeatDelay&&(u.repeatDelay=lf(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let f=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(XI(u),u.delay===0&&(f=!0)),(ch.instantAnimations||ch.skipAnimations)&&(f=!0,XI(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,f&&!a&&e.get()!==void 0){const d=nPe(u.keyframes,s);if(d!==void 0){Ii.update(()=>{u.onUpdate(d),u.onComplete()});return}}return s.isSync?new bA(u):new NIe(u)};function lPe({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function jA(t,e,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a=t.getDefaultTransition(),transitionEnd:o,...s}=e;r&&(a=r);const c=[],l=i&&t.animationState&&t.animationState.getState()[i];for(const u in s){const f=t.getValue(u,t.latestValues[u]??null),d=s[u];if(d===void 0||l&&lPe(l,u))continue;const h={delay:n,..._A(a||{},u)},m=f.get();if(m!==void 0&&!f.isAnimating&&!Array.isArray(d)&&d===m&&!h.velocity)continue;let p=!1;if(window.MotionHandoffAnimation){const x=Kae(t);if(x){const S=window.MotionHandoffAnimation(x,u,Ii);S!==null&&(h.startTime=S,p=!0)}}nN(t,u),f.start($A(u,f,d,t.shouldReduceMotion&&dae.has(u)?{type:!1}:h,t,p));const y=f.animation;y&&c.push(y)}return o&&Promise.all(c).then(()=>{Ii.update(()=>{o&&JNe(t,o)})}),c}function Yae(t,e,n,r=0,i=1){const a=Array.from(t).sort((l,u)=>l.sortNodePosition(u)).indexOf(e),o=t.size,s=(o-1)*r;return typeof n=="function"?n(a,o):i===1?a*r:s-a*r}function rN(t,e,n={}){const r=ry(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const a=r?()=>Promise.all(jA(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:l=0,staggerChildren:u,staggerDirection:f}=i;return uPe(t,e,c,l,u,f,n)}:()=>Promise.resolve(),{when:s}=i;if(s){const[c,l]=s==="beforeChildren"?[a,o]:[o,a];return c().then(()=>l())}else return Promise.all([a(),o(n.delay)])}function uPe(t,e,n=0,r=0,i=0,a=1,o){const s=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),s.push(rN(c,e,{...o,delay:n+(typeof r=="function"?0:r)+Yae(t.variantChildren,c,r,i,a)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(s)}function fPe(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const i=e.map(a=>rN(t,a,n));r=Promise.all(i)}else if(typeof e=="string")r=rN(t,e,n);else{const i=typeof e=="function"?ry(t,e,n.custom):e;r=Promise.all(jA(t,i,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function Xae(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const dPe=IA.length;function Zae(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?Zae(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<dPe;n++){const r=IA[n],i=t.props[r];(mw(i)||i===!1)&&(e[r]=i)}return e}const hPe=[...RA].reverse(),gPe=RA.length;function pPe(t){return e=>Promise.all(e.map(({animation:n,options:r})=>fPe(t,n,r)))}function mPe(t){let e=pPe(t),n=QH(),r=!0;const i=c=>(l,u)=>{const f=ry(t,u,c==="exit"?t.presenceContext?.custom:void 0);if(f){const{transition:d,transitionEnd:h,...m}=f;l={...l,...m,...h}}return l};function a(c){e=c(t)}function o(c){const{props:l}=t,u=Zae(t.parent)||{},f=[],d=new Set;let h={},m=1/0;for(let y=0;y<gPe;y++){const x=hPe[y],S=n[x],C=l[x]!==void 0?l[x]:u[x],_=mw(C),T=x===c?S.isActive:null;T===!1&&(m=y);let O=C===u[x]&&C!==l[x]&&_;if(O&&r&&t.manuallyAnimateOnMount&&(O=!1),S.protectedKeys={...h},!S.isActive&&T===null||!C&&!S.prevProp||D6(C)||typeof C=="boolean")continue;const M=vPe(S.prevProp,C);let I=M||x===c&&S.isActive&&!O&&_||y>m&&_,V=!1;const k=Array.isArray(C)?C:[C];let L=k.reduce(i(x),{});T===!1&&(L={});const{prevResolvedValues:$={}}=S,W={...$,...L},G=Y=>{I=!0,d.has(Y)&&(V=!0,d.delete(Y)),S.needsAnimating[Y]=!0;const J=t.getValue(Y);J&&(J.liveStyle=!1)};for(const Y in W){const J=L[Y],ne=$[Y];if(h.hasOwnProperty(Y))continue;let F=!1;tN(J)&&tN(ne)?F=!Xae(J,ne):F=J!==ne,F?J!=null?G(Y):d.add(Y):J!==void 0&&d.has(Y)?G(Y):S.protectedKeys[Y]=!0}S.prevProp=C,S.prevResolvedValues=L,S.isActive&&(h={...h,...L}),r&&t.blockInitialAnimation&&(I=!1);const oe=O&&M;I&&(!oe||V)&&f.push(...k.map(Y=>{const J={type:x};if(typeof Y=="string"&&r&&!oe&&t.manuallyAnimateOnMount&&t.parent){const{parent:ne}=t,F=ry(ne,Y);if(ne.enteringChildren&&F){const{delayChildren:ae}=F.transition||{};J.delay=Yae(ne.enteringChildren,t,ae)}}return{animation:Y,options:J}}))}if(d.size){const y={};if(typeof l.initial!="boolean"){const x=ry(t,Array.isArray(l.initial)?l.initial[0]:l.initial);x&&x.transition&&(y.transition=x.transition)}d.forEach(x=>{const S=t.getBaseTarget(x),C=t.getValue(x);C&&(C.liveStyle=!0),y[x]=S??null}),f.push({animation:y})}let p=!!f.length;return r&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(p=!1),r=!1,p?e(f):Promise.resolve()}function s(c,l){if(n[c].isActive===l)return Promise.resolve();t.variantChildren?.forEach(f=>f.animationState?.setActive(c,l)),n[c].isActive=l;const u=o(c);for(const f in n)n[f].protectedKeys={};return u}return{animateChanges:o,setActive:s,setAnimateFunction:a,getState:()=>n,reset:()=>{n=QH(),r=!0}}}function vPe(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Xae(e,t):!1}function $p(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function QH(){return{animate:$p(!0),whileInView:$p(),whileHover:$p(),whileTap:$p(),whileDrag:$p(),whileFocus:$p(),exit:$p()}}class fp{constructor(e){this.isMounted=!1,this.node=e}update(){}}class yPe extends fp{constructor(e){super(e),e.animationState||(e.animationState=mPe(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();D6(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let xPe=0;class wPe extends fp{constructor(){super(...arguments),this.id=xPe++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const i=this.node.animationState.setActive("exit",!e);n&&!e&&i.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const bPe={animation:{Feature:yPe},exit:{Feature:wPe}};function xw(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function db(t){return{point:{x:t.pageX,y:t.pageY}}}const SPe=t=>e=>DA(e)&&t(e,db(e));function V5(t,e,n,r){return xw(t,e,SPe(n),r)}const Qae=1e-4,CPe=1-Qae,_Pe=1+Qae,Jae=.01,TPe=0-Jae,EPe=0+Jae;function Zs(t){return t.max-t.min}function OPe(t,e,n){return Math.abs(t-e)<=n}function JH(t,e,n,r=.5){t.origin=r,t.originPoint=Li(e.min,e.max,t.origin),t.scale=Zs(n)/Zs(e),t.translate=Li(n.min,n.max,t.origin)-t.originPoint,(t.scale>=CPe&&t.scale<=_Pe||isNaN(t.scale))&&(t.scale=1),(t.translate>=TPe&&t.translate<=EPe||isNaN(t.translate))&&(t.translate=0)}function $5(t,e,n,r){JH(t.x,e.x,n.x,r?r.originX:void 0),JH(t.y,e.y,n.y,r?r.originY:void 0)}function eq(t,e,n){t.min=n.min+e.min,t.max=t.min+Zs(e)}function DPe(t,e,n){eq(t.x,e.x,n.x),eq(t.y,e.y,n.y)}function tq(t,e,n){t.min=e.min-n.min,t.max=t.min+Zs(e)}function j5(t,e,n){tq(t.x,e.x,n.x),tq(t.y,e.y,n.y)}function ou(t){return[t("x"),t("y")]}const eoe=({current:t})=>t?t.ownerDocument.defaultView:null,nq=(t,e)=>Math.abs(t-e);function MPe(t,e){const n=nq(t.x,e.x),r=nq(t.y,e.y);return Math.sqrt(n**2+r**2)}class toe{constructor(e,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:a=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const d=GO(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,m=MPe(d.offset,{x:0,y:0})>=this.distanceThreshold;if(!h&&!m)return;const{point:p}=d,{timestamp:y}=Xo;this.history.push({...p,timestamp:y});const{onStart:x,onMove:S}=this.handlers;h||(x&&x(this.lastMoveEvent,d),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,d)},this.handlePointerMove=(d,h)=>{this.lastMoveEvent=d,this.lastMoveEventInfo=zO(h,this.transformPagePoint),Ii.update(this.updatePoint,!0)},this.handlePointerUp=(d,h)=>{this.end();const{onEnd:m,onSessionEnd:p,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=GO(d.type==="pointercancel"?this.lastMoveEventInfo:zO(h,this.transformPagePoint),this.history);this.startEvent&&m&&m(d,x),p&&p(d,x)},!DA(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=i||window;const s=db(e),c=zO(s,this.transformPagePoint),{point:l}=c,{timestamp:u}=Xo;this.history=[{...l,timestamp:u}];const{onSessionStart:f}=n;f&&f(e,GO(c,this.history)),this.removeListeners=lb(V5(this.contextWindow,"pointermove",this.handlePointerMove),V5(this.contextWindow,"pointerup",this.handlePointerUp),V5(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),lh(this.updatePoint)}}function zO(t,e){return e?{point:e(t.point)}:t}function rq(t,e){return{x:t.x-e.x,y:t.y-e.y}}function GO({point:t},e){return{point:t,delta:rq(t,noe(e)),offset:rq(t,RPe(e)),velocity:IPe(e,.1)}}function RPe(t){return t[0]}function noe(t){return t[t.length-1]}function IPe(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const i=noe(t);for(;n>=0&&(r=t[n],!(i.timestamp-r.timestamp>lf(e)));)n--;if(!r)return{x:0,y:0};const a=gu(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function NPe(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Li(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Li(n,t,r.max):Math.min(t,n)),t}function iq(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function PPe(t,{top:e,left:n,bottom:r,right:i}){return{x:iq(t.x,n,i),y:iq(t.y,e,r)}}function aq(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function kPe(t,e){return{x:aq(t.x,e.x),y:aq(t.y,e.y)}}function APe(t,e){let n=.5;const r=Zs(t),i=Zs(e);return i>r?n=by(e.min,e.max-r,t.min):r>i&&(n=by(t.min,t.max-i,e.min)),sh(0,1,n)}function LPe(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const iN=.35;function VPe(t=iN){return t===!1?t=0:t===!0&&(t=iN),{x:oq(t,"left","right"),y:oq(t,"top","bottom")}}function oq(t,e,n){return{min:sq(t,e),max:sq(t,n)}}function sq(t,e){return typeof t=="number"?t:t[e]||0}const $Pe=new WeakMap;class jPe{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=fa(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const a=f=>{const{dragSnapToOrigin:d}=this.getProps();d?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(db(f).point)},o=(f,d)=>{const{drag:h,dragPropagation:m,onDragStart:p}=this.getProps();if(h&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=YIe(h),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=d,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ou(x=>{let S=this.getAxisMotionValue(x).get()||0;if(fd.test(S)){const{projection:C}=this.visualElement;if(C&&C.layout){const _=C.layout.layoutBox[x];_&&(S=Zs(_)*(parseFloat(S)/100))}}this.originPoint[x]=S}),p&&Ii.postRender(()=>p(f,d)),nN(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},s=(f,d)=>{this.latestPointerEvent=f,this.latestPanInfo=d;const{dragPropagation:h,dragDirectionLock:m,onDirectionLock:p,onDrag:y}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:x}=d;if(m&&this.currentDirection===null){this.currentDirection=UPe(x),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",d.point,x),this.updateAxis("y",d.point,x),this.visualElement.render(),y&&y(f,d)},c=(f,d)=>{this.latestPointerEvent=f,this.latestPanInfo=d,this.stop(f,d),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>ou(f=>this.getAnimationState(f)==="paused"&&this.getAxisMotionValue(f).animation?.play()),{dragSnapToOrigin:u}=this.getProps();this.panSession=new toe(e,{onSessionStart:a,onStart:o,onMove:s,onSessionEnd:c,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:r,contextWindow:eoe(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,i=n||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!i||!r)return;const{velocity:o}=i;this.startAnimation(o);const{onDragEnd:s}=this.getProps();s&&Ii.postRender(()=>s(r,i))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:i}=this.getProps();if(!r||!$4(e,i,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=NPe(o,this.constraints[e],this.elastic[e])),a.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;e&&jv(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=PPe(r.layoutBox,e):this.constraints=!1,this.elastic=VPe(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&ou(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=LPe(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!jv(e))return!1;const r=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const a=WNe(r,i.root,this.visualElement.getTransformPagePoint());let o=kPe(i.layout.layoutBox,a);if(n){const s=n(BNe(o));this.hasMutatedConstraints=!!s,s&&(o=Vae(s))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),c=this.constraints||{},l=ou(u=>{if(!$4(u,n,this.currentDirection))return;let f=c&&c[u]||{};o&&(f={min:0,max:0});const d=i?200:1e6,h=i?40:1e7,m={type:"inertia",velocity:r?e[u]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...a,...f};return this.startAxisValueAnimation(u,m)});return Promise.all(l).then(s)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return nN(this.visualElement,e),r.start($A(e,r,0,n,this.visualElement,!1))}stopAnimation(){ou(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ou(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){ou(n=>{const{drag:r}=this.getProps();if(!$4(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,a=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:s}=i.layout.layoutBox[n];a.set(e[n]-Li(o,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!jv(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};ou(o=>{const s=this.getAxisMotionValue(o);if(s&&this.constraints!==!1){const c=s.get();i[o]=APe({min:c,max:c},this.constraints[o])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ou(o=>{if(!$4(o,e,null))return;const s=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];s.set(Li(c,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;$Pe.set(this.visualElement,this);const e=this.visualElement.current,n=V5(e,"pointerdown",c=>{const{drag:l,dragListener:u=!0}=this.getProps();l&&u&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();jv(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,a=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Ii.read(r);const o=xw(window,"resize",()=>this.scalePositionWithinConstraints()),s=i.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(ou(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())}));return()=>{o(),n(),a(),s&&s()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:a=!1,dragElastic:o=iN,dragMomentum:s=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:a,dragElastic:o,dragMomentum:s}}}function $4(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function UPe(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class FPe extends fp{constructor(e){super(e),this.removeGroupControls=vu,this.removeListeners=vu,this.controls=new jPe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||vu}unmount(){this.removeGroupControls(),this.removeListeners()}}const cq=t=>(e,n)=>{t&&Ii.postRender(()=>t(e,n))};class BPe extends fp{constructor(){super(...arguments),this.removePointerDownListener=vu}onPointerDown(e){this.session=new toe(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:eoe(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:cq(e),onStart:cq(n),onMove:r,onEnd:(a,o)=>{delete this.session,i&&Ii.postRender(()=>i(a,o))}}}mount(){this.removePointerDownListener=V5(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const aC={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function lq(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const kx={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(En.test(t))t=parseFloat(t);else return t;const n=lq(t,e.target.x),r=lq(t,e.target.y);return`${n}% ${r}%`}},zPe={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=Wg.parse(t);if(i.length>5)return r;const a=Wg.createTransformer(t),o=typeof i[0]!="number"?1:0,s=n.x.scale*e.x,c=n.y.scale*e.y;i[0+o]/=s,i[1+o]/=c;const l=Li(s,c,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),a(i)}};let WO=!1;class GPe extends D.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:a}=e;mNe(WPe),a&&(n.group&&n.group.add(a),r&&r.register&&i&&r.register(a),WO&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),aC.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:i,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,WO=!0,i||e.layoutDependency!==n||n===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||Ii.postRender(()=>{const s=o.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),OA.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=e;WO=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function roe(t){const[e,n]=Cae(),r=D.useContext(iA);return w.jsx(GPe,{...t,layoutGroup:r,switchLayoutGroup:D.useContext(Aae),isPresent:e,safeToRemove:n})}const WPe={borderRadius:{...kx,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:kx,borderTopRightRadius:kx,borderBottomLeftRadius:kx,borderBottomRightRadius:kx,boxShadow:zPe};function ioe(t,e,n){const r=Io(t)?t:zm(t);return r.start($A("",r,e,n)),r.animation}const HPe=(t,e)=>t.depth-e.depth;class qPe{constructor(){this.children=[],this.isDirty=!1}add(e){sA(this.children,e),this.isDirty=!0}remove(e){T6(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(HPe),this.isDirty=!1,this.children.forEach(e)}}function KPe(t,e){const n=Dc.now(),r=({timestamp:i})=>{const a=i-n;a>=e&&(lh(r),t(a-e))};return Ii.setup(r,!0),()=>lh(r)}const aoe=["TopLeft","TopRight","BottomLeft","BottomRight"],YPe=aoe.length,uq=t=>typeof t=="string"?parseFloat(t):t,fq=t=>typeof t=="number"||En.test(t);function XPe(t,e,n,r,i,a){i?(t.opacity=Li(0,n.opacity??1,ZPe(r)),t.opacityExit=Li(e.opacity??1,0,QPe(r))):a&&(t.opacity=Li(e.opacity??1,n.opacity??1,r));for(let o=0;o<YPe;o++){const s=`border${aoe[o]}Radius`;let c=dq(e,s),l=dq(n,s);if(c===void 0&&l===void 0)continue;c||(c=0),l||(l=0),c===0||l===0||fq(c)===fq(l)?(t[s]=Math.max(Li(uq(c),uq(l),r),0),(fd.test(l)||fd.test(c))&&(t[s]+="%")):t[s]=l}(e.rotate||n.rotate)&&(t.rotate=Li(e.rotate||0,n.rotate||0,r))}function dq(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const ZPe=ooe(0,.5,jie),QPe=ooe(.5,.95,vu);function ooe(t,e,n){return r=>r<t?0:r>e?1:n(by(t,e,r))}function hq(t,e){t.min=e.min,t.max=e.max}function Ql(t,e){hq(t.x,e.x),hq(t.y,e.y)}function gq(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function pq(t,e,n,r,i){return t-=e,t=h_(t,1/n,r),i!==void 0&&(t=h_(t,1/i,r)),t}function JPe(t,e=0,n=1,r=.5,i,a=t,o=t){if(fd.test(e)&&(e=parseFloat(e),e=Li(o.min,o.max,e/100)-o.min),typeof e!="number")return;let s=Li(a.min,a.max,r);t===a&&(s-=e),t.min=pq(t.min,e,n,s,i),t.max=pq(t.max,e,n,s,i)}function mq(t,e,[n,r,i],a,o){JPe(t,e[n],e[r],e[i],e.scale,a,o)}const eke=["x","scaleX","originX"],tke=["y","scaleY","originY"];function vq(t,e,n,r){mq(t.x,e,eke,n?n.x:void 0,r?r.x:void 0),mq(t.y,e,tke,n?n.y:void 0,r?r.y:void 0)}function yq(t){return t.translate===0&&t.scale===1}function soe(t){return yq(t.x)&&yq(t.y)}function xq(t,e){return t.min===e.min&&t.max===e.max}function nke(t,e){return xq(t.x,e.x)&&xq(t.y,e.y)}function wq(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function coe(t,e){return wq(t.x,e.x)&&wq(t.y,e.y)}function bq(t){return Zs(t.x)/Zs(t.y)}function Sq(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class rke{constructor(){this.members=[]}add(e){sA(this.members,e),e.scheduleRender()}remove(e){if(T6(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(i=>e===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const a=this.members[i];if(a.isPresent!==!1){r=a;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function ike(t,e,n){let r="";const i=t.x.translate/e.x,a=t.y.translate/e.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:l,rotate:u,rotateX:f,rotateY:d,skewX:h,skewY:m}=n;l&&(r=`perspective(${l}px) ${r}`),u&&(r+=`rotate(${u}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),h&&(r+=`skewX(${h}deg) `),m&&(r+=`skewY(${m}deg) `)}const s=t.x.scale*e.x,c=t.y.scale*e.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||"none"}const HO=["","X","Y","Z"],ake=1e3;let oke=0;function qO(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function loe(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Kae(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Ii,!(i||a))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&loe(r)}function uoe({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(o={},s=e?.()){this.id=oke++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(lke),this.nodes.forEach(hke),this.nodes.forEach(gke),this.nodes.forEach(uke)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new qPe)}addEventListener(o,s){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new uA),this.eventHandlers.get(o).add(s)}notifyListeners(o,...s){const c=this.eventHandlers.get(o);c&&c.notify(...s)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=MA(o)&&!Sae(o),this.instance=o;const{layoutId:s,layout:c,visualElement:l}=this.options;if(l&&!l.current&&l.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||s)&&(this.isLayoutDirty=!0),t){let u,f=0;const d=()=>this.root.updateBlockedByResize=!1;Ii.read(()=>{f=window.innerWidth}),t(o,()=>{const h=window.innerWidth;h!==f&&(f=h,this.root.updateBlockedByResize=!0,u&&u(),u=KPe(d,250),aC.hasAnimatedSinceResize&&(aC.hasAnimatedSinceResize=!1,this.nodes.forEach(Tq)))})}s&&this.root.registerSharedNode(s,this),this.options.animate!==!1&&l&&(s||c)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:f,hasRelativeLayoutChanged:d,layout:h})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||l.getDefaultTransition()||xke,{onLayoutAnimationStart:p,onLayoutAnimationComplete:y}=l.getProps(),x=!this.targetLayout||!coe(this.targetLayout,h),S=!f&&d;if(this.options.layoutRoot||this.resumeFrom||S||f&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={..._A(m,"layout"),onPlay:p,onComplete:y};(l.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(u,S)}else f||Tq(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=h})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),lh(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(pke),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&loe(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const f=this.path[u];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:s,layout:c}=this.options;if(s===void 0&&!c)return;const l=this.getTransformTemplate();this.prevTransformTemplateValue=l?l(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Cq);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(_q);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(dke),this.nodes.forEach(ske),this.nodes.forEach(cke)):this.nodes.forEach(_q),this.clearAllSnapshots();const s=Dc.now();Xo.delta=sh(0,1e3/60,s-Xo.timestamp),Xo.timestamp=s,Xo.isProcessing=!0,AO.update.process(Xo),AO.preRender.process(Xo),AO.render.process(Xo),Xo.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,OA.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(fke),this.sharedNodes.forEach(mke)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ii.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ii.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Zs(this.snapshot.measuredBox.x)&&!Zs(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=fa(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:s}=this.options;s&&s.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let s=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(s=!1),s&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!i)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,s=this.projectionDelta&&!soe(this.projectionDelta),c=this.getTransformTemplate(),l=c?c(this.latestValues,""):void 0,u=l!==this.prevTransformTemplateValue;o&&this.instance&&(s||Qp(this.latestValues)||u)&&(i(this.instance,l),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const s=this.measurePageBox();let c=this.removeElementScroll(s);return o&&(c=this.removeTransform(c)),wke(c),{animationId:this.root.animationId,measuredBox:s,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return fa();const s=o.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(bke))){const{scroll:l}=this.root;l&&(Uv(s.x,l.offset.x),Uv(s.y,l.offset.y))}return s}removeElementScroll(o){const s=fa();if(Ql(s,o),this.scroll?.wasRoot)return s;for(let c=0;c<this.path.length;c++){const l=this.path[c],{scroll:u,options:f}=l;l!==this.root&&u&&f.layoutScroll&&(u.wasRoot&&Ql(s,o),Uv(s.x,u.offset.x),Uv(s.y,u.offset.y))}return s}applyTransform(o,s=!1){const c=fa();Ql(c,o);for(let l=0;l<this.path.length;l++){const u=this.path[l];!s&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Fv(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),Qp(u.latestValues)&&Fv(c,u.latestValues)}return Qp(this.latestValues)&&Fv(c,this.latestValues),c}removeTransform(o){const s=fa();Ql(s,o);for(let c=0;c<this.path.length;c++){const l=this.path[c];if(!l.instance||!Qp(l.latestValues))continue;QI(l.latestValues)&&l.updateSnapshot();const u=fa(),f=l.measurePageBox();Ql(u,f),vq(s,l.latestValues,l.snapshot?l.snapshot.layoutBox:void 0,u)}return Qp(this.latestValues)&&vq(s,this.latestValues),s}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Xo.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){const s=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=s.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=s.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=s.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==s;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:f}=this.options;if(!(!this.layout||!(u||f))){if(this.resolvedRelativeTargetAt=Xo.timestamp,!this.targetDelta&&!this.relativeTarget){const d=this.getClosestProjectingParent();d&&d.layout&&this.animationProgress!==1?(this.relativeParent=d,this.forceRelativeParentToResolveTarget(),this.relativeTarget=fa(),this.relativeTargetOrigin=fa(),j5(this.relativeTargetOrigin,this.layout.layoutBox,d.layout.layoutBox),Ql(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=fa(),this.targetWithTransforms=fa()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),DPe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ql(this.target,this.layout.layoutBox),jae(this.target,this.targetDelta)):Ql(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const d=this.getClosestProjectingParent();d&&!!d.resumingFrom==!!this.resumingFrom&&!d.options.layoutScroll&&d.target&&this.animationProgress!==1?(this.relativeParent=d,this.forceRelativeParentToResolveTarget(),this.relativeTarget=fa(),this.relativeTargetOrigin=fa(),j5(this.relativeTargetOrigin,this.target,d.target),Ql(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||QI(this.parent.latestValues)||$ae(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){const o=this.getLead(),s=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),s&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Xo.timestamp&&(c=!1),c)return;const{layout:l,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(l||u))return;Ql(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,d=this.treeScale.y;GNe(this.layoutCorrected,this.treeScale,this.path,s),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=fa());const{target:h}=o;if(!h){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(gq(this.prevProjectionDelta.x,this.projectionDelta.x),gq(this.prevProjectionDelta.y,this.projectionDelta.y)),$5(this.projectionDelta,this.layoutCorrected,h,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==d||!Sq(this.projectionDelta.x,this.prevProjectionDelta.x)||!Sq(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",h))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.visualElement?.scheduleRender(),o){const s=this.getStack();s&&s.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Bv(),this.projectionDelta=Bv(),this.projectionDeltaWithTransform=Bv()}setAnimationOrigin(o,s=!1){const c=this.snapshot,l=c?c.latestValues:{},u={...this.latestValues},f=Bv();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!s;const d=fa(),h=c?c.source:void 0,m=this.layout?this.layout.source:void 0,p=h!==m,y=this.getStack(),x=!y||y.members.length<=1,S=!!(p&&!x&&this.options.crossfade===!0&&!this.path.some(yke));this.animationProgress=0;let C;this.mixTargetDelta=_=>{const T=_/1e3;Eq(f.x,o.x,T),Eq(f.y,o.y,T),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(j5(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),vke(this.relativeTarget,this.relativeTargetOrigin,d,T),C&&nke(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=fa()),Ql(C,this.relativeTarget)),p&&(this.animationValues=u,XPe(u,l,this.latestValues,T,S,x)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(lh(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ii.update(()=>{aC.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=zm(0)),this.currentAnimation=ioe(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:s=>{this.mixTargetDelta(s),o.onUpdate&&o.onUpdate(s)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ake),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:s,target:c,layout:l,latestValues:u}=o;if(!(!s||!c||!l)){if(this!==o&&this.layout&&l&&foe(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||fa();const f=Zs(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const d=Zs(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+d}Ql(s,c),Fv(s,u),$5(this.projectionDeltaWithTransform,this.layoutCorrected,s,u)}}registerSharedNode(o,s){this.sharedNodes.has(o)||this.sharedNodes.set(o,new rke),this.sharedNodes.get(o).add(s);const l=s.options.initialPromotionConfig;s.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(s):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){const{layoutId:o}=this.options;return o?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:o}=this.options;return o?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:s,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let s=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(s=!0),!s)return;const l={};c.z&&qO("z",o,l,this.animationValues);for(let u=0;u<HO.length;u++)qO(`rotate${HO[u]}`,o,l,this.animationValues),qO(`skew${HO[u]}`,o,l,this.animationValues);o.render();for(const u in l)o.setStaticValue(u,l[u]),this.animationValues&&(this.animationValues[u]=l[u]);o.scheduleRender()}applyProjectionStyles(o,s){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=iC(s?.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const l=this.getLead();if(!this.projectionDelta||!this.layout||!l.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=iC(s?.pointerEvents)||""),this.hasProjected&&!Qp(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const u=l.animationValues||l.latestValues;this.applyTransformsToTarget();let f=ike(this.projectionDeltaWithTransform,this.treeScale,u);c&&(f=c(u,f)),o.transform=f;const{x:d,y:h}=this.projectionDelta;o.transformOrigin=`${d.origin*100}% ${h.origin*100}% 0`,l.animationValues?o.opacity=l===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:o.opacity=l===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const m in vw){if(u[m]===void 0)continue;const{correct:p,applyTo:y,isCSSVariable:x}=vw[m],S=f==="none"?u[m]:p(u[m],l);if(y){const C=y.length;for(let _=0;_<C;_++)o[y[_]]=S}else x?this.options.visualElement.renderState.vars[m]=S:o[m]=S}this.options.layoutId&&(o.pointerEvents=l===this?iC(s?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>o.currentAnimation?.stop()),this.root.nodes.forEach(Cq),this.root.sharedNodes.clear()}}}function ske(t){t.updateLayout()}function cke(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:i}=t.options,a=e.source!==t.layout.source;i==="size"?ou(u=>{const f=a?e.measuredBox[u]:e.layoutBox[u],d=Zs(f);f.min=n[u].min,f.max=f.min+d}):foe(i,e.layoutBox,n)&&ou(u=>{const f=a?e.measuredBox[u]:e.layoutBox[u],d=Zs(n[u]);f.max=f.min+d,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[u].max=t.relativeTarget[u].min+d)});const o=Bv();$5(o,n,e.layoutBox);const s=Bv();a?$5(s,t.applyTransform(r,!0),e.measuredBox):$5(s,n,e.layoutBox);const c=!soe(o);let l=!1;if(!t.resumeFrom){const u=t.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:f,layout:d}=u;if(f&&d){const h=fa();j5(h,e.layoutBox,f.layoutBox);const m=fa();j5(m,n,d.layoutBox),coe(h,m)||(l=!0),u.options.layoutRoot&&(t.relativeTarget=m,t.relativeTargetOrigin=h,t.relativeParent=u)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function lke(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function uke(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function fke(t){t.clearSnapshot()}function Cq(t){t.clearMeasurements()}function _q(t){t.isLayoutDirty=!1}function dke(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Tq(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function hke(t){t.resolveTargetDelta()}function gke(t){t.calcProjection()}function pke(t){t.resetSkewAndRotation()}function mke(t){t.removeLeadSnapshot()}function Eq(t,e,n){t.translate=Li(e.translate,0,n),t.scale=Li(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Oq(t,e,n,r){t.min=Li(e.min,n.min,r),t.max=Li(e.max,n.max,r)}function vke(t,e,n,r){Oq(t.x,e.x,n.x,r),Oq(t.y,e.y,n.y,r)}function yke(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const xke={duration:.45,ease:[.4,0,.1,1]},Dq=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Mq=Dq("applewebkit/")&&!Dq("chrome/")?Math.round:vu;function Rq(t){t.min=Mq(t.min),t.max=Mq(t.max)}function wke(t){Rq(t.x),Rq(t.y)}function foe(t,e,n){return t==="position"||t==="preserve-aspect"&&!OPe(bq(e),bq(n),.2)}function bke(t){return t!==t.root&&t.scroll?.wasRoot}const Ske=uoe({attachResizeListener:(t,e)=>xw(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),KO={current:void 0},doe=uoe({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!KO.current){const t=new Ske({});t.mount(window),t.setOptions({layoutScroll:!0}),KO.current=t}return KO.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Cke={pan:{Feature:BPe},drag:{Feature:FPe,ProjectionNode:doe,MeasureLayout:roe}};function Iq(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,a=r[i];a&&Ii.postRender(()=>a(e,db(e)))}class _ke extends fp{mount(){const{current:e}=this.node;e&&(this.unmount=XIe(e,(n,r)=>(Iq(this.node,r,"Start"),i=>Iq(this.node,i,"End"))))}unmount(){}}class Tke extends fp{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=lb(xw(this.node.current,"focus",()=>this.onFocus()),xw(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Nq(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),a=r[i];a&&Ii.postRender(()=>a(e,db(e)))}class Eke extends fp{mount(){const{current:e}=this.node;e&&(this.unmount=eNe(e,(n,r)=>(Nq(this.node,r,"Start"),(i,{success:a})=>Nq(this.node,i,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const aN=new WeakMap,YO=new WeakMap,Oke=t=>{const e=aN.get(t.target);e&&e(t)},Dke=t=>{t.forEach(Oke)};function Mke({root:t,...e}){const n=t||document;YO.has(n)||YO.set(n,{});const r=YO.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(Dke,{root:t,...e})),r[i]}function Rke(t,e,n){const r=Mke(e);return aN.set(t,n),r.observe(t),()=>{aN.delete(t),r.unobserve(t)}}const Ike={some:0,all:1};class Nke extends fp{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:a}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:Ike[i]},s=c=>{const{isIntersecting:l}=c;if(this.isInView===l||(this.isInView=l,a&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:u,onViewportLeave:f}=this.node.getProps(),d=l?u:f;d&&d(c)};return Rke(this.node.current,o,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(Pke(e,n))&&this.startObserver()}unmount(){}}function Pke({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const kke={inView:{Feature:Nke},tap:{Feature:Eke},focus:{Feature:Tke},hover:{Feature:_ke}},Ake={layout:{ProjectionNode:doe,MeasureLayout:roe}},Lke={...bPe,...kke,...Cke,...Ake},ho=FNe(Lke,XNe);function hoe(t){const e=cb(()=>zm(t)),{isStatic:n}=D.useContext(E6);if(n){const[,r]=D.useState(t);D.useEffect(()=>e.on("change",r),[])}return e}function goe(t,e){const n=hoe(e()),r=()=>n.set(e());return r(),oA(()=>{const i=()=>Ii.preRender(r,!1,!0),a=t.map(o=>o.on("change",i));return()=>{a.forEach(o=>o()),lh(r)}}),n}function Vke(t){L5.current=[],t();const e=goe(L5.current,t);return L5.current=void 0,e}function $ke(t,e,n,r){if(typeof t=="function")return Vke(t);const i=typeof e=="function"?e:tNe(e,n,r);return Array.isArray(t)?Pq(t,i):Pq([t],([a])=>i(a))}function Pq(t,e){const n=cb(()=>[]);return goe(t,()=>{n.length=0;const r=t.length;for(let i=0;i<r;i++)n[i]=t[i].get();return e(n)})}function UA(t){return typeof t=="object"&&!Array.isArray(t)}function poe(t,e,n,r){return typeof t=="string"&&UA(e)?EA(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function jke(t,e,n){return t*(e+1)}function kq(t,e,n,r){return typeof e=="number"?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):e==="<"?n:e.startsWith("<")?Math.max(0,n+parseFloat(e.slice(1))):r.get(e)??t}function Uke(t,e,n){for(let r=0;r<t.length;r++){const i=t[r];i.at>e&&i.at<n&&(T6(t,i),r--)}}function Fke(t,e,n,r,i,a){Uke(t,i,a);for(let o=0;o<e.length;o++)t.push({value:e[o],at:Li(i,a,r[o]),easing:Bie(n,o)})}function Bke(t,e){for(let n=0;n<t.length;n++)t[n]=t[n]/(e+1)}function zke(t,e){return t.at===e.at?t.value===null?1:e.value===null?-1:0:t.at-e.at}const Gke="easeInOut";function Wke(t,{defaultTransition:e={},...n}={},r,i){const a=e.duration||.3,o=new Map,s=new Map,c={},l=new Map;let u=0,f=0,d=0;for(let h=0;h<t.length;h++){const m=t[h];if(typeof m=="string"){l.set(m,f);continue}else if(!Array.isArray(m)){l.set(m.name,kq(f,m.at,u,l));continue}let[p,y,x={}]=m;x.at!==void 0&&(f=kq(f,x.at,u,l));let S=0;const C=(_,T,O,M=0,I=0)=>{const V=Hke(_),{delay:k=0,times:L=iae(V),type:$="keyframes",repeat:W,repeatType:G,repeatDelay:oe=0,...U}=T;let{ease:Y=e.ease||"easeOut",duration:J}=T;const ne=typeof k=="function"?k(M,I):k,F=V.length,ae=CA($)?$:i?.[$||"keyframes"];if(F<=2&&ae){let we=100;if(F===2&&Yke(V)){const Me=V[1]-V[0];we=Math.abs(Me)}const Oe={...U};J!==void 0&&(Oe.duration=lf(J));const Te=eae(Oe,we,ae);Y=Te.ease,J=Te.duration}J??(J=a);const re=f+ne;L.length===1&&L[0]===0&&(L[1]=1);const te=L.length-V.length;if(te>0&&rae(L,te),V.length===1&&V.unshift(null),W){J=jke(J,W);const we=[...V],Oe=[...L];Y=Array.isArray(Y)?[...Y]:[Y];const Te=[...Y];for(let Me=0;Me<W;Me++){V.push(...we);for(let be=0;be<we.length;be++)L.push(Oe[be]+(Me+1)),Y.push(be===0?"linear":Bie(Te,be-1))}Bke(L,W)}const ye=re+J;Fke(O,V,Y,L,re,ye),S=Math.max(ne+J,S),d=Math.max(ye,d)};if(Io(p)){const _=Aq(p,s);C(y,x,Lq("default",_))}else{const _=poe(p,y,r,c),T=_.length;for(let O=0;O<T;O++){y=y,x=x;const M=_[O],I=Aq(M,s);for(const V in y)C(y[V],qke(x,V),Lq(V,I),O,T)}}u=f,f+=S}return s.forEach((h,m)=>{for(const p in h){const y=h[p];y.sort(zke);const x=[],S=[],C=[];for(let T=0;T<y.length;T++){const{at:O,value:M,easing:I}=y[T];x.push(M),S.push(by(0,d,O)),C.push(I||"easeOut")}S[0]!==0&&(S.unshift(0),x.unshift(x[0]),C.unshift(Gke)),S[S.length-1]!==1&&(S.push(1),x.push(null)),o.has(m)||o.set(m,{keyframes:{},transition:{}});const _=o.get(m);_.keyframes[p]=x,_.transition[p]={...e,duration:d,ease:C,times:S,...n}}}),o}function Aq(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function Lq(t,e){return e[t]||(e[t]=[]),e[t]}function Hke(t){return Array.isArray(t)?t:[t]}function qke(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const Kke=t=>typeof t=="number",Yke=t=>t.every(Kke);function Xke(t,e){return t in e}class Zke extends Bae{constructor(){super(...arguments),this.type="object"}readValueFromInstance(e,n){if(Xke(n,e)){const r=e[n];if(typeof r=="string"||typeof r=="number")return r}}getBaseTargetFromProps(){}removeValueFromRenderState(e,n){delete n.output[e]}measureInstanceViewportBox(){return fa()}build(e,n){Object.assign(e.output,n)}renderInstance(e,{output:n}){Object.assign(e,n)}sortInstanceNodePosition(){return 0}}function Qke(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=MA(t)&&!Sae(t)?new qae(e):new Wae(e);n.mount(t),yw.set(t,n)}function Jke(t){const e={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},n=new Zke(e);n.mount(t),yw.set(t,n)}function eAe(t,e){return Io(t)||typeof t=="number"||typeof t=="string"&&!UA(e)}function moe(t,e,n,r){const i=[];if(eAe(t,e))i.push(ioe(t,UA(e)&&e.default||e,n&&(n.default||n)));else{const a=poe(t,e,r),o=a.length;for(let s=0;s<o;s++){const c=a[s],l=c instanceof Element?Qke:Jke;yw.has(c)||l(c);const u=yw.get(c),f={...n};"delay"in f&&typeof f.delay=="function"&&(f.delay=f.delay(s,o)),i.push(...jA(u,{...e,transition:f},{}))}}return i}function tAe(t,e,n){const r=[];return Wke(t,e,n,{spring:pw}).forEach(({keyframes:a,transition:o},s)=>{r.push(...moe(s,a,o))}),r}function nAe(t){return Array.isArray(t)&&t.some(Array.isArray)}function rAe(t){function e(n,r,i){let a=[],o;if(nAe(n))a=tAe(n,r,t);else{const{onComplete:c,...l}=i||{};typeof c=="function"&&(o=c),a=moe(n,r,l,t)}const s=new kIe(a);return o&&s.finished.then(o),s}return e}const iAe=rAe(),aAe={some:0,all:1};function oAe(t,e,{root:n,margin:r,amount:i="some"}={}){const a=EA(t),o=new WeakMap,s=l=>{l.forEach(u=>{const f=o.get(u.target);if(u.isIntersecting!==!!f)if(u.isIntersecting){const d=e(u.target,u);typeof d=="function"?o.set(u.target,d):c.unobserve(u.target)}else typeof f=="function"&&(f(u),o.delete(u.target))})},c=new IntersectionObserver(s,{root:n,rootMargin:r,threshold:typeof i=="number"?i:aAe[i]});return a.forEach(l=>c.observe(l)),()=>c.disconnect()}function sAe(t,{root:e,margin:n,amount:r,once:i=!1,initial:a=!1}={}){const[o,s]=D.useState(a);return D.useEffect(()=>{if(!t.current||i&&o)return;const c=()=>(s(!0),i?void 0:()=>s(!1)),l={root:e&&e.current||void 0,margin:n,amount:r};return oAe(t.current,c,l)},[e,t,n,i,r]),o}const cAe=({width:t,height:e})=>w.jsx("img",{src:"/assets/logo.png",alt:"Samson Logo",width:t,height:e}),lAe="_wrapper_kg140_1",uAe="_actions_kg140_10",Vq={wrapper:lAe,actions:uAe},fAe="_form_1fxik_1",dAe="_field_1fxik_10",XO={form:fAe,field:dAe};function voe(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=voe(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function $r(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=voe(t))&&(r&&(r+=" "),r+=e);return r}const FA="-",hAe=t=>{const e=pAe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const s=o.split(FA);return s[0]===""&&s.length!==1&&s.shift(),yoe(s,e)||gAe(o)},getConflictingClassGroupIds:(o,s)=>{const c=n[o]||[];return s&&r[o]?[...c,...r[o]]:c}}},yoe=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?yoe(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const a=t.join(FA);return e.validators.find(({validator:o})=>o(a))?.classGroupId},$q=/^\[(.+)\]$/,gAe=t=>{if($q.test(t)){const e=$q.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},pAe=t=>{const{theme:e,classGroups:n}=t,r={nextPart:new Map,validators:[]};for(const i in n)oN(n[i],r,i,e);return r},oN=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const a=i===""?e:jq(e,i);a.classGroupId=n;return}if(typeof i=="function"){if(mAe(i)){oN(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([a,o])=>{oN(o,jq(e,a),n,r)})})},jq=(t,e)=>{let n=t;return e.split(FA).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},mAe=t=>t.isThemeGetter,vAe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(a,o)=>{n.set(a,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(a){let o=n.get(a);if(o!==void 0)return o;if((o=r.get(a))!==void 0)return i(a,o),o},set(a,o){n.has(a)?n.set(a,o):i(a,o)}}},sN="!",cN=":",yAe=cN.length,xAe=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const a=[];let o=0,s=0,c=0,l;for(let m=0;m<i.length;m++){let p=i[m];if(o===0&&s===0){if(p===cN){a.push(i.slice(c,m)),c=m+yAe;continue}if(p==="/"){l=m;continue}}p==="["?o++:p==="]"?o--:p==="("?s++:p===")"&&s--}const u=a.length===0?i:i.substring(c),f=wAe(u),d=f!==u,h=l&&l>c?l-c:void 0;return{modifiers:a,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}};if(e){const i=e+cN,a=r;r=o=>o.startsWith(i)?a(o.substring(i.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const i=r;r=a=>n({className:a,parseClassName:i})}return r},wAe=t=>t.endsWith(sN)?t.substring(0,t.length-1):t.startsWith(sN)?t.substring(1):t,bAe=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const i=[];let a=[];return r.forEach(o=>{o[0]==="["||e[o]?(i.push(...a.sort(),o),a=[]):a.push(o)}),i.push(...a.sort()),i}},SAe=t=>({cache:vAe(t.cacheSize),parseClassName:xAe(t),sortModifiers:bAe(t),...hAe(t)}),CAe=/\s+/,_Ae=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=e,o=[],s=t.trim().split(CAe);let c="";for(let l=s.length-1;l>=0;l-=1){const u=s[l],{isExternal:f,modifiers:d,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:p}=n(u);if(f){c=u+(c.length>0?" "+c:c);continue}let y=!!p,x=r(y?m.substring(0,p):m);if(!x){if(!y){c=u+(c.length>0?" "+c:c);continue}if(x=r(m),!x){c=u+(c.length>0?" "+c:c);continue}y=!1}const S=a(d).join(":"),C=h?S+sN:S,_=C+x;if(o.includes(_))continue;o.push(_);const T=i(x,y);for(let O=0;O<T.length;++O){const M=T[O];o.push(C+M)}c=u+(c.length>0?" "+c:c)}return c};function TAe(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=xoe(e))&&(r&&(r+=" "),r+=n);return r}const xoe=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=xoe(t[r]))&&(n&&(n+=" "),n+=e);return n};function EAe(t,...e){let n,r,i,a=o;function o(c){const l=e.reduce((u,f)=>f(u),t());return n=SAe(l),r=n.cache.get,i=n.cache.set,a=s,s(c)}function s(c){const l=r(c);if(l)return l;const u=_Ae(c,n);return i(c,u),u}return function(){return a(TAe.apply(null,arguments))}}const ao=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},woe=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,boe=/^\((?:(\w[\w-]*):)?(.+)\)$/i,OAe=/^\d+\/\d+$/,DAe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,MAe=/\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$/,RAe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IAe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NAe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,cv=t=>OAe.test(t),er=t=>!!t&&!Number.isNaN(Number(t)),ng=t=>!!t&&Number.isInteger(Number(t)),ZO=t=>t.endsWith("%")&&er(t.slice(0,-1)),u0=t=>DAe.test(t),PAe=()=>!0,kAe=t=>MAe.test(t)&&!RAe.test(t),Soe=()=>!1,AAe=t=>IAe.test(t),LAe=t=>NAe.test(t),VAe=t=>!Bt(t)&&!zt(t),$Ae=t=>o2(t,Toe,Soe),Bt=t=>woe.test(t),jp=t=>o2(t,Eoe,kAe),QO=t=>o2(t,zAe,er),Uq=t=>o2(t,Coe,Soe),jAe=t=>o2(t,_oe,LAe),j4=t=>o2(t,Ooe,AAe),zt=t=>boe.test(t),Ax=t=>s2(t,Eoe),UAe=t=>s2(t,GAe),Fq=t=>s2(t,Coe),FAe=t=>s2(t,Toe),BAe=t=>s2(t,_oe),U4=t=>s2(t,Ooe,!0),o2=(t,e,n)=>{const r=woe.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},s2=(t,e,n=!1)=>{const r=boe.exec(t);return r?r[1]?e(r[1]):n:!1},Coe=t=>t==="position"||t==="percentage",_oe=t=>t==="image"||t==="url",Toe=t=>t==="length"||t==="size"||t==="bg-size",Eoe=t=>t==="length",zAe=t=>t==="number",GAe=t=>t==="family-name",Ooe=t=>t==="shadow",WAe=()=>{const t=ao("color"),e=ao("font"),n=ao("text"),r=ao("font-weight"),i=ao("tracking"),a=ao("leading"),o=ao("breakpoint"),s=ao("container"),c=ao("spacing"),l=ao("radius"),u=ao("shadow"),f=ao("inset-shadow"),d=ao("text-shadow"),h=ao("drop-shadow"),m=ao("blur"),p=ao("perspective"),y=ao("aspect"),x=ao("ease"),S=ao("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[..._(),zt,Bt],O=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],I=()=>[zt,Bt,c],V=()=>[cv,"full","auto",...I()],k=()=>[ng,"none","subgrid",zt,Bt],L=()=>["auto",{span:["full",ng,zt,Bt]},ng,zt,Bt],$=()=>[ng,"auto",zt,Bt],W=()=>["auto","min","max","fr",zt,Bt],G=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],oe=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...I()],Y=()=>[cv,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],J=()=>[t,zt,Bt],ne=()=>[..._(),Fq,Uq,{position:[zt,Bt]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ae=()=>["auto","cover","contain",FAe,$Ae,{size:[zt,Bt]}],re=()=>[ZO,Ax,jp],te=()=>["","none","full",l,zt,Bt],ye=()=>["",er,Ax,jp],we=()=>["solid","dashed","dotted","double"],Oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Te=()=>[er,ZO,Fq,Uq],Me=()=>["","none",m,zt,Bt],be=()=>["none",er,zt,Bt],Ye=()=>["none",er,zt,Bt],ft=()=>[er,zt,Bt],je=()=>[cv,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[u0],breakpoint:[u0],color:[PAe],container:[u0],"drop-shadow":[u0],ease:["in","out","in-out"],font:[VAe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[u0],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[u0],shadow:[u0],spacing:["px",er],text:[u0],"text-shadow":[u0],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",cv,Bt,zt,y]}],container:["container"],columns:[{columns:[er,Bt,zt,s]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"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:T()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[ng,"auto",zt,Bt]}],basis:[{basis:[cv,"full","auto",s,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[er,cv,"auto","initial","none",Bt]}],grow:[{grow:["",er,zt,Bt]}],shrink:[{shrink:["",er,zt,Bt]}],order:[{order:[ng,"first","last","none",zt,Bt]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...G(),"normal"]}],"justify-items":[{"justify-items":[...oe(),"normal"]}],"justify-self":[{"justify-self":["auto",...oe()]}],"align-content":[{content:["normal",...G()]}],"align-items":[{items:[...oe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...oe(),{baseline:["","last"]}]}],"place-content":[{"place-content":G()}],"place-items":[{"place-items":[...oe(),"baseline"]}],"place-self":[{"place-self":["auto",...oe()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[s,"screen",...Y()]}],"min-w":[{"min-w":[s,"screen","none",...Y()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[o]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",n,Ax,jp]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,zt,QO]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ZO,Bt]}],"font-family":[{font:[UAe,Bt,e]}],"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,zt,Bt]}],"line-clamp":[{"line-clamp":[er,"none",zt,QO]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",zt,Bt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",zt,Bt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...we(),"wavy"]}],"text-decoration-thickness":[{decoration:[er,"from-font","auto",zt,jp]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[er,"auto",zt,Bt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",zt,Bt]}],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",zt,Bt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ne()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:ae()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ng,zt,Bt],radial:["",zt,Bt],conic:[ng,zt,Bt]},BAe,jAe]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:ye()}],"border-w-x":[{"border-x":ye()}],"border-w-y":[{"border-y":ye()}],"border-w-s":[{"border-s":ye()}],"border-w-e":[{"border-e":ye()}],"border-w-t":[{"border-t":ye()}],"border-w-r":[{"border-r":ye()}],"border-w-b":[{"border-b":ye()}],"border-w-l":[{"border-l":ye()}],"divide-x":[{"divide-x":ye()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ye()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...we(),"hidden","none"]}],"divide-style":[{divide:[...we(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...we(),"none","hidden"]}],"outline-offset":[{"outline-offset":[er,zt,Bt]}],"outline-w":[{outline:["",er,Ax,jp]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",u,U4,j4]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",f,U4,j4]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:ye()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[er,jp]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":ye()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",d,U4,j4]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[er,zt,Bt]}],"mix-blend":[{"mix-blend":[...Oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Oe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[er]}],"mask-image-linear-from-pos":[{"mask-linear-from":Te()}],"mask-image-linear-to-pos":[{"mask-linear-to":Te()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":Te()}],"mask-image-t-to-pos":[{"mask-t-to":Te()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":Te()}],"mask-image-r-to-pos":[{"mask-r-to":Te()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":Te()}],"mask-image-b-to-pos":[{"mask-b-to":Te()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":Te()}],"mask-image-l-to-pos":[{"mask-l-to":Te()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":Te()}],"mask-image-x-to-pos":[{"mask-x-to":Te()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":Te()}],"mask-image-y-to-pos":[{"mask-y-to":Te()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[zt,Bt]}],"mask-image-radial-from-pos":[{"mask-radial-from":Te()}],"mask-image-radial-to-pos":[{"mask-radial-to":Te()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"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":_()}],"mask-image-conic-pos":[{"mask-conic":[er]}],"mask-image-conic-from-pos":[{"mask-conic-from":Te()}],"mask-image-conic-to-pos":[{"mask-conic-to":Te()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:ae()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",zt,Bt]}],filter:[{filter:["","none",zt,Bt]}],blur:[{blur:Me()}],brightness:[{brightness:[er,zt,Bt]}],contrast:[{contrast:[er,zt,Bt]}],"drop-shadow":[{"drop-shadow":["","none",h,U4,j4]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",er,zt,Bt]}],"hue-rotate":[{"hue-rotate":[er,zt,Bt]}],invert:[{invert:["",er,zt,Bt]}],saturate:[{saturate:[er,zt,Bt]}],sepia:[{sepia:["",er,zt,Bt]}],"backdrop-filter":[{"backdrop-filter":["","none",zt,Bt]}],"backdrop-blur":[{"backdrop-blur":Me()}],"backdrop-brightness":[{"backdrop-brightness":[er,zt,Bt]}],"backdrop-contrast":[{"backdrop-contrast":[er,zt,Bt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",er,zt,Bt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[er,zt,Bt]}],"backdrop-invert":[{"backdrop-invert":["",er,zt,Bt]}],"backdrop-opacity":[{"backdrop-opacity":[er,zt,Bt]}],"backdrop-saturate":[{"backdrop-saturate":[er,zt,Bt]}],"backdrop-sepia":[{"backdrop-sepia":["",er,zt,Bt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",zt,Bt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[er,"initial",zt,Bt]}],ease:[{ease:["linear","initial",x,zt,Bt]}],delay:[{delay:[er,zt,Bt]}],animate:[{animate:["none",S,zt,Bt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,zt,Bt]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:Ye()}],"scale-x":[{"scale-x":Ye()}],"scale-y":[{"scale-y":Ye()}],"scale-z":[{"scale-z":Ye()}],"scale-3d":["scale-3d"],skew:[{skew:ft()}],"skew-x":[{"skew-x":ft()}],"skew-y":[{"skew-y":ft()}],transform:[{transform:[zt,Bt,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"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",zt,Bt]}],"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":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",zt,Bt]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[er,Ax,jp,QO]}],stroke:[{stroke:["none",...J()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-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-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-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-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"]}},HAe=EAe(WAe);function rt(...t){return HAe($r(t))}function Ar({className:t,type:e,...n}){return w.jsx("input",{type:e,"data-slot":"input",className:rt("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[1px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...n})}function Bq(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function uh(...t){return e=>{let n=!1;const r=t.map(i=>{const a=Bq(i,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():Bq(t[i],null)}}}}function $n(...t){return D.useCallback(uh(...t),t)}function Hg(t){const e=qAe(t),n=D.forwardRef((r,i)=>{const{children:a,...o}=r,s=D.Children.toArray(a),c=s.find(KAe);if(c){const l=c.props.children,u=s.map(f=>f===c?D.Children.count(l)>1?D.Children.only(null):D.isValidElement(l)?l.props.children:null:f);return w.jsx(e,{...o,ref:i,children:D.isValidElement(l)?D.cloneElement(l,void 0,u):null})}return w.jsx(e,{...o,ref:i,children:a})});return n.displayName=`${t}.Slot`,n}var BA=Hg("Slot");function qAe(t){const e=D.forwardRef((n,r)=>{const{children:i,...a}=n;if(D.isValidElement(i)){const o=XAe(i),s=YAe(a,i.props);return i.type!==D.Fragment&&(s.ref=r?uh(r,o):o),D.cloneElement(i,s)}return D.Children.count(i)>1?D.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Doe=Symbol("radix.slottable");function Moe(t){const e=({children:n})=>w.jsx(w.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Doe,e}function KAe(t){return D.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Doe}function YAe(t,e){const n={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...s)=>{const c=a(...s);return i(...s),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...t,...n}}function XAe(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const zq=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Gq=$r,Roe=(t,e)=>n=>{var r;if(e?.variants==null)return Gq(t,n?.class,n?.className);const{variants:i,defaultVariants:a}=e,o=Object.keys(i).map(l=>{const u=n?.[l],f=a?.[l];if(u===null)return null;const d=zq(u)||zq(f);return i[l][d]}),s=n&&Object.entries(n).reduce((l,u)=>{let[f,d]=u;return d===void 0||(l[f]=d),l},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((l,u)=>{let{class:f,className:d,...h}=u;return Object.entries(h).every(m=>{let[p,y]=m;return Array.isArray(y)?y.includes({...a,...s}[p]):{...a,...s}[p]===y})?[...l,f,d]:l},[]);return Gq(t,o,c,n?.class,n?.className)},Jo=({size:t="md",color:e="currentColor",className:n=""})=>{const i={sm:16,md:24,lg:32}[t];return w.jsx(ho.div,{className:`${n}`,style:{width:i,height:i,border:`2px solid ${e}`,borderTopColor:"transparent",borderRadius:"50%"},animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"}})},ww=Roe("inline-flex items-center cursor-pointer justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-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",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-accent/80 text-white hover:bg-accent dark:bg-accent/60 dark:hover:bg-accent/80 dark:text-white",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function bt({className:t,variant:e,size:n,asChild:r=!1,children:i,loading:a=!1,...o}){const s=r?BA:"button";return w.jsx(s,{"data-slot":"button",className:rt(ww({variant:e,size:n,className:t})),...o,children:a?w.jsx(Jo,{size:"sm"}):i})}var hb=t=>t.type==="checkbox",mm=t=>t instanceof Date,Gs=t=>t==null;const Ioe=t=>typeof t=="object";var Ya=t=>!Gs(t)&&!Array.isArray(t)&&Ioe(t)&&!mm(t),Noe=t=>Ya(t)&&t.target?hb(t.target)?t.target.checked:t.target.value:t,ZAe=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,Poe=(t,e)=>t.has(ZAe(e)),QAe=t=>{const e=t.constructor&&t.constructor.prototype;return Ya(e)&&e.hasOwnProperty("isPrototypeOf")},zA=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Di(t){let e;const n=Array.isArray(t),r=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(!(zA&&(t instanceof Blob||r))&&(n||Ya(t)))if(e=n?[]:Object.create(Object.getPrototypeOf(t)),!n&&!QAe(t))e=t;else for(const i in t)t.hasOwnProperty(i)&&(e[i]=Di(t[i]));else return t;return e}var R6=t=>/^\w*$/.test(t),Ri=t=>t===void 0,I6=t=>Array.isArray(t)?t.filter(Boolean):[],GA=t=>I6(t.replace(/["|']|\]/g,"").split(/\.|\[/)),St=(t,e,n)=>{if(!e||!Ya(t))return n;const r=(R6(e)?[e]:GA(e)).reduce((i,a)=>Gs(i)?i:i[a],t);return Ri(r)||r===t?Ri(t[e])?n:t[e]:r},ul=t=>typeof t=="boolean",kr=(t,e,n)=>{let r=-1;const i=R6(e)?[e]:GA(e),a=i.length,o=a-1;for(;++r<a;){const s=i[r];let c=n;if(r!==o){const l=t[s];c=Ya(l)||Array.isArray(l)?l:isNaN(+i[r+1])?{}:[]}if(s==="__proto__"||s==="constructor"||s==="prototype")return;t[s]=c,t=t[s]}};const g_={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},du={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},f0={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},WA=Ce.createContext(null);WA.displayName="HookFormContext";const gb=()=>Ce.useContext(WA),JAe=t=>{const{children:e,...n}=t;return Ce.createElement(WA.Provider,{value:n},e)};var koe=(t,e,n,r=!0)=>{const i={defaultValues:e._defaultValues};for(const a in t)Object.defineProperty(i,a,{get:()=>{const o=a;return e._proxyFormState[o]!==du.all&&(e._proxyFormState[o]=!r||du.all),n&&(n[o]=!0),t[o]}});return i};const N6=typeof window<"u"?Ce.useLayoutEffect:Ce.useEffect;function Aoe(t){const e=gb(),{control:n=e.control,disabled:r,name:i,exact:a}=t||{},[o,s]=Ce.useState(n._formState),c=Ce.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return N6(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:l=>{!r&&s({...n._formState,...l})}}),[i,r,a]),Ce.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),Ce.useMemo(()=>koe(o,n,c.current,!1),[o,n])}var gl=t=>typeof t=="string",Loe=(t,e,n,r,i)=>gl(t)?(r&&e.watch.add(t),St(n,t,i)):Array.isArray(t)?t.map(a=>(r&&e.watch.add(a),St(n,a))):(r&&(e.watchAll=!0),n),lN=t=>Gs(t)||!Ioe(t);function T0(t,e,n=new WeakSet){if(lN(t)||lN(e))return t===e;if(mm(t)&&mm(e))return t.getTime()===e.getTime();const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const a of r){const o=t[a];if(!i.includes(a))return!1;if(a!=="ref"){const s=e[a];if(mm(o)&&mm(s)||Ya(o)&&Ya(s)||Array.isArray(o)&&Array.isArray(s)?!T0(o,s,n):o!==s)return!1}}return!0}function eLe(t){const e=gb(),{control:n=e.control,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=t||{},c=Ce.useRef(i),l=Ce.useRef(s),u=Ce.useRef(void 0);l.current=s;const f=Ce.useMemo(()=>n._getWatch(r,c.current),[n,r]),[d,h]=Ce.useState(l.current?l.current(f):f);return N6(()=>n._subscribe({name:r,formState:{values:!0},exact:o,callback:m=>{if(!a){const p=Loe(r,n._names,m.values||n._formValues,!1,c.current);if(l.current){const y=l.current(p);T0(y,u.current)||(h(y),u.current=y)}else h(p)}}}),[n,a,r,o]),Ce.useEffect(()=>n._removeUnmounted()),d}function tLe(t){const e=gb(),{name:n,disabled:r,control:i=e.control,shouldUnregister:a,defaultValue:o}=t,s=Poe(i._names.array,n),c=Ce.useMemo(()=>St(i._formValues,n,St(i._defaultValues,n,o)),[i,n,o]),l=eLe({control:i,name:n,defaultValue:c,exact:!0}),u=Aoe({control:i,name:n,exact:!0}),f=Ce.useRef(t),d=Ce.useRef(void 0),h=Ce.useRef(i.register(n,{...t.rules,value:l,...ul(t.disabled)?{disabled:t.disabled}:{}}));f.current=t;const m=Ce.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!St(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!St(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!St(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!St(u.validatingFields,n)},error:{enumerable:!0,get:()=>St(u.errors,n)}}),[u,n]),p=Ce.useCallback(C=>h.current.onChange({target:{value:Noe(C),name:n},type:g_.CHANGE}),[n]),y=Ce.useCallback(()=>h.current.onBlur({target:{value:St(i._formValues,n),name:n},type:g_.BLUR}),[n,i._formValues]),x=Ce.useCallback(C=>{const _=St(i._fields,n);_&&C&&(_._f.ref={focus:()=>C.focus&&C.focus(),select:()=>C.select&&C.select(),setCustomValidity:T=>C.setCustomValidity(T),reportValidity:()=>C.reportValidity()})},[i._fields,n]),S=Ce.useMemo(()=>({name:n,value:l,...ul(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:p,onBlur:y,ref:x}),[n,r,u.disabled,p,y,x,l]);return Ce.useEffect(()=>{const C=i._options.shouldUnregister||a,_=d.current;_&&_!==n&&!s&&i.unregister(_),i.register(n,{...f.current.rules,...ul(f.current.disabled)?{disabled:f.current.disabled}:{}});const T=(O,M)=>{const I=St(i._fields,O);I&&I._f&&(I._f.mount=M)};if(T(n,!0),C){const O=Di(St(i._options.defaultValues,n));kr(i._defaultValues,n,O),Ri(St(i._formValues,n))&&kr(i._formValues,n,O)}return!s&&i.register(n),d.current=n,()=>{(s?C&&!i._state.action:C)?i.unregister(n):T(n,!1)}},[n,i,s,a]),Ce.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),Ce.useMemo(()=>({field:S,formState:u,fieldState:m}),[S,u,m])}const nLe=t=>t.render(tLe(t));var HA=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{},Mc=t=>Array.isArray(t)?t:[t],Wq=()=>{let t=[];return{get observers(){return t},next:i=>{for(const a of t)a.next&&a.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(a=>a!==i)}}),unsubscribe:()=>{t=[]}}};function Voe(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const i=t[r],a=e[r];if(i&&Ya(i)&&a){const o=Voe(i,a);Ya(o)&&(n[r]=o)}else t[r]&&(n[r]=a)}return n}var Bs=t=>Ya(t)&&!Object.keys(t).length,qA=t=>t.type==="file",Zu=t=>typeof t=="function",p_=t=>{if(!zA)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},$oe=t=>t.type==="select-multiple",KA=t=>t.type==="radio",rLe=t=>KA(t)||hb(t),JO=t=>p_(t)&&t.isConnected;function iLe(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=Ri(t)?r++:t[e[r++]];return t}function aLe(t){for(const e in t)if(t.hasOwnProperty(e)&&!Ri(t[e]))return!1;return!0}function Ta(t,e){const n=Array.isArray(e)?e:R6(e)?[e]:GA(e),r=n.length===1?t:iLe(t,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(Ya(r)&&Bs(r)||Array.isArray(r)&&aLe(r))&&Ta(t,n.slice(0,-1)),t}var oLe=t=>{for(const e in t)if(Zu(t[e]))return!0;return!1};function joe(t){return Array.isArray(t)||Ya(t)&&!oLe(t)}function uN(t,e={}){for(const n in t)joe(t[n])?(e[n]=Array.isArray(t[n])?[]:{},uN(t[n],e[n])):Gs(t[n])||(e[n]=!0);return e}function Nv(t,e,n){n||(n=uN(e));for(const r in t)joe(t[r])?Ri(e)||lN(n[r])?n[r]=uN(t[r],Array.isArray(t[r])?[]:{}):Nv(t[r],Gs(e)?{}:e[r],n[r]):n[r]=!T0(t[r],e[r]);return n}const Hq={value:!1,isValid:!1},qq={value:!0,isValid:!0};var Uoe=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Ri(t[0].attributes.value)?Ri(t[0].value)||t[0].value===""?qq:{value:t[0].value,isValid:!0}:qq:Hq}return Hq},Foe=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>Ri(t)?t:e?t===""?NaN:t&&+t:n&&gl(t)?new Date(t):r?r(t):t;const Kq={isValid:!1,value:null};var Boe=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,Kq):Kq;function Yq(t){const e=t.ref;return qA(e)?e.files:KA(e)?Boe(t.refs).value:$oe(e)?[...e.selectedOptions].map(({value:n})=>n):hb(e)?Uoe(t.refs).value:Foe(Ri(e.value)?t.ref.value:e.value,t)}var sLe=(t,e,n,r)=>{const i={};for(const a of t){const o=St(e,a);o&&kr(i,a,o._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},m_=t=>t instanceof RegExp,Lx=t=>Ri(t)?t:m_(t)?t.source:Ya(t)?m_(t.value)?t.value.source:t.value:t,zv=t=>({isOnSubmit:!t||t===du.onSubmit,isOnBlur:t===du.onBlur,isOnChange:t===du.onChange,isOnAll:t===du.all,isOnTouch:t===du.onTouched});const Xq="AsyncFunction";var cLe=t=>!!t&&!!t.validate&&!!(Zu(t.validate)&&t.validate.constructor.name===Xq||Ya(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===Xq)),lLe=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),fN=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const iy=(t,e,n,r)=>{for(const i of n||Object.keys(t)){const a=St(t,i);if(a){const{_f:o,...s}=a;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],i)&&!r)return!0;if(o.ref&&e(o.ref,o.name)&&!r)return!0;if(iy(s,e))break}else if(Ya(s)&&iy(s,e))break}}};function Zq(t,e,n){const r=St(t,n);if(r||R6(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const a=i.join("."),o=St(e,a),s=St(t,a);if(o&&!Array.isArray(o)&&n!==a)return{name:n};if(s&&s.type)return{name:a,error:s};if(s&&s.root&&s.root.type)return{name:`${a}.root`,error:s.root};i.pop()}return{name:n}}var uLe=(t,e,n,r)=>{n(t);const{name:i,...a}=t;return Bs(a)||Object.keys(a).length>=Object.keys(e).length||Object.keys(a).find(o=>e[o]===(!r||du.all))},fLe=(t,e,n)=>!t||!e||t===e||Mc(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r))),dLe=(t,e,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?r.isOnBlur:i.isOnBlur)?!t:(n?r.isOnChange:i.isOnChange)?t:!0,hLe=(t,e)=>!I6(St(t,e)).length&&Ta(t,e),zoe=(t,e,n)=>{const r=Mc(St(t,n));return kr(r,"root",e[n]),kr(t,n,r),t};function Qq(t,e,n="validate"){if(gl(t)||Array.isArray(t)&&t.every(gl)||ul(t)&&!t)return{type:n,message:gl(t)?t:"",ref:e}}var lv=t=>Ya(t)&&!m_(t)?t:{value:t,message:""},dN=async(t,e,n,r,i,a)=>{const{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:f,max:d,pattern:h,validate:m,name:p,valueAsNumber:y,mount:x}=t._f,S=St(n,p);if(!x||e.has(p))return{};const C=s?s[0]:o,_=$=>{i&&C.reportValidity&&(C.setCustomValidity(ul($)?"":$||""),C.reportValidity())},T={},O=KA(o),M=hb(o),I=O||M,V=(y||qA(o))&&Ri(o.value)&&Ri(S)||p_(o)&&o.value===""||S===""||Array.isArray(S)&&!S.length,k=HA.bind(null,p,r,T),L=($,W,G,oe=f0.maxLength,U=f0.minLength)=>{const Y=$?W:G;T[p]={type:$?oe:U,message:Y,ref:o,...k($?oe:U,Y)}};if(a?!Array.isArray(S)||!S.length:c&&(!I&&(V||Gs(S))||ul(S)&&!S||M&&!Uoe(s).isValid||O&&!Boe(s).isValid)){const{value:$,message:W}=gl(c)?{value:!!c,message:c}:lv(c);if($&&(T[p]={type:f0.required,message:W,ref:C,...k(f0.required,W)},!r))return _(W),T}if(!V&&(!Gs(f)||!Gs(d))){let $,W;const G=lv(d),oe=lv(f);if(!Gs(S)&&!isNaN(S)){const U=o.valueAsNumber||S&&+S;Gs(G.value)||($=U>G.value),Gs(oe.value)||(W=U<oe.value)}else{const U=o.valueAsDate||new Date(S),Y=F=>new Date(new Date().toDateString()+" "+F),J=o.type=="time",ne=o.type=="week";gl(G.value)&&S&&($=J?Y(S)>Y(G.value):ne?S>G.value:U>new Date(G.value)),gl(oe.value)&&S&&(W=J?Y(S)<Y(oe.value):ne?S<oe.value:U<new Date(oe.value))}if(($||W)&&(L(!!$,G.message,oe.message,f0.max,f0.min),!r))return _(T[p].message),T}if((l||u)&&!V&&(gl(S)||a&&Array.isArray(S))){const $=lv(l),W=lv(u),G=!Gs($.value)&&S.length>+$.value,oe=!Gs(W.value)&&S.length<+W.value;if((G||oe)&&(L(G,$.message,W.message),!r))return _(T[p].message),T}if(h&&!V&&gl(S)){const{value:$,message:W}=lv(h);if(m_($)&&!S.match($)&&(T[p]={type:f0.pattern,message:W,ref:o,...k(f0.pattern,W)},!r))return _(W),T}if(m){if(Zu(m)){const $=await m(S,n),W=Qq($,C);if(W&&(T[p]={...W,...k(f0.validate,W.message)},!r))return _(W.message),T}else if(Ya(m)){let $={};for(const W in m){if(!Bs($)&&!r)break;const G=Qq(await m[W](S,n),C,W);G&&($={...G,...k(W,G.message)},_(G.message),r&&(T[p]=$))}if(!Bs($)&&(T[p]={ref:C,...$},!r))return T}}return _(!0),T};const gLe={mode:du.onSubmit,reValidateMode:du.onChange,shouldFocusError:!0};function pLe(t={}){let e={...gLe,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Zu(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},i=Ya(e.defaultValues)||Ya(e.values)?Di(e.defaultValues||e.values)||{}:{},a=e.shouldUnregister?{}:Di(i),o={action:!1,mount:!1,watch:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,l=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...u};const d={array:Wq(),state:Wq()},h=e.criteriaMode===du.all,m=ue=>B=>{clearTimeout(l),l=setTimeout(ue,B)},p=async ue=>{if(!e.disabled&&(u.isValid||f.isValid||ue)){const B=e.resolver?Bs((await M()).errors):await V(r,!0);B!==n.isValid&&d.state.next({isValid:B})}},y=(ue,B)=>{!e.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((ue||Array.from(s.mount)).forEach(K=>{K&&(B?kr(n.validatingFields,K,B):Ta(n.validatingFields,K))}),d.state.next({validatingFields:n.validatingFields,isValidating:!Bs(n.validatingFields)}))},x=(ue,B=[],K,fe,ie=!0,pe=!0)=>{if(fe&&K&&!e.disabled){if(o.action=!0,pe&&Array.isArray(St(r,ue))){const Re=K(St(r,ue),fe.argA,fe.argB);ie&&kr(r,ue,Re)}if(pe&&Array.isArray(St(n.errors,ue))){const Re=K(St(n.errors,ue),fe.argA,fe.argB);ie&&kr(n.errors,ue,Re),hLe(n.errors,ue)}if((u.touchedFields||f.touchedFields)&&pe&&Array.isArray(St(n.touchedFields,ue))){const Re=K(St(n.touchedFields,ue),fe.argA,fe.argB);ie&&kr(n.touchedFields,ue,Re)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=Nv(i,a)),d.state.next({name:ue,isDirty:L(ue,B),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else kr(a,ue,B)},S=(ue,B)=>{kr(n.errors,ue,B),d.state.next({errors:n.errors})},C=ue=>{n.errors=ue,d.state.next({errors:n.errors,isValid:!1})},_=(ue,B,K,fe)=>{const ie=St(r,ue);if(ie){const pe=St(a,ue,Ri(K)?St(i,ue):K);Ri(pe)||fe&&fe.defaultChecked||B?kr(a,ue,B?pe:Yq(ie._f)):G(ue,pe),o.mount&&p()}},T=(ue,B,K,fe,ie)=>{let pe=!1,Re=!1;const et={name:ue};if(!e.disabled){if(!K||fe){(u.isDirty||f.isDirty)&&(Re=n.isDirty,n.isDirty=et.isDirty=L(),pe=Re!==et.isDirty);const wt=T0(St(i,ue),B);Re=!!St(n.dirtyFields,ue),wt?Ta(n.dirtyFields,ue):kr(n.dirtyFields,ue,!0),et.dirtyFields=n.dirtyFields,pe=pe||(u.dirtyFields||f.dirtyFields)&&Re!==!wt}if(K){const wt=St(n.touchedFields,ue);wt||(kr(n.touchedFields,ue,K),et.touchedFields=n.touchedFields,pe=pe||(u.touchedFields||f.touchedFields)&&wt!==K)}pe&&ie&&d.state.next(et)}return pe?et:{}},O=(ue,B,K,fe)=>{const ie=St(n.errors,ue),pe=(u.isValid||f.isValid)&&ul(B)&&n.isValid!==B;if(e.delayError&&K?(c=m(()=>S(ue,K)),c(e.delayError)):(clearTimeout(l),c=null,K?kr(n.errors,ue,K):Ta(n.errors,ue)),(K?!T0(ie,K):ie)||!Bs(fe)||pe){const Re={...fe,...pe&&ul(B)?{isValid:B}:{},errors:n.errors,name:ue};n={...n,...Re},d.state.next(Re)}},M=async ue=>{y(ue,!0);const B=await e.resolver(a,e.context,sLe(ue||s.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return y(ue),B},I=async ue=>{const{errors:B}=await M(ue);if(ue)for(const K of ue){const fe=St(B,K);fe?kr(n.errors,K,fe):Ta(n.errors,K)}else n.errors=B;return B},V=async(ue,B,K={valid:!0})=>{for(const fe in ue){const ie=ue[fe];if(ie){const{_f:pe,...Re}=ie;if(pe){const et=s.array.has(pe.name),wt=ie._f&&cLe(ie._f);wt&&u.validatingFields&&y([pe.name],!0);const Pt=await dN(ie,s.disabled,a,h,e.shouldUseNativeValidation&&!B,et);if(wt&&u.validatingFields&&y([pe.name]),Pt[pe.name]&&(K.valid=!1,B))break;!B&&(St(Pt,pe.name)?et?zoe(n.errors,Pt,pe.name):kr(n.errors,pe.name,Pt[pe.name]):Ta(n.errors,pe.name))}!Bs(Re)&&await V(Re,B,K)}}return K.valid},k=()=>{for(const ue of s.unMount){const B=St(r,ue);B&&(B._f.refs?B._f.refs.every(K=>!JO(K)):!JO(B._f.ref))&&Te(ue)}s.unMount=new Set},L=(ue,B)=>!e.disabled&&(ue&&B&&kr(a,ue,B),!T0(F(),i)),$=(ue,B,K)=>Loe(ue,s,{...o.mount?a:Ri(B)?i:gl(ue)?{[ue]:B}:B},K,B),W=ue=>I6(St(o.mount?a:i,ue,e.shouldUnregister?St(i,ue,[]):[])),G=(ue,B,K={})=>{const fe=St(r,ue);let ie=B;if(fe){const pe=fe._f;pe&&(!pe.disabled&&kr(a,ue,Foe(B,pe)),ie=p_(pe.ref)&&Gs(B)?"":B,$oe(pe.ref)?[...pe.ref.options].forEach(Re=>Re.selected=ie.includes(Re.value)):pe.refs?hb(pe.ref)?pe.refs.forEach(Re=>{(!Re.defaultChecked||!Re.disabled)&&(Array.isArray(ie)?Re.checked=!!ie.find(et=>et===Re.value):Re.checked=ie===Re.value||!!ie)}):pe.refs.forEach(Re=>Re.checked=Re.value===ie):qA(pe.ref)?pe.ref.value="":(pe.ref.value=ie,pe.ref.type||d.state.next({name:ue,values:Di(a)})))}(K.shouldDirty||K.shouldTouch)&&T(ue,ie,K.shouldTouch,K.shouldDirty,!0),K.shouldValidate&&ne(ue)},oe=(ue,B,K)=>{for(const fe in B){if(!B.hasOwnProperty(fe))return;const ie=B[fe],pe=ue+"."+fe,Re=St(r,pe);(s.array.has(ue)||Ya(ie)||Re&&!Re._f)&&!mm(ie)?oe(pe,ie,K):G(pe,ie,K)}},U=(ue,B,K={})=>{const fe=St(r,ue),ie=s.array.has(ue),pe=Di(B);kr(a,ue,pe),ie?(d.array.next({name:ue,values:Di(a)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&K.shouldDirty&&d.state.next({name:ue,dirtyFields:Nv(i,a),isDirty:L(ue,pe)})):fe&&!fe._f&&!Gs(pe)?oe(ue,pe,K):G(ue,pe,K),fN(ue,s)&&d.state.next({...n,name:ue}),d.state.next({name:o.mount?ue:void 0,values:Di(a)})},Y=async ue=>{o.mount=!0;const B=ue.target;let K=B.name,fe=!0;const ie=St(r,K),pe=wt=>{fe=Number.isNaN(wt)||mm(wt)&&isNaN(wt.getTime())||T0(wt,St(a,K,wt))},Re=zv(e.mode),et=zv(e.reValidateMode);if(ie){let wt,Pt;const Ln=B.type?Yq(ie._f):Noe(ue),Sn=ue.type===g_.BLUR||ue.type===g_.FOCUS_OUT,Sr=!lLe(ie._f)&&!e.resolver&&!St(n.errors,K)&&!ie._f.deps||dLe(Sn,St(n.touchedFields,K),n.isSubmitted,et,Re),hn=fN(K,s,Sn);kr(a,K,Ln),Sn?(!B||!B.readOnly)&&(ie._f.onBlur&&ie._f.onBlur(ue),c&&c(0)):ie._f.onChange&&ie._f.onChange(ue);const kn=T(K,Ln,Sn),Mn=!Bs(kn)||hn;if(!Sn&&d.state.next({name:K,type:ue.type,values:Di(a)}),Sr)return(u.isValid||f.isValid)&&(e.mode==="onBlur"?Sn&&p():Sn||p()),Mn&&d.state.next({name:K,...hn?{}:kn});if(!Sn&&hn&&d.state.next({...n}),e.resolver){const{errors:Ae}=await M([K]);if(pe(Ln),fe){const at=Zq(n.errors,r,K),ct=Zq(Ae,r,at.name||K);wt=ct.error,K=ct.name,Pt=Bs(Ae)}}else y([K],!0),wt=(await dN(ie,s.disabled,a,h,e.shouldUseNativeValidation))[K],y([K]),pe(Ln),fe&&(wt?Pt=!1:(u.isValid||f.isValid)&&(Pt=await V(r,!0)));fe&&(ie._f.deps&&(!Array.isArray(ie._f.deps)||ie._f.deps.length>0)&&ne(ie._f.deps),O(K,Pt,wt,kn))}},J=(ue,B)=>{if(St(n.errors,B)&&ue.focus)return ue.focus(),1},ne=async(ue,B={})=>{let K,fe;const ie=Mc(ue);if(e.resolver){const pe=await I(Ri(ue)?ue:ie);K=Bs(pe),fe=ue?!ie.some(Re=>St(pe,Re)):K}else ue?(fe=(await Promise.all(ie.map(async pe=>{const Re=St(r,pe);return await V(Re&&Re._f?{[pe]:Re}:Re)}))).every(Boolean),!(!fe&&!n.isValid)&&p()):fe=K=await V(r);return d.state.next({...!gl(ue)||(u.isValid||f.isValid)&&K!==n.isValid?{}:{name:ue},...e.resolver||!ue?{isValid:K}:{},errors:n.errors}),B.shouldFocus&&!fe&&iy(r,J,ue?ie:s.mount),fe},F=(ue,B)=>{let K={...o.mount?a:i};return B&&(K=Voe(B.dirtyFields?n.dirtyFields:n.touchedFields,K)),Ri(ue)?K:gl(ue)?St(K,ue):ue.map(fe=>St(K,fe))},ae=(ue,B)=>({invalid:!!St((B||n).errors,ue),isDirty:!!St((B||n).dirtyFields,ue),error:St((B||n).errors,ue),isValidating:!!St(n.validatingFields,ue),isTouched:!!St((B||n).touchedFields,ue)}),re=ue=>{ue&&Mc(ue).forEach(B=>Ta(n.errors,B)),d.state.next({errors:ue?n.errors:{}})},te=(ue,B,K)=>{const fe=(St(r,ue,{_f:{}})._f||{}).ref,ie=St(n.errors,ue)||{},{ref:pe,message:Re,type:et,...wt}=ie;kr(n.errors,ue,{...wt,...B,ref:fe}),d.state.next({name:ue,errors:n.errors,isValid:!1}),K&&K.shouldFocus&&fe&&fe.focus&&fe.focus()},ye=(ue,B)=>Zu(ue)?d.state.subscribe({next:K=>"values"in K&&ue($(void 0,B),K)}):$(ue,B,!0),we=ue=>d.state.subscribe({next:B=>{fLe(ue.name,B.name,ue.exact)&&uLe(B,ue.formState||u,en,ue.reRenderRoot)&&ue.callback({values:{...a},...n,...B,defaultValues:i})}}).unsubscribe,Oe=ue=>(o.mount=!0,f={...f,...ue.formState},we({...ue,formState:f})),Te=(ue,B={})=>{for(const K of ue?Mc(ue):s.mount)s.mount.delete(K),s.array.delete(K),B.keepValue||(Ta(r,K),Ta(a,K)),!B.keepError&&Ta(n.errors,K),!B.keepDirty&&Ta(n.dirtyFields,K),!B.keepTouched&&Ta(n.touchedFields,K),!B.keepIsValidating&&Ta(n.validatingFields,K),!e.shouldUnregister&&!B.keepDefaultValue&&Ta(i,K);d.state.next({values:Di(a)}),d.state.next({...n,...B.keepDirty?{isDirty:L()}:{}}),!B.keepIsValid&&p()},Me=({disabled:ue,name:B})=>{(ul(ue)&&o.mount||ue||s.disabled.has(B))&&(ue?s.disabled.add(B):s.disabled.delete(B))},be=(ue,B={})=>{let K=St(r,ue);const fe=ul(B.disabled)||ul(e.disabled);return kr(r,ue,{...K||{},_f:{...K&&K._f?K._f:{ref:{name:ue}},name:ue,mount:!0,...B}}),s.mount.add(ue),K?Me({disabled:ul(B.disabled)?B.disabled:e.disabled,name:ue}):_(ue,!0,B.value),{...fe?{disabled:B.disabled||e.disabled}:{},...e.progressive?{required:!!B.required,min:Lx(B.min),max:Lx(B.max),minLength:Lx(B.minLength),maxLength:Lx(B.maxLength),pattern:Lx(B.pattern)}:{},name:ue,onChange:Y,onBlur:Y,ref:ie=>{if(ie){be(ue,B),K=St(r,ue);const pe=Ri(ie.value)&&ie.querySelectorAll&&ie.querySelectorAll("input,select,textarea")[0]||ie,Re=rLe(pe),et=K._f.refs||[];if(Re?et.find(wt=>wt===pe):pe===K._f.ref)return;kr(r,ue,{_f:{...K._f,...Re?{refs:[...et.filter(JO),pe,...Array.isArray(St(i,ue))?[{}]:[]],ref:{type:pe.type,name:ue}}:{ref:pe}}}),_(ue,!1,void 0,pe)}else K=St(r,ue,{}),K._f&&(K._f.mount=!1),(e.shouldUnregister||B.shouldUnregister)&&!(Poe(s.array,ue)&&o.action)&&s.unMount.add(ue)}}},Ye=()=>e.shouldFocusError&&iy(r,J,s.mount),ft=ue=>{ul(ue)&&(d.state.next({disabled:ue}),iy(r,(B,K)=>{const fe=St(r,K);fe&&(B.disabled=fe._f.disabled||ue,Array.isArray(fe._f.refs)&&fe._f.refs.forEach(ie=>{ie.disabled=fe._f.disabled||ue}))},0,!1))},je=(ue,B)=>async K=>{let fe;K&&(K.preventDefault&&K.preventDefault(),K.persist&&K.persist());let ie=Di(a);if(d.state.next({isSubmitting:!0}),e.resolver){const{errors:pe,values:Re}=await M();n.errors=pe,ie=Di(Re)}else await V(r);if(s.disabled.size)for(const pe of s.disabled)Ta(ie,pe);if(Ta(n.errors,"root"),Bs(n.errors)){d.state.next({errors:{}});try{await ue(ie,K)}catch(pe){fe=pe}}else B&&await B({...n.errors},K),Ye(),setTimeout(Ye);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Bs(n.errors)&&!fe,submitCount:n.submitCount+1,errors:n.errors}),fe)throw fe},It=(ue,B={})=>{St(r,ue)&&(Ri(B.defaultValue)?U(ue,Di(St(i,ue))):(U(ue,B.defaultValue),kr(i,ue,Di(B.defaultValue))),B.keepTouched||Ta(n.touchedFields,ue),B.keepDirty||(Ta(n.dirtyFields,ue),n.isDirty=B.defaultValue?L(ue,Di(St(i,ue))):L()),B.keepError||(Ta(n.errors,ue),u.isValid&&p()),d.state.next({...n}))},Rt=(ue,B={})=>{const K=ue?Di(ue):i,fe=Di(K),ie=Bs(ue),pe=ie?i:fe;if(B.keepDefaultValues||(i=K),!B.keepValues){if(B.keepDirtyValues){const Re=new Set([...s.mount,...Object.keys(Nv(i,a))]);for(const et of Array.from(Re))St(n.dirtyFields,et)?kr(pe,et,St(a,et)):U(et,St(pe,et))}else{if(zA&&Ri(ue))for(const Re of s.mount){const et=St(r,Re);if(et&&et._f){const wt=Array.isArray(et._f.refs)?et._f.refs[0]:et._f.ref;if(p_(wt)){const Pt=wt.closest("form");if(Pt){Pt.reset();break}}}}if(B.keepFieldsRef)for(const Re of s.mount)U(Re,St(pe,Re));else r={}}a=e.shouldUnregister?B.keepDefaultValues?Di(i):{}:Di(pe),d.array.next({values:{...pe}}),d.state.next({values:{...pe}})}s={mount:B.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!u.isValid||!!B.keepIsValid||!!B.keepDirtyValues,o.watch=!!e.shouldUnregister,d.state.next({submitCount:B.keepSubmitCount?n.submitCount:0,isDirty:ie?!1:B.keepDirty?n.isDirty:!!(B.keepDefaultValues&&!T0(ue,i)),isSubmitted:B.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ie?{}:B.keepDirtyValues?B.keepDefaultValues&&a?Nv(i,a):n.dirtyFields:B.keepDefaultValues&&ue?Nv(i,ue):B.keepDirty?n.dirtyFields:{},touchedFields:B.keepTouched?n.touchedFields:{},errors:B.keepErrors?n.errors:{},isSubmitSuccessful:B.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},cn=(ue,B)=>Rt(Zu(ue)?ue(a):ue,B),ln=(ue,B={})=>{const K=St(r,ue),fe=K&&K._f;if(fe){const ie=fe.refs?fe.refs[0]:fe.ref;ie.focus&&(ie.focus(),B.shouldSelect&&Zu(ie.select)&&ie.select())}},en=ue=>{n={...n,...ue}},Ke={control:{register:be,unregister:Te,getFieldState:ae,handleSubmit:je,setError:te,_subscribe:we,_runSchema:M,_focusError:Ye,_getWatch:$,_getDirty:L,_setValid:p,_setFieldArray:x,_setDisabledField:Me,_setErrors:C,_getFieldArray:W,_reset:Rt,_resetDefaultValues:()=>Zu(e.defaultValues)&&e.defaultValues().then(ue=>{cn(ue,e.resetOptions),d.state.next({isLoading:!1})}),_removeUnmounted:k,_disableForm:ft,_subjects:d,_proxyFormState:u,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(ue){o=ue},get _defaultValues(){return i},get _names(){return s},set _names(ue){s=ue},get _formState(){return n},get _options(){return e},set _options(ue){e={...e,...ue}}},subscribe:Oe,trigger:ne,register:be,handleSubmit:je,watch:ye,setValue:U,getValues:F,reset:cn,resetField:It,clearErrors:re,unregister:Te,setError:te,setFocus:ln,getFieldState:ae};return{...Ke,formControl:Ke}}var rg=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const t=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=(Math.random()*16+t)%16|0;return(e=="x"?n:n&3|8).toString(16)})},eD=(t,e,n={})=>n.shouldFocus||Ri(n.shouldFocus)?n.focusName||`${t}.${Ri(n.focusIndex)?e:n.focusIndex}.`:"",tD=(t,e)=>[...t,...Mc(e)],nD=t=>Array.isArray(t)?t.map(()=>{}):void 0;function rD(t,e,n){return[...t.slice(0,e),...Mc(n),...t.slice(e)]}var iD=(t,e,n)=>Array.isArray(t)?(Ri(t[n])&&(t[n]=void 0),t.splice(n,0,t.splice(e,1)[0]),t):[],aD=(t,e)=>[...Mc(e),...Mc(t)];function mLe(t,e){let n=0;const r=[...t];for(const i of e)r.splice(i-n,1),n++;return I6(r).length?r:[]}var oD=(t,e)=>Ri(e)?[]:mLe(t,Mc(e).sort((n,r)=>n-r)),sD=(t,e,n)=>{[t[e],t[n]]=[t[n],t[e]]},Jq=(t,e,n)=>(t[e]=n,t);function vLe(t){const e=gb(),{control:n=e.control,name:r,keyName:i="id",shouldUnregister:a,rules:o}=t,[s,c]=Ce.useState(n._getFieldArray(r)),l=Ce.useRef(n._getFieldArray(r).map(rg)),u=Ce.useRef(s),f=Ce.useRef(!1);u.current=s,n._names.array.add(r),Ce.useMemo(()=>o&&n.register(r,o),[n,o,r]),N6(()=>n._subjects.array.subscribe({next:({values:T,name:O})=>{if(O===r||!O){const M=St(T,r);Array.isArray(M)&&(c(M),l.current=M.map(rg))}}}).unsubscribe,[n,r]);const d=Ce.useCallback(T=>{f.current=!0,n._setFieldArray(r,T)},[n,r]),h=(T,O)=>{const M=Mc(Di(T)),I=tD(n._getFieldArray(r),M);n._names.focus=eD(r,I.length-1,O),l.current=tD(l.current,M.map(rg)),d(I),c(I),n._setFieldArray(r,I,tD,{argA:nD(T)})},m=(T,O)=>{const M=Mc(Di(T)),I=aD(n._getFieldArray(r),M);n._names.focus=eD(r,0,O),l.current=aD(l.current,M.map(rg)),d(I),c(I),n._setFieldArray(r,I,aD,{argA:nD(T)})},p=T=>{const O=oD(n._getFieldArray(r),T);l.current=oD(l.current,T),d(O),c(O),!Array.isArray(St(n._fields,r))&&kr(n._fields,r,void 0),n._setFieldArray(r,O,oD,{argA:T})},y=(T,O,M)=>{const I=Mc(Di(O)),V=rD(n._getFieldArray(r),T,I);n._names.focus=eD(r,T,M),l.current=rD(l.current,T,I.map(rg)),d(V),c(V),n._setFieldArray(r,V,rD,{argA:T,argB:nD(O)})},x=(T,O)=>{const M=n._getFieldArray(r);sD(M,T,O),sD(l.current,T,O),d(M),c(M),n._setFieldArray(r,M,sD,{argA:T,argB:O},!1)},S=(T,O)=>{const M=n._getFieldArray(r);iD(M,T,O),iD(l.current,T,O),d(M),c(M),n._setFieldArray(r,M,iD,{argA:T,argB:O},!1)},C=(T,O)=>{const M=Di(O),I=Jq(n._getFieldArray(r),T,M);l.current=[...I].map((V,k)=>!V||k===T?rg():l.current[k]),d(I),c([...I]),n._setFieldArray(r,I,Jq,{argA:T,argB:M},!0,!1)},_=T=>{const O=Mc(Di(T));l.current=O.map(rg),d([...O]),c([...O]),n._setFieldArray(r,[...O],M=>M,{},!0,!1)};return Ce.useEffect(()=>{if(n._state.action=!1,fN(r,n._names)&&n._subjects.state.next({...n._formState}),f.current&&(!zv(n._options.mode).isOnSubmit||n._formState.isSubmitted)&&!zv(n._options.reValidateMode).isOnSubmit)if(n._options.resolver)n._runSchema([r]).then(T=>{const O=St(T.errors,r),M=St(n._formState.errors,r);(M?!O&&M.type||O&&(M.type!==O.type||M.message!==O.message):O&&O.type)&&(O?kr(n._formState.errors,r,O):Ta(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{const T=St(n._fields,r);T&&T._f&&!(zv(n._options.reValidateMode).isOnSubmit&&zv(n._options.mode).isOnSubmit)&&dN(T,n._names.disabled,n._formValues,n._options.criteriaMode===du.all,n._options.shouldUseNativeValidation,!0).then(O=>!Bs(O)&&n._subjects.state.next({errors:zoe(n._formState.errors,O,r)}))}n._subjects.state.next({name:r,values:Di(n._formValues)}),n._names.focus&&iy(n._fields,(T,O)=>{if(n._names.focus&&O.startsWith(n._names.focus)&&T.focus)return T.focus(),1}),n._names.focus="",n._setValid(),f.current=!1},[s,r,n]),Ce.useEffect(()=>(!St(n._formValues,r)&&n._setFieldArray(r),()=>{const T=(O,M)=>{const I=St(n._fields,O);I&&I._f&&(I._f.mount=M)};n._options.shouldUnregister||a?n.unregister(r):T(r,!1)}),[r,n,i,a]),{swap:Ce.useCallback(x,[d,r,n]),move:Ce.useCallback(S,[d,r,n]),prepend:Ce.useCallback(m,[d,r,n]),append:Ce.useCallback(h,[d,r,n]),remove:Ce.useCallback(p,[d,r,n]),insert:Ce.useCallback(y,[d,r,n]),update:Ce.useCallback(C,[d,r,n]),replace:Ce.useCallback(_,[d,r,n]),fields:Ce.useMemo(()=>s.map((T,O)=>({...T,[i]:l.current[O]||rg()})),[s,i])}}function c2(t={}){const e=Ce.useRef(void 0),n=Ce.useRef(void 0),[r,i]=Ce.useState({isDirty:!1,isValidating:!1,isLoading:Zu(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:Zu(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:r},t.defaultValues&&!Zu(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:o,...s}=pLe(t);e.current={...s,formState:r}}const a=e.current.control;return a._options=t,N6(()=>{const o=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(s=>({...s,isReady:!0})),a._formState.isReady=!0,o},[a]),Ce.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),Ce.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode)},[a,t.mode,t.reValidateMode]),Ce.useEffect(()=>{t.errors&&(a._setErrors(t.errors),a._focusError())},[a,t.errors]),Ce.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),Ce.useEffect(()=>{if(a._proxyFormState.isDirty){const o=a._getDirty();o!==r.isDirty&&a._subjects.state.next({isDirty:o})}},[a,r.isDirty]),Ce.useEffect(()=>{t.values&&!T0(t.values,n.current)?(a._reset(t.values,{keepFieldsRef:!0,...a._options.resetOptions}),n.current=t.values,i(o=>({...o}))):a._resetDefaultValues()},[a,t.values]),Ce.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),e.current.formState=koe(r,a),e.current}var yLe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Yt=yLe.reduce((t,e)=>{const n=Hg(`Primitive.${e}`),r=D.forwardRef((i,a)=>{const{asChild:o,...s}=i,c=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(c,{...s,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Goe(t,e){t&&x1.flushSync(()=>t.dispatchEvent(e))}var xLe="Label",Woe=D.forwardRef((t,e)=>w.jsx(Yt.label,{...t,ref:e,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(t.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Woe.displayName=xLe;var wLe=Woe;function hN({className:t,...e}){return w.jsx(wLe,{"data-slot":"label",className:rt("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}const l2=JAe,Hoe=D.createContext({}),xn=({...t})=>w.jsx(Hoe.Provider,{value:{name:t.name},children:w.jsx(nLe,{...t})}),P6=()=>{const t=D.useContext(Hoe),e=D.useContext(qoe),{getFieldState:n}=gb(),r=Aoe({name:t.name}),i=n(t.name,r);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:a}=e;return{id:a,name:t.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...i}},qoe=D.createContext({});function wn({className:t,...e}){const n=D.useId();return w.jsx(qoe.Provider,{value:{id:n},children:w.jsx("div",{"data-slot":"form-item",className:rt("grid gap-2",t),...e})})}function ir({className:t,...e}){const{error:n,formItemId:r}=P6();return w.jsx(hN,{"data-slot":"form-label","data-error":!!n,className:rt("data-[error=true]:text-destructive",t),htmlFor:r,...e})}function bn({...t}){const{error:e,formItemId:n,formDescriptionId:r,formMessageId:i}=P6();return w.jsx(BA,{"data-slot":"form-control",id:n,"aria-describedby":e?`${r} ${i}`:`${r}`,"aria-invalid":!!e,...t})}function x0({className:t,...e}){const{formDescriptionId:n}=P6();return w.jsx("p",{"data-slot":"form-description",id:n,className:rt("text-muted-foreground text-sm",t),...e})}function Ig({className:t,...e}){const{error:n,formMessageId:r}=P6(),i=n?String(n?.message??""):e.children;return i?w.jsx("p",{"data-slot":"form-message",id:r,className:rt("text-destructive text-sm",t),...e,children:i}):null}const bLe="_listContainer_133ek_1",SLe="_personItem_133ek_11",CLe="_textContent_133ek_18",_Le="_personName_133ek_23",TLe="_personPost_133ek_30",ELe="_spinner_133ek_37",OLe="_dialogContent_133ek_42",Up={listContainer:bLe,personItem:SLe,textContent:CLe,personName:_Le,personPost:TLe,spinner:ELe,dialogContent:OLe};function Et(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t?.(i),n===!1||!i.defaultPrevented)return e?.(i)}}function DLe(t,e){const n=D.createContext(e),r=a=>{const{children:o,...s}=a,c=D.useMemo(()=>s,Object.values(s));return w.jsx(n.Provider,{value:c,children:o})};r.displayName=t+"Provider";function i(a){const o=D.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[r,i]}function Uc(t,e=[]){let n=[];function r(a,o){const s=D.createContext(o),c=n.length;n=[...n,o];const l=f=>{const{scope:d,children:h,...m}=f,p=d?.[t]?.[c]||s,y=D.useMemo(()=>m,Object.values(m));return w.jsx(p.Provider,{value:y,children:h})};l.displayName=a+"Provider";function u(f,d){const h=d?.[t]?.[c]||s,m=D.useContext(h);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[l,u]}const i=()=>{const a=n.map(o=>D.createContext(o));return function(s){const c=s?.[t]||a;return D.useMemo(()=>({[`__scope${t}`]:{...s,[t]:c}}),[s,c])}};return i.scopeName=t,[r,MLe(i,...e)]}function MLe(...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(a){const o=r.reduce((s,{useScope:c,scopeName:l})=>{const f=c(a)[`__scope${l}`];return{...s,...f}},{});return D.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var ko=globalThis?.document?D.useLayoutEffect:()=>{},RLe=Bk[" useId ".trim().toString()]||(()=>{}),ILe=0;function No(t){const[e,n]=D.useState(RLe());return ko(()=>{n(r=>r??String(ILe++))},[t]),t||(e?`radix-${e}`:"")}var NLe=Bk[" useInsertionEffect ".trim().toString()]||ko;function xd({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,a,o]=PLe({defaultProp:e,onChange:n}),s=t!==void 0,c=s?t:i;{const u=D.useRef(t!==void 0);D.useEffect(()=>{const f=u.current;f!==s&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${s?"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.`),u.current=s},[s,r])}const l=D.useCallback(u=>{if(s){const f=kLe(u)?u(t):u;f!==t&&o.current?.(f)}else a(u)},[s,t,a,o]);return[c,l]}function PLe({defaultProp:t,onChange:e}){const[n,r]=D.useState(t),i=D.useRef(n),a=D.useRef(e);return NLe(()=>{a.current=e},[e]),D.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function kLe(t){return typeof t=="function"}function es(t){const e=D.useRef(t);return D.useEffect(()=>{e.current=t}),D.useMemo(()=>(...n)=>e.current?.(...n),[])}function ALe(t,e=globalThis?.document){const n=es(t);D.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 LLe="DismissableLayer",gN="dismissableLayer.update",VLe="dismissableLayer.pointerDownOutside",$Le="dismissableLayer.focusOutside",eK,Koe=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),u2=D.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=t,l=D.useContext(Koe),[u,f]=D.useState(null),d=u?.ownerDocument??globalThis?.document,[,h]=D.useState({}),m=$n(e,M=>f(M)),p=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),x=p.indexOf(y),S=u?p.indexOf(u):-1,C=l.layersWithOutsidePointerEventsDisabled.size>0,_=S>=x,T=FLe(M=>{const I=M.target,V=[...l.branches].some(k=>k.contains(I));!_||V||(i?.(M),o?.(M),M.defaultPrevented||s?.())},d),O=BLe(M=>{const I=M.target;[...l.branches].some(k=>k.contains(I))||(a?.(M),o?.(M),M.defaultPrevented||s?.())},d);return ALe(M=>{S===l.layers.size-1&&(r?.(M),!M.defaultPrevented&&s&&(M.preventDefault(),s()))},d),D.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(eK=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),tK(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=eK)}},[u,d,n,l]),D.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),tK())},[u,l]),D.useEffect(()=>{const M=()=>h({});return document.addEventListener(gN,M),()=>document.removeEventListener(gN,M)},[]),w.jsx(Yt.div,{...c,ref:m,style:{pointerEvents:C?_?"auto":"none":void 0,...t.style},onFocusCapture:Et(t.onFocusCapture,O.onFocusCapture),onBlurCapture:Et(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:Et(t.onPointerDownCapture,T.onPointerDownCapture)})});u2.displayName=LLe;var jLe="DismissableLayerBranch",ULe=D.forwardRef((t,e)=>{const n=D.useContext(Koe),r=D.useRef(null),i=$n(e,r);return D.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),w.jsx(Yt.div,{...t,ref:i})});ULe.displayName=jLe;function FLe(t,e=globalThis?.document){const n=es(t),r=D.useRef(!1),i=D.useRef(()=>{});return D.useEffect(()=>{const a=s=>{if(s.target&&!r.current){let c=function(){Yoe(VLe,n,l,{discrete:!0})};const l={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function BLe(t,e=globalThis?.document){const n=es(t),r=D.useRef(!1);return D.useEffect(()=>{const i=a=>{a.target&&!r.current&&Yoe($Le,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function tK(){const t=new CustomEvent(gN);document.dispatchEvent(t)}function Yoe(t,e,n,{discrete:r}){const i=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?Goe(i,a):i.dispatchEvent(a)}var cD="focusScope.autoFocusOnMount",lD="focusScope.autoFocusOnUnmount",nK={bubbles:!1,cancelable:!0},zLe="FocusScope",pb=D.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=t,[s,c]=D.useState(null),l=es(i),u=es(a),f=D.useRef(null),d=$n(e,p=>c(p)),h=D.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;D.useEffect(()=>{if(r){let p=function(C){if(h.paused||!s)return;const _=C.target;s.contains(_)?f.current=_:fg(f.current,{select:!0})},y=function(C){if(h.paused||!s)return;const _=C.relatedTarget;_!==null&&(s.contains(_)||fg(f.current,{select:!0}))},x=function(C){if(document.activeElement===document.body)for(const T of C)T.removedNodes.length>0&&fg(s)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const S=new MutationObserver(x);return s&&S.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),S.disconnect()}}},[r,s,h.paused]),D.useEffect(()=>{if(s){iK.add(h);const p=document.activeElement;if(!s.contains(p)){const x=new CustomEvent(cD,nK);s.addEventListener(cD,l),s.dispatchEvent(x),x.defaultPrevented||(GLe(YLe(Xoe(s)),{select:!0}),document.activeElement===p&&fg(s))}return()=>{s.removeEventListener(cD,l),setTimeout(()=>{const x=new CustomEvent(lD,nK);s.addEventListener(lD,u),s.dispatchEvent(x),x.defaultPrevented||fg(p??document.body,{select:!0}),s.removeEventListener(lD,u),iK.remove(h)},0)}}},[s,l,u,h]);const m=D.useCallback(p=>{if(!n&&!r||h.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,x=document.activeElement;if(y&&x){const S=p.currentTarget,[C,_]=WLe(S);C&&_?!p.shiftKey&&x===_?(p.preventDefault(),n&&fg(C,{select:!0})):p.shiftKey&&x===C&&(p.preventDefault(),n&&fg(_,{select:!0})):x===S&&p.preventDefault()}},[n,r,h.paused]);return w.jsx(Yt.div,{tabIndex:-1,...o,ref:d,onKeyDown:m})});pb.displayName=zLe;function GLe(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(fg(r,{select:e}),document.activeElement!==n)return}function WLe(t){const e=Xoe(t),n=rK(e,t),r=rK(e.reverse(),t);return[n,r]}function Xoe(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 rK(t,e){for(const n of t)if(!HLe(n,{upTo:e}))return n}function HLe(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 qLe(t){return t instanceof HTMLInputElement&&"select"in t}function fg(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&qLe(t)&&e&&t.select()}}var iK=KLe();function KLe(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=aK(t,e),t.unshift(e)},remove(e){t=aK(t,e),t[0]?.resume()}}}function aK(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function YLe(t){return t.filter(e=>e.tagName!=="A")}var XLe="Portal",f2=D.forwardRef((t,e)=>{const{container:n,...r}=t,[i,a]=D.useState(!1);ko(()=>a(!0),[]);const o=n||i&&globalThis?.document?.body;return o?fie.createPortal(w.jsx(Yt.div,{...r,ref:e}),o):null});f2.displayName=XLe;function ZLe(t,e){return D.useReducer((n,r)=>e[n][r]??n,t)}var Lo=t=>{const{present:e,children:n}=t,r=QLe(e),i=typeof n=="function"?n({present:r.isPresent}):D.Children.only(n),a=$n(r.ref,JLe(i));return typeof n=="function"||r.isPresent?D.cloneElement(i,{ref:a}):null};Lo.displayName="Presence";function QLe(t){const[e,n]=D.useState(),r=D.useRef(null),i=D.useRef(t),a=D.useRef("none"),o=t?"mounted":"unmounted",[s,c]=ZLe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return D.useEffect(()=>{const l=F4(r.current);a.current=s==="mounted"?l:"none"},[s]),ko(()=>{const l=r.current,u=i.current;if(u!==t){const d=a.current,h=F4(l);t?c("MOUNT"):h==="none"||l?.display==="none"?c("UNMOUNT"):c(u&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),ko(()=>{if(e){let l;const u=e.ownerDocument.defaultView??window,f=h=>{const p=F4(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&p&&(c("ANIMATION_END"),!i.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},d=h=>{h.target===e&&(a.current=F4(r.current))};return e.addEventListener("animationstart",d),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{u.clearTimeout(l),e.removeEventListener("animationstart",d),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:D.useCallback(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function F4(t){return t?.animationName||"none"}function JLe(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var uD=0;function k6(){D.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??oK()),document.body.insertAdjacentElement("beforeend",t[1]??oK()),uD++,()=>{uD===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),uD--}},[])}function oK(){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 td=function(){return td=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},td.apply(this,arguments)};function Zoe(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 eVe(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,a;r<i;r++)(a||!(r in e))&&(a||(a=Array.prototype.slice.call(e,0,r)),a[r]=e[r]);return t.concat(a||Array.prototype.slice.call(e))}var oC="right-scroll-bar-position",sC="width-before-scroll-bar",tVe="with-scroll-bars-hidden",nVe="--removed-body-scroll-bar-size";function fD(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function rVe(t,e){var n=D.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 iVe=typeof window<"u"?D.useLayoutEffect:D.useEffect,sK=new WeakMap;function aVe(t,e){var n=rVe(null,function(r){return t.forEach(function(i){return fD(i,r)})});return iVe(function(){var r=sK.get(n);if(r){var i=new Set(r),a=new Set(t),o=n.current;i.forEach(function(s){a.has(s)||fD(s,null)}),a.forEach(function(s){i.has(s)||fD(s,o)})}sK.set(n,t)},[t]),n}function oVe(t){return t}function sVe(t,e){e===void 0&&(e=oVe);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(a){var o=e(a,r);return n.push(o),function(){n=n.filter(function(s){return s!==o})}},assignSyncMedium:function(a){for(r=!0;n.length;){var o=n;n=[],o.forEach(a)}n={push:function(s){return a(s)},filter:function(){return n}}},assignMedium:function(a){r=!0;var o=[];if(n.length){var s=n;n=[],s.forEach(a),o=n}var c=function(){var u=o;o=[],u.forEach(a)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(u){o.push(u),l()},filter:function(u){return o=o.filter(u),n}}}};return i}function cVe(t){t===void 0&&(t={});var e=sVe(null);return e.options=td({async:!0,ssr:!1},t),e}var Qoe=function(t){var e=t.sideCar,n=Zoe(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 D.createElement(r,td({},n))};Qoe.isSideCarExport=!0;function lVe(t,e){return t.useMedium(e),Qoe}var Joe=cVe(),dD=function(){},A6=D.forwardRef(function(t,e){var n=D.useRef(null),r=D.useState({onScrollCapture:dD,onWheelCapture:dD,onTouchMoveCapture:dD}),i=r[0],a=r[1],o=t.forwardProps,s=t.children,c=t.className,l=t.removeScrollBar,u=t.enabled,f=t.shards,d=t.sideCar,h=t.noRelative,m=t.noIsolation,p=t.inert,y=t.allowPinchZoom,x=t.as,S=x===void 0?"div":x,C=t.gapMode,_=Zoe(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=d,O=aVe([n,e]),M=td(td({},_),i);return D.createElement(D.Fragment,null,u&&D.createElement(T,{sideCar:Joe,removeScrollBar:l,shards:f,noRelative:h,noIsolation:m,inert:p,setCallbacks:a,allowPinchZoom:!!y,lockRef:n,gapMode:C}),o?D.cloneElement(D.Children.only(s),td(td({},M),{ref:O})):D.createElement(S,td({},M,{className:c,ref:O}),s))});A6.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};A6.classNames={fullWidth:sC,zeroRight:oC};var uVe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function fVe(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=uVe();return e&&t.setAttribute("nonce",e),t}function dVe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function hVe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var gVe=function(){var t=0,e=null;return{add:function(n){t==0&&(e=fVe())&&(dVe(e,n),hVe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},pVe=function(){var t=gVe();return function(e,n){D.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},ese=function(){var t=pVe(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},mVe={left:0,top:0,right:0,gap:0},hD=function(t){return parseInt(t||"",10)||0},vVe=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[hD(n),hD(r),hD(i)]},yVe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return mVe;var e=vVe(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])}},xVe=ese(),ay="data-scroll-locked",wVe=function(t,e,n,r){var i=t.left,a=t.top,o=t.right,s=t.gap;return n===void 0&&(n="margin"),`
  .`.concat(tVe,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(s,"px ").concat(r,`;
  }
  body[`).concat(ay,`] {
    overflow: hidden `).concat(r,`;
    overscroll-behavior: contain;
    `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
    padding-left: `.concat(i,`px;
    padding-top: `).concat(a,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(s,"px ").concat(r,`;
    `),n==="padding"&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(oC,` {
    right: `).concat(s,"px ").concat(r,`;
  }
  
  .`).concat(sC,` {
    margin-right: `).concat(s,"px ").concat(r,`;
  }
  
  .`).concat(oC," .").concat(oC,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(sC," .").concat(sC,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(ay,`] {
    `).concat(nVe,": ").concat(s,`px;
  }
`)},cK=function(){var t=parseInt(document.body.getAttribute(ay)||"0",10);return isFinite(t)?t:0},bVe=function(){D.useEffect(function(){return document.body.setAttribute(ay,(cK()+1).toString()),function(){var t=cK()-1;t<=0?document.body.removeAttribute(ay):document.body.setAttribute(ay,t.toString())}},[])},SVe=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;bVe();var a=D.useMemo(function(){return yVe(i)},[i]);return D.createElement(xVe,{styles:wVe(a,!e,i,n?"":"!important")})},pN=!1;if(typeof window<"u")try{var B4=Object.defineProperty({},"passive",{get:function(){return pN=!0,!0}});window.addEventListener("test",B4,B4),window.removeEventListener("test",B4,B4)}catch{pN=!1}var uv=pN?{passive:!1}:!1,CVe=function(t){return t.tagName==="TEXTAREA"},tse=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!CVe(t)&&n[e]==="visible")},_Ve=function(t){return tse(t,"overflowY")},TVe=function(t){return tse(t,"overflowX")},lK=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=nse(t,r);if(i){var a=rse(t,r),o=a[1],s=a[2];if(o>s)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},EVe=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},OVe=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},nse=function(t,e){return t==="v"?_Ve(e):TVe(e)},rse=function(t,e){return t==="v"?EVe(e):OVe(e)},DVe=function(t,e){return t==="h"&&e==="rtl"?-1:1},MVe=function(t,e,n,r,i){var a=DVe(t,window.getComputedStyle(e).direction),o=a*r,s=n.target,c=e.contains(s),l=!1,u=o>0,f=0,d=0;do{if(!s)break;var h=rse(t,s),m=h[0],p=h[1],y=h[2],x=p-y-a*m;(m||x)&&nse(t,s)&&(f+=x,d+=m);var S=s.parentNode;s=S&&S.nodeType===Node.DOCUMENT_FRAGMENT_NODE?S.host:S}while(!c&&s!==document.body||c&&(e.contains(s)||e===s));return(u&&Math.abs(f)<1||!u&&Math.abs(d)<1)&&(l=!0),l},z4=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},uK=function(t){return[t.deltaX,t.deltaY]},fK=function(t){return t&&"current"in t?t.current:t},RVe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},IVe=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},NVe=0,fv=[];function PVe(t){var e=D.useRef([]),n=D.useRef([0,0]),r=D.useRef(),i=D.useState(NVe++)[0],a=D.useState(ese)[0],o=D.useRef(t);D.useEffect(function(){o.current=t},[t]),D.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var p=eVe([t.lockRef.current],(t.shards||[]).map(fK),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var s=D.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var x=z4(p),S=n.current,C="deltaX"in p?p.deltaX:S[0]-x[0],_="deltaY"in p?p.deltaY:S[1]-x[1],T,O=p.target,M=Math.abs(C)>Math.abs(_)?"h":"v";if("touches"in p&&M==="h"&&O.type==="range")return!1;var I=lK(M,O);if(!I)return!0;if(I?T=M:(T=M==="v"?"h":"v",I=lK(M,O)),!I)return!1;if(!r.current&&"changedTouches"in p&&(C||_)&&(r.current=T),!T)return!0;var V=r.current||T;return MVe(V,y,p,V==="h"?C:_)},[]),c=D.useCallback(function(p){var y=p;if(!(!fv.length||fv[fv.length-1]!==a)){var x="deltaY"in y?uK(y):z4(y),S=e.current.filter(function(T){return T.name===y.type&&(T.target===y.target||y.target===T.shadowParent)&&RVe(T.delta,x)})[0];if(S&&S.should){y.cancelable&&y.preventDefault();return}if(!S){var C=(o.current.shards||[]).map(fK).filter(Boolean).filter(function(T){return T.contains(y.target)}),_=C.length>0?s(y,C[0]):!o.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),l=D.useCallback(function(p,y,x,S){var C={name:p,delta:y,target:x,should:S,shadowParent:kVe(x)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(_){return _!==C})},1)},[]),u=D.useCallback(function(p){n.current=z4(p),r.current=void 0},[]),f=D.useCallback(function(p){l(p.type,uK(p),p.target,s(p,t.lockRef.current))},[]),d=D.useCallback(function(p){l(p.type,z4(p),p.target,s(p,t.lockRef.current))},[]);D.useEffect(function(){return fv.push(a),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",c,uv),document.addEventListener("touchmove",c,uv),document.addEventListener("touchstart",u,uv),function(){fv=fv.filter(function(p){return p!==a}),document.removeEventListener("wheel",c,uv),document.removeEventListener("touchmove",c,uv),document.removeEventListener("touchstart",u,uv)}},[]);var h=t.removeScrollBar,m=t.inert;return D.createElement(D.Fragment,null,m?D.createElement(a,{styles:IVe(i)}):null,h?D.createElement(SVe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function kVe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const AVe=lVe(Joe,PVe);var mb=D.forwardRef(function(t,e){return D.createElement(A6,td({},t,{ref:e,sideCar:AVe}))});mb.classNames=A6.classNames;var LVe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},dv=new WeakMap,G4=new WeakMap,W4={},gD=0,ise=function(t){return t&&(t.host||ise(t.parentNode))},VVe=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=ise(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})},$Ve=function(t,e,n,r){var i=VVe(e,Array.isArray(t)?t:[t]);W4[n]||(W4[n]=new WeakMap);var a=W4[n],o=[],s=new Set,c=new Set(i),l=function(f){!f||s.has(f)||(s.add(f),l(f.parentNode))};i.forEach(l);var u=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(d){if(s.has(d))u(d);else try{var h=d.getAttribute(r),m=h!==null&&h!=="false",p=(dv.get(d)||0)+1,y=(a.get(d)||0)+1;dv.set(d,p),a.set(d,y),o.push(d),p===1&&m&&G4.set(d,!0),y===1&&d.setAttribute(n,"true"),m||d.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",d,x)}})};return u(e),s.clear(),gD++,function(){o.forEach(function(f){var d=dv.get(f)-1,h=a.get(f)-1;dv.set(f,d),a.set(f,h),d||(G4.has(f)||f.removeAttribute(r),G4.delete(f)),h||f.removeAttribute(n)}),gD--,gD||(dv=new WeakMap,dv=new WeakMap,G4=new WeakMap,W4={})}},L6=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=LVe(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),$Ve(r,i,n,"aria-hidden")):function(){return null}},V6="Dialog",[ase,ose]=Uc(V6),[jVe,Cf]=ase(V6),sse=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=t,s=D.useRef(null),c=D.useRef(null),[l,u]=xd({prop:r,defaultProp:i??!1,onChange:a,caller:V6});return w.jsx(jVe,{scope:e,triggerRef:s,contentRef:c,contentId:No(),titleId:No(),descriptionId:No(),open:l,onOpenChange:u,onOpenToggle:D.useCallback(()=>u(f=>!f),[u]),modal:o,children:n})};sse.displayName=V6;var cse="DialogTrigger",lse=D.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Cf(cse,n),a=$n(e,i.triggerRef);return w.jsx(Yt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ZA(i.open),...r,ref:a,onClick:Et(t.onClick,i.onOpenToggle)})});lse.displayName=cse;var YA="DialogPortal",[UVe,use]=ase(YA,{forceMount:void 0}),fse=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,a=Cf(YA,e);return w.jsx(UVe,{scope:e,forceMount:n,children:D.Children.map(r,o=>w.jsx(Lo,{present:n||a.open,children:w.jsx(f2,{asChild:!0,container:i,children:o})}))})};fse.displayName=YA;var v_="DialogOverlay",dse=D.forwardRef((t,e)=>{const n=use(v_,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,a=Cf(v_,t.__scopeDialog);return a.modal?w.jsx(Lo,{present:r||a.open,children:w.jsx(BVe,{...i,ref:e})}):null});dse.displayName=v_;var FVe=Hg("DialogOverlay.RemoveScroll"),BVe=D.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Cf(v_,n);return w.jsx(mb,{as:FVe,allowPinchZoom:!0,shards:[i.contentRef],children:w.jsx(Yt.div,{"data-state":ZA(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Gm="DialogContent",hse=D.forwardRef((t,e)=>{const n=use(Gm,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,a=Cf(Gm,t.__scopeDialog);return w.jsx(Lo,{present:r||a.open,children:a.modal?w.jsx(zVe,{...i,ref:e}):w.jsx(GVe,{...i,ref:e})})});hse.displayName=Gm;var zVe=D.forwardRef((t,e)=>{const n=Cf(Gm,t.__scopeDialog),r=D.useRef(null),i=$n(e,n.contentRef,r);return D.useEffect(()=>{const a=r.current;if(a)return L6(a)},[]),w.jsx(gse,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Et(t.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Et(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,s=o.button===0&&o.ctrlKey===!0;(o.button===2||s)&&a.preventDefault()}),onFocusOutside:Et(t.onFocusOutside,a=>a.preventDefault())})}),GVe=D.forwardRef((t,e)=>{const n=Cf(Gm,t.__scopeDialog),r=D.useRef(!1),i=D.useRef(!1);return w.jsx(gse,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{t.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||n.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:a=>{t.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;n.triggerRef.current?.contains(o)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),gse=D.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=t,s=Cf(Gm,n),c=D.useRef(null),l=$n(e,c);return k6(),w.jsxs(w.Fragment,{children:[w.jsx(pb,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:w.jsx(u2,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ZA(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),w.jsxs(w.Fragment,{children:[w.jsx(HVe,{titleId:s.titleId}),w.jsx(KVe,{contentRef:c,descriptionId:s.descriptionId})]})]})}),XA="DialogTitle",pse=D.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Cf(XA,n);return w.jsx(Yt.h2,{id:i.titleId,...r,ref:e})});pse.displayName=XA;var mse="DialogDescription",vse=D.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Cf(mse,n);return w.jsx(Yt.p,{id:i.descriptionId,...r,ref:e})});vse.displayName=mse;var yse="DialogClose",xse=D.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Cf(yse,n);return w.jsx(Yt.button,{type:"button",...r,ref:e,onClick:Et(t.onClick,()=>i.onOpenChange(!1))})});xse.displayName=yse;function ZA(t){return t?"open":"closed"}var wse="DialogTitleWarning",[WVe,bse]=DLe(wse,{contentName:Gm,titleName:XA,docsSlug:"dialog"}),HVe=({titleId:t})=>{const e=bse(wse),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 D.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},qVe="DialogDescriptionWarning",KVe=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${bse(qVe).contentName}}.`;return D.useEffect(()=>{const i=t.current?.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},QA=sse,YVe=lse,JA=fse,eL=dse,tL=hse,Sse=pse,Cse=vse,nL=xse;/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const XVe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ZVe=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),dK=t=>{const e=ZVe(t);return e.charAt(0).toUpperCase()+e.slice(1)},_se=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),QVe=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var JVe={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.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const e$e=D.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:o,...s},c)=>D.createElement("svg",{ref:c,...JVe,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:_se("lucide",i),...!a&&!QVe(s)&&{"aria-hidden":"true"},...s},[...o.map(([l,u])=>D.createElement(l,u)),...Array.isArray(a)?a:[a]]));/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mt=(t,e)=>{const n=D.forwardRef(({className:r,...i},a)=>D.createElement(e$e,{ref:a,iconNode:e,className:_se(`lucide-${XVe(dK(t))}`,`lucide-${t}`,r),...i}));return n.displayName=dK(t),n};/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const t$e=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Tse=Mt("activity",t$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const n$e=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],r$e=Mt("archive",n$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const i$e=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],rL=Mt("arrow-left",i$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const a$e=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],o$e=Mt("arrow-up",a$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const s$e=[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]],c$e=Mt("calendar-range",s$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const l$e=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],K0=Mt("calendar",l$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const u$e=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],f$e=Mt("chart-no-axes-column",u$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const d$e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],$6=Mt("check",d$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const h$e=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],iL=Mt("chevron-down",h$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const g$e=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],aL=Mt("chevron-left",g$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const p$e=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],qg=Mt("chevron-right",p$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const m$e=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],v$e=Mt("chevron-up",m$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const y$e=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Ese=Mt("chevrons-up-down",y$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const x$e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],w$e=Mt("circle-alert",x$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const b$e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],hK=Mt("circle-user",b$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const S$e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],C$e=Mt("circle",S$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _$e=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ose=Mt("clock",_$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const T$e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],gK=Mt("columns-2",T$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const E$e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],O$e=Mt("contrast",E$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const D$e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]],M$e=Mt("crosshair",D$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const R$e=[["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"}]],I$e=Mt("database",R$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const N$e=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],vb=Mt("download",N$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const P$e=[["path",{d:"m12.99 6.74 1.93 3.44",key:"iwagvd"}],["path",{d:"M19.136 12a10 10 0 0 1-14.271 0",key:"ppmlo4"}],["path",{d:"m21 21-2.16-3.84",key:"vylbct"}],["path",{d:"m3 21 8.02-14.26",key:"1ssaw4"}],["circle",{cx:"12",cy:"5",r:"2",key:"f1ur92"}]],k$e=Mt("drafting-compass",P$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const A$e=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Dse=Mt("ellipsis-vertical",A$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const L$e=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],V$e=Mt("eraser",L$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $$e=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],j$e=Mt("eye",$$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const U$e=[["path",{d:"M14.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"16lz6z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 13.1a2 2 0 0 0-1 1.76v3.24a2 2 0 0 0 .97 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01Z",key:"99pj1s"}],["path",{d:"M7 17v5",key:"1yj1jh"}],["path",{d:"M11.7 14.2 7 17l-4.7-2.8",key:"1yk8tc"}]],F$e=Mt("file-box",U$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const B$e=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Mse=Mt("file-text",B$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const z$e=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],G$e=Mt("git-branch",z$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const W$e=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],H$e=Mt("grid-2x2",W$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const q$e=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],j6=Mt("hard-drive",q$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const K$e=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Y$e=Mt("hash",K$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const X$e=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Z$e=Mt("history",X$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Q$e=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],J$e=Mt("house",Q$e);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eje=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Rse=Mt("languages",eje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tje=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],nje=Mt("layout-grid",tje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rje=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],ije=Mt("list-checks",rje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aje=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Ise=Mt("list",aje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oje=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],U6=Mt("loader-circle",oje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sje=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],cje=Mt("lock",sje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lje=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],uje=Mt("log-out",lje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fje=[["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"}]],dje=Mt("maximize-2",fje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hje=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],gje=Mt("monitor-smartphone",hje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pje=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],oL=Mt("monitor",pje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mje=[["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"}]],Nse=Mt("moon",mje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vje=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],yje=Mt("move",vje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xje=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],wje=Mt("network",xje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bje=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]],Sje=Mt("notepad-text",bje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cje=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],_je=Mt("play",Cje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tje=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bw=Mt("plus",Tje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Eje=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Oje=Mt("radio",Eje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dje=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],Mje=Mt("refresh-ccw",Dje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rje=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ije=Mt("refresh-cw",Rje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nje=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Pje=Mt("rotate-cw",Nje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kje=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],Aje=Mt("rows-2",kje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lje=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]],Vje=Mt("ruler",Lje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $je=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],F6=Mt("save",$je);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jje=[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Uje=Mt("search-x",jje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fje=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],d2=Mt("search",Fje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bje=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],B6=Mt("server",Bje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zje=[["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"}]],Gje=Mt("settings",zje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wje=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M6.376 18.91a6 6 0 0 1 11.249.003",key:"hnjrf2"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}]],Hje=Mt("shield-user",Wje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qje=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],sL=Mt("square-pen",qje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kje=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Yje=Mt("square-x",Kje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xje=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],pK=Mt("square",Xje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zje=[["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"}]],cL=Mt("sun",Zje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qje=[["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"}]],Sw=Mt("trash-2",Qje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jje=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],eUe=Mt("trending-up",Jje);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tUe=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],nUe=Mt("type",tUe);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rUe=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],iUe=Mt("upload",rUe);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aUe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],oUe=Mt("user-x",aUe);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sUe=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Pse=Mt("user",sUe);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cUe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],lUe=Mt("users",cUe);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uUe=[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]],lL=Mt("view",uUe);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fUe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Kg=Mt("x",fUe);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dUe=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],hUe=Mt("zoom-in",dUe);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gUe=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],pUe=Mt("zoom-out",gUe);function dp({...t}){return w.jsx(QA,{"data-slot":"dialog",...t})}function mUe({...t}){return w.jsx(JA,{"data-slot":"dialog-portal",...t})}function vUe({className:t,...e}){return w.jsx(eL,{"data-slot":"dialog-overlay",className:rt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function hp({className:t,children:e,showCloseButton:n=!0,...r}){return w.jsxs(mUe,{"data-slot":"dialog-portal",children:[w.jsx(vUe,{}),w.jsxs(tL,{"data-slot":"dialog-content",className:rt("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...r,children:[e,n&&w.jsxs(nL,{"data-slot":"dialog-close",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:[w.jsx(Kg,{}),w.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function gp({className:t,...e}){return w.jsx("div",{"data-slot":"dialog-header",className:rt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function uL({className:t,...e}){return w.jsx("div",{"data-slot":"dialog-footer",className:rt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function pp({className:t,...e}){return w.jsx(Sse,{"data-slot":"dialog-title",className:rt("text-lg leading-none font-semibold",t),...e})}function z6({className:t,...e}){return w.jsx(Cse,{"data-slot":"dialog-description",className:rt("text-muted-foreground text-sm",t),...e})}const yUe=({isOpen:t,onOpenChange:e,persons:n,onSelect:r,isLoading:i})=>{const{t:a}=Hn("login");return w.jsx(dp,{open:t,onOpenChange:e,children:w.jsxs(hp,{className:Up.dialogContent,children:[w.jsxs(gp,{children:[w.jsx(pp,{children:a("person_select_modal.title")}),w.jsx(z6,{children:a("person_select_modal.description")})]}),w.jsx("div",{className:"py-4",children:w.jsx("div",{className:Up.listContainer,children:n.map(o=>w.jsxs(bt,{variant:"outline",className:Up.personItem,onClick:()=>r(o.id),disabled:i,children:[i&&w.jsx(Jo,{size:"sm",className:Up.spinner}),w.jsxs("div",{className:Up.textContent,children:[w.jsx("p",{className:Up.personName,children:`${o.last_name} ${o.first_name} ${o.patr_name}`}),o.post_name&&w.jsx("p",{className:Up.personPost,children:o.post_name})]})]},o.id))})})]})})},y_=t=>{t.key===" "&&t.preventDefault()},mK=t=>{let e;const n=new Set,r=(l,u)=>{const f=typeof l=="function"?l(e):l;if(!Object.is(f,e)){const d=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(h=>h(e,d))}},i=()=>e,s={setState:r,getState:i,getInitialState:()=>c,subscribe:l=>(n.add(l),()=>n.delete(l))},c=e=t(r,i,s);return s},xUe=(t=>t?mK(t):mK),wUe=t=>t;function bUe(t,e=wUe){const n=Ce.useSyncExternalStore(t.subscribe,Ce.useCallback(()=>e(t.getState()),[t,e]),Ce.useCallback(()=>e(t.getInitialState()),[t,e]));return Ce.useDebugValue(n),n}const SUe=t=>{const e=xUe(t),n=r=>bUe(e,r);return Object.assign(n,e),n},kse=(t=>SUe);function CUe(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var a;const o=c=>c===null?null:JSON.parse(c,void 0),s=(a=n.getItem(i))!=null?a:null;return s instanceof Promise?s.then(o):o(s)},setItem:(i,a)=>n.setItem(i,JSON.stringify(a,void 0)),removeItem:i=>n.removeItem(i)}}const mN=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return mN(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return mN(r)(n)}}}},_Ue=(t,e)=>(n,r,i)=>{let a={storage:CUe(()=>localStorage),partialize:p=>p,version:0,merge:(p,y)=>({...y,...p}),...e},o=!1;const s=new Set,c=new Set;let l=a.storage;if(!l)return t((...p)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...p)},r,i);const u=()=>{const p=a.partialize({...r()});return l.setItem(a.name,{state:p,version:a.version})},f=i.setState;i.setState=(p,y)=>(f(p,y),u());const d=t((...p)=>(n(...p),u()),r,i);i.getInitialState=()=>d;let h;const m=()=>{var p,y;if(!l)return;o=!1,s.forEach(S=>{var C;return S((C=r())!=null?C:d)});const x=((y=a.onRehydrateStorage)==null?void 0:y.call(a,(p=r())!=null?p:d))||void 0;return mN(l.getItem.bind(l))(a.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==a.version){if(a.migrate){const C=a.migrate(S.state,S.version);return C instanceof Promise?C.then(_=>[!0,_]):[!0,C]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var C;const[_,T]=S;if(h=a.merge(T,(C=r())!=null?C:d),n(h,!0),_)return u()}).then(()=>{x?.(h,void 0),h=r(),o=!0,c.forEach(S=>S(h))}).catch(S=>{x?.(void 0,S)})};return i.persist={setOptions:p=>{a={...a,...p},p.storage&&(l=p.storage)},clearStorage:()=>{l?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>m(),hasHydrated:()=>o,onHydrate:p=>(s.add(p),()=>{s.delete(p)}),onFinishHydration:p=>(c.add(p),()=>{c.delete(p)})},a.skipHydration||m(),h||d},Ase=_Ue,Yg=kse()(Ase(t=>({user:null,isAuth:!1,setUser:e=>t({user:e,isAuth:!0}),clearUser:()=>t({user:null,isAuth:!1})}),{name:"user-storage"})),Lse=()=>{const t=Yg(n=>n.user),e=Yg(n=>n.clearUser);return{user:t,clearUser:e}};function Vse(t,e){return function(){return t.apply(e,arguments)}}const{toString:TUe}=Object.prototype,{getPrototypeOf:fL}=Object,{iterator:G6,toStringTag:$se}=Symbol,W6=(t=>e=>{const n=TUe.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),_f=t=>(t=t.toLowerCase(),e=>W6(e)===t),H6=t=>e=>typeof e===t,{isArray:h2}=Array,Cy=H6("undefined");function yb(t){return t!==null&&!Cy(t)&&t.constructor!==null&&!Cy(t.constructor)&&Pc(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const jse=_f("ArrayBuffer");function EUe(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&jse(t.buffer),e}const OUe=H6("string"),Pc=H6("function"),Use=H6("number"),xb=t=>t!==null&&typeof t=="object",DUe=t=>t===!0||t===!1,cC=t=>{if(W6(t)!=="object")return!1;const e=fL(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!($se in t)&&!(G6 in t)},MUe=t=>{if(!xb(t)||yb(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},RUe=_f("Date"),IUe=_f("File"),NUe=_f("Blob"),PUe=_f("FileList"),kUe=t=>xb(t)&&Pc(t.pipe),AUe=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Pc(t.append)&&((e=W6(t))==="formdata"||e==="object"&&Pc(t.toString)&&t.toString()==="[object FormData]"))},LUe=_f("URLSearchParams"),[VUe,$Ue,jUe,UUe]=["ReadableStream","Request","Response","Headers"].map(_f),FUe=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function wb(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),h2(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{if(yb(t))return;const a=n?Object.getOwnPropertyNames(t):Object.keys(t),o=a.length;let s;for(r=0;r<o;r++)s=a[r],e.call(null,t[s],s,t)}}function Fse(t,e){if(yb(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,i;for(;r-- >0;)if(i=n[r],e===i.toLowerCase())return i;return null}const vm=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Bse=t=>!Cy(t)&&t!==vm;function vN(){const{caseless:t,skipUndefined:e}=Bse(this)&&this||{},n={},r=(i,a)=>{const o=t&&Fse(n,a)||a;cC(n[o])&&cC(i)?n[o]=vN(n[o],i):cC(i)?n[o]=vN({},i):h2(i)?n[o]=i.slice():(!e||!Cy(i))&&(n[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&wb(arguments[i],r);return n}const BUe=(t,e,n,{allOwnKeys:r}={})=>(wb(e,(i,a)=>{n&&Pc(i)?t[a]=Vse(i,n):t[a]=i},{allOwnKeys:r}),t),zUe=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),GUe=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},WUe=(t,e,n,r)=>{let i,a,o;const s={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),a=i.length;a-- >0;)o=i[a],(!r||r(o,t,e))&&!s[o]&&(e[o]=t[o],s[o]=!0);t=n!==!1&&fL(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},HUe=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},qUe=t=>{if(!t)return null;if(h2(t))return t;let e=t.length;if(!Use(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},KUe=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&fL(Uint8Array)),YUe=(t,e)=>{const r=(t&&t[G6]).call(t);let i;for(;(i=r.next())&&!i.done;){const a=i.value;e.call(t,a[0],a[1])}},XUe=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},ZUe=_f("HTMLFormElement"),QUe=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),vK=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),JUe=_f("RegExp"),zse=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};wb(n,(i,a)=>{let o;(o=e(i,a,t))!==!1&&(r[a]=o||i)}),Object.defineProperties(t,r)},eFe=t=>{zse(t,(e,n)=>{if(Pc(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Pc(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},tFe=(t,e)=>{const n={},r=i=>{i.forEach(a=>{n[a]=!0})};return h2(t)?r(t):r(String(t).split(e)),n},nFe=()=>{},rFe=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function iFe(t){return!!(t&&Pc(t.append)&&t[$se]==="FormData"&&t[G6])}const aFe=t=>{const e=new Array(10),n=(r,i)=>{if(xb(r)){if(e.indexOf(r)>=0)return;if(yb(r))return r;if(!("toJSON"in r)){e[i]=r;const a=h2(r)?[]:{};return wb(r,(o,s)=>{const c=n(o,i+1);!Cy(c)&&(a[s]=c)}),e[i]=void 0,a}}return r};return n(t,0)},oFe=_f("AsyncFunction"),sFe=t=>t&&(xb(t)||Pc(t))&&Pc(t.then)&&Pc(t.catch),Gse=((t,e)=>t?setImmediate:e?((n,r)=>(vm.addEventListener("message",({source:i,data:a})=>{i===vm&&a===n&&r.length&&r.shift()()},!1),i=>{r.push(i),vm.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Pc(vm.postMessage)),cFe=typeof queueMicrotask<"u"?queueMicrotask.bind(vm):typeof process<"u"&&process.nextTick||Gse,lFe=t=>t!=null&&Pc(t[G6]),We={isArray:h2,isArrayBuffer:jse,isBuffer:yb,isFormData:AUe,isArrayBufferView:EUe,isString:OUe,isNumber:Use,isBoolean:DUe,isObject:xb,isPlainObject:cC,isEmptyObject:MUe,isReadableStream:VUe,isRequest:$Ue,isResponse:jUe,isHeaders:UUe,isUndefined:Cy,isDate:RUe,isFile:IUe,isBlob:NUe,isRegExp:JUe,isFunction:Pc,isStream:kUe,isURLSearchParams:LUe,isTypedArray:KUe,isFileList:PUe,forEach:wb,merge:vN,extend:BUe,trim:FUe,stripBOM:zUe,inherits:GUe,toFlatObject:WUe,kindOf:W6,kindOfTest:_f,endsWith:HUe,toArray:qUe,forEachEntry:YUe,matchAll:XUe,isHTMLForm:ZUe,hasOwnProperty:vK,hasOwnProp:vK,reduceDescriptors:zse,freezeMethods:eFe,toObjectSet:tFe,toCamelCase:QUe,noop:nFe,toFiniteNumber:rFe,findKey:Fse,global:vm,isContextDefined:Bse,isSpecCompliantForm:iFe,toJSONObject:aFe,isAsyncFn:oFe,isThenable:sFe,setImmediate:Gse,asap:cFe,isIterable:lFe};function Gn(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}We.inherits(Gn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:We.toJSONObject(this.config),code:this.code,status:this.status}}});const Wse=Gn.prototype,Hse={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Hse[t]={value:t}});Object.defineProperties(Gn,Hse);Object.defineProperty(Wse,"isAxiosError",{value:!0});Gn.from=(t,e,n,r,i,a)=>{const o=Object.create(Wse);We.toFlatObject(t,o,function(u){return u!==Error.prototype},l=>l!=="isAxiosError");const s=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return Gn.call(o,s,c,n,r,i),t&&o.cause==null&&Object.defineProperty(o,"cause",{value:t,configurable:!0}),o.name=t&&t.name||"Error",a&&Object.assign(o,a),o};const uFe=null;function yN(t){return We.isPlainObject(t)||We.isArray(t)}function qse(t){return We.endsWith(t,"[]")?t.slice(0,-2):t}function yK(t,e,n){return t?t.concat(e).map(function(i,a){return i=qse(i),!n&&a?"["+i+"]":i}).join(n?".":""):e}function fFe(t){return We.isArray(t)&&!t.some(yN)}const dFe=We.toFlatObject(We,{},null,function(e){return/^is[A-Z]/.test(e)});function q6(t,e,n){if(!We.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=We.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,y){return!We.isUndefined(y[p])});const r=n.metaTokens,i=n.visitor||u,a=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&We.isSpecCompliantForm(e);if(!We.isFunction(i))throw new TypeError("visitor must be a function");function l(m){if(m===null)return"";if(We.isDate(m))return m.toISOString();if(We.isBoolean(m))return m.toString();if(!c&&We.isBlob(m))throw new Gn("Blob is not supported. Use a Buffer instead.");return We.isArrayBuffer(m)||We.isTypedArray(m)?c&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function u(m,p,y){let x=m;if(m&&!y&&typeof m=="object"){if(We.endsWith(p,"{}"))p=r?p:p.slice(0,-2),m=JSON.stringify(m);else if(We.isArray(m)&&fFe(m)||(We.isFileList(m)||We.endsWith(p,"[]"))&&(x=We.toArray(m)))return p=qse(p),x.forEach(function(C,_){!(We.isUndefined(C)||C===null)&&e.append(o===!0?yK([p],_,a):o===null?p:p+"[]",l(C))}),!1}return yN(m)?!0:(e.append(yK(y,p,a),l(m)),!1)}const f=[],d=Object.assign(dFe,{defaultVisitor:u,convertValue:l,isVisitable:yN});function h(m,p){if(!We.isUndefined(m)){if(f.indexOf(m)!==-1)throw Error("Circular reference detected in "+p.join("."));f.push(m),We.forEach(m,function(x,S){(!(We.isUndefined(x)||x===null)&&i.call(e,x,We.isString(S)?S.trim():S,p,d))===!0&&h(x,p?p.concat(S):[S])}),f.pop()}}if(!We.isObject(t))throw new TypeError("data must be an object");return h(t),e}function xK(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function dL(t,e){this._pairs=[],t&&q6(t,this,e)}const Kse=dL.prototype;Kse.append=function(e,n){this._pairs.push([e,n])};Kse.toString=function(e){const n=e?function(r){return e.call(this,r,xK)}:xK;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function hFe(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Yse(t,e,n){if(!e)return t;const r=n&&n.encode||hFe;We.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let a;if(i?a=i(e,n):a=We.isURLSearchParams(e)?e.toString():new dL(e,n).toString(r),a){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+a}return t}class wK{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){We.forEach(this.handlers,function(r){r!==null&&e(r)})}}const Xse={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},gFe=typeof URLSearchParams<"u"?URLSearchParams:dL,pFe=typeof FormData<"u"?FormData:null,mFe=typeof Blob<"u"?Blob:null,vFe={isBrowser:!0,classes:{URLSearchParams:gFe,FormData:pFe,Blob:mFe},protocols:["http","https","file","blob","url","data"]},hL=typeof window<"u"&&typeof document<"u",xN=typeof navigator=="object"&&navigator||void 0,yFe=hL&&(!xN||["ReactNative","NativeScript","NS"].indexOf(xN.product)<0),xFe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",wFe=hL&&window.location.href||"http://localhost",bFe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:hL,hasStandardBrowserEnv:yFe,hasStandardBrowserWebWorkerEnv:xFe,navigator:xN,origin:wFe},Symbol.toStringTag,{value:"Module"})),_s={...bFe,...vFe};function SFe(t,e){return q6(t,new _s.classes.URLSearchParams,{visitor:function(n,r,i,a){return _s.isNode&&We.isBuffer(n)?(this.append(r,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...e})}function CFe(t){return We.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function _Fe(t){const e={},n=Object.keys(t);let r;const i=n.length;let a;for(r=0;r<i;r++)a=n[r],e[a]=t[a];return e}function Zse(t){function e(n,r,i,a){let o=n[a++];if(o==="__proto__")return!0;const s=Number.isFinite(+o),c=a>=n.length;return o=!o&&We.isArray(i)?i.length:o,c?(We.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!s):((!i[o]||!We.isObject(i[o]))&&(i[o]=[]),e(n,r,i[o],a)&&We.isArray(i[o])&&(i[o]=_Fe(i[o])),!s)}if(We.isFormData(t)&&We.isFunction(t.entries)){const n={};return We.forEachEntry(t,(r,i)=>{e(CFe(r),i,n,0)}),n}return null}function TFe(t,e,n){if(We.isString(t))try{return(e||JSON.parse)(t),We.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const bb={transitional:Xse,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,a=We.isObject(e);if(a&&We.isHTMLForm(e)&&(e=new FormData(e)),We.isFormData(e))return i?JSON.stringify(Zse(e)):e;if(We.isArrayBuffer(e)||We.isBuffer(e)||We.isStream(e)||We.isFile(e)||We.isBlob(e)||We.isReadableStream(e))return e;if(We.isArrayBufferView(e))return e.buffer;if(We.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return SFe(e,this.formSerializer).toString();if((s=We.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return q6(s?{"files[]":e}:e,c&&new c,this.formSerializer)}}return a||i?(n.setContentType("application/json",!1),TFe(e)):e}],transformResponse:[function(e){const n=this.transitional||bb.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(We.isResponse(e)||We.isReadableStream(e))return e;if(e&&We.isString(e)&&(r&&!this.responseType||i)){const o=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(s){if(o)throw s.name==="SyntaxError"?Gn.from(s,Gn.ERR_BAD_RESPONSE,this,null,this.response):s}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_s.classes.FormData,Blob:_s.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};We.forEach(["delete","get","head","post","put","patch"],t=>{bb.headers[t]={}});const EFe=We.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),OFe=t=>{const e={};let n,r,i;return t&&t.split(`
`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||e[n]&&EFe[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},bK=Symbol("internals");function Vx(t){return t&&String(t).trim().toLowerCase()}function lC(t){return t===!1||t==null?t:We.isArray(t)?t.map(lC):String(t)}function DFe(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const MFe=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function pD(t,e,n,r,i){if(We.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!We.isString(e)){if(We.isString(r))return e.indexOf(r)!==-1;if(We.isRegExp(r))return r.test(e)}}function RFe(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function IFe(t,e){const n=We.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,a,o){return this[r].call(this,e,i,a,o)},configurable:!0})})}let kc=class{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function a(s,c,l){const u=Vx(c);if(!u)throw new Error("header name must be a non-empty string");const f=We.findKey(i,u);(!f||i[f]===void 0||l===!0||l===void 0&&i[f]!==!1)&&(i[f||c]=lC(s))}const o=(s,c)=>We.forEach(s,(l,u)=>a(l,u,c));if(We.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(We.isString(e)&&(e=e.trim())&&!MFe(e))o(OFe(e),n);else if(We.isObject(e)&&We.isIterable(e)){let s={},c,l;for(const u of e){if(!We.isArray(u))throw TypeError("Object iterator must return a key-value pair");s[l=u[0]]=(c=s[l])?We.isArray(c)?[...c,u[1]]:[c,u[1]]:u[1]}o(s,n)}else e!=null&&a(n,e,r);return this}get(e,n){if(e=Vx(e),e){const r=We.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return DFe(i);if(We.isFunction(n))return n.call(this,i,r);if(We.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Vx(e),e){const r=We.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||pD(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function a(o){if(o=Vx(o),o){const s=We.findKey(r,o);s&&(!n||pD(r,r[s],s,n))&&(delete r[s],i=!0)}}return We.isArray(e)?e.forEach(a):a(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const a=n[r];(!e||pD(this,this[a],a,e,!0))&&(delete this[a],i=!0)}return i}normalize(e){const n=this,r={};return We.forEach(this,(i,a)=>{const o=We.findKey(r,a);if(o){n[o]=lC(i),delete n[a];return}const s=e?RFe(a):String(a).trim();s!==a&&delete n[a],n[s]=lC(i),r[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return We.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&We.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[bK]=this[bK]={accessors:{}}).accessors,i=this.prototype;function a(o){const s=Vx(o);r[s]||(IFe(i,o),r[s]=!0)}return We.isArray(e)?e.forEach(a):a(e),this}};kc.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);We.reduceDescriptors(kc.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});We.freezeMethods(kc);function mD(t,e){const n=this||bb,r=e||n,i=kc.from(r.headers);let a=r.data;return We.forEach(t,function(s){a=s.call(n,a,i.normalize(),e?e.status:void 0)}),i.normalize(),a}function Qse(t){return!!(t&&t.__CANCEL__)}function g2(t,e,n){Gn.call(this,t??"canceled",Gn.ERR_CANCELED,e,n),this.name="CanceledError"}We.inherits(g2,Gn,{__CANCEL__:!0});function Jse(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Gn("Request failed with status code "+n.status,[Gn.ERR_BAD_REQUEST,Gn.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function NFe(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function PFe(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,a=0,o;return e=e!==void 0?e:1e3,function(c){const l=Date.now(),u=r[a];o||(o=l),n[i]=c,r[i]=l;let f=a,d=0;for(;f!==i;)d+=n[f++],f=f%t;if(i=(i+1)%t,i===a&&(a=(a+1)%t),l-o<e)return;const h=u&&l-u;return h?Math.round(d*1e3/h):void 0}}function kFe(t,e){let n=0,r=1e3/e,i,a;const o=(l,u=Date.now())=>{n=u,i=null,a&&(clearTimeout(a),a=null),t(...l)};return[(...l)=>{const u=Date.now(),f=u-n;f>=r?o(l,u):(i=l,a||(a=setTimeout(()=>{a=null,o(i)},r-f)))},()=>i&&o(i)]}const x_=(t,e,n=3)=>{let r=0;const i=PFe(50,250);return kFe(a=>{const o=a.loaded,s=a.lengthComputable?a.total:void 0,c=o-r,l=i(c),u=o<=s;r=o;const f={loaded:o,total:s,progress:s?o/s:void 0,bytes:c,rate:l||void 0,estimated:l&&s&&u?(s-o)/l:void 0,event:a,lengthComputable:s!=null,[e?"download":"upload"]:!0};t(f)},n)},SK=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},CK=t=>(...e)=>We.asap(()=>t(...e)),AFe=_s.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,_s.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(_s.origin),_s.navigator&&/(msie|trident)/i.test(_s.navigator.userAgent)):()=>!0,LFe=_s.hasStandardBrowserEnv?{write(t,e,n,r,i,a){const o=[t+"="+encodeURIComponent(e)];We.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),We.isString(r)&&o.push("path="+r),We.isString(i)&&o.push("domain="+i),a===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function VFe(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function $Fe(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function ece(t,e,n){let r=!VFe(e);return t&&(r||n==!1)?$Fe(t,e):e}const _K=t=>t instanceof kc?{...t}:t;function Wm(t,e){e=e||{};const n={};function r(l,u,f,d){return We.isPlainObject(l)&&We.isPlainObject(u)?We.merge.call({caseless:d},l,u):We.isPlainObject(u)?We.merge({},u):We.isArray(u)?u.slice():u}function i(l,u,f,d){if(We.isUndefined(u)){if(!We.isUndefined(l))return r(void 0,l,f,d)}else return r(l,u,f,d)}function a(l,u){if(!We.isUndefined(u))return r(void 0,u)}function o(l,u){if(We.isUndefined(u)){if(!We.isUndefined(l))return r(void 0,l)}else return r(void 0,u)}function s(l,u,f){if(f in e)return r(l,u);if(f in t)return r(void 0,l)}const c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(l,u,f)=>i(_K(l),_K(u),f,!0)};return We.forEach(Object.keys({...t,...e}),function(u){const f=c[u]||i,d=f(t[u],e[u],u);We.isUndefined(d)&&f!==s||(n[u]=d)}),n}const tce=t=>{const e=Wm({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:s}=e;if(e.headers=o=kc.from(o),e.url=Yse(ece(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),s&&o.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),We.isFormData(n)){if(_s.hasStandardBrowserEnv||_s.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(We.isFunction(n.getHeaders)){const c=n.getHeaders(),l=["content-type","content-length"];Object.entries(c).forEach(([u,f])=>{l.includes(u.toLowerCase())&&o.set(u,f)})}}if(_s.hasStandardBrowserEnv&&(r&&We.isFunction(r)&&(r=r(e)),r||r!==!1&&AFe(e.url))){const c=i&&a&&LFe.read(a);c&&o.set(i,c)}return e},jFe=typeof XMLHttpRequest<"u",UFe=jFe&&function(t){return new Promise(function(n,r){const i=tce(t);let a=i.data;const o=kc.from(i.headers).normalize();let{responseType:s,onUploadProgress:c,onDownloadProgress:l}=i,u,f,d,h,m;function p(){h&&h(),m&&m(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(i.method.toUpperCase(),i.url,!0),y.timeout=i.timeout;function x(){if(!y)return;const C=kc.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),T={data:!s||s==="text"||s==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:C,config:t,request:y};Jse(function(M){n(M),p()},function(M){r(M),p()},T),y=null}"onloadend"in y?y.onloadend=x:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(x)},y.onabort=function(){y&&(r(new Gn("Request aborted",Gn.ECONNABORTED,t,y)),y=null)},y.onerror=function(_){const T=_&&_.message?_.message:"Network Error",O=new Gn(T,Gn.ERR_NETWORK,t,y);O.event=_||null,r(O),y=null},y.ontimeout=function(){let _=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const T=i.transitional||Xse;i.timeoutErrorMessage&&(_=i.timeoutErrorMessage),r(new Gn(_,T.clarifyTimeoutError?Gn.ETIMEDOUT:Gn.ECONNABORTED,t,y)),y=null},a===void 0&&o.setContentType(null),"setRequestHeader"in y&&We.forEach(o.toJSON(),function(_,T){y.setRequestHeader(T,_)}),We.isUndefined(i.withCredentials)||(y.withCredentials=!!i.withCredentials),s&&s!=="json"&&(y.responseType=i.responseType),l&&([d,m]=x_(l,!0),y.addEventListener("progress",d)),c&&y.upload&&([f,h]=x_(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(u=C=>{y&&(r(!C||C.type?new g2(null,t,y):C),y.abort(),y=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const S=NFe(i.url);if(S&&_s.protocols.indexOf(S)===-1){r(new Gn("Unsupported protocol "+S+":",Gn.ERR_BAD_REQUEST,t));return}y.send(a||null)})},FFe=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const a=function(l){if(!i){i=!0,s();const u=l instanceof Error?l:this.reason;r.abort(u instanceof Gn?u:new g2(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,a(new Gn(`timeout ${e} of ms exceeded`,Gn.ETIMEDOUT))},e);const s=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(a):l.removeEventListener("abort",a)}),t=null)};t.forEach(l=>l.addEventListener("abort",a));const{signal:c}=r;return c.unsubscribe=()=>We.asap(s),c}},BFe=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,i;for(;r<n;)i=r+e,yield t.slice(r,i),r=i},zFe=async function*(t,e){for await(const n of GFe(t))yield*BFe(n,e)},GFe=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},TK=(t,e,n,r)=>{const i=zFe(t,e);let a=0,o,s=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:l,value:u}=await i.next();if(l){s(),c.close();return}let f=u.byteLength;if(n){let d=a+=f;n(d)}c.enqueue(new Uint8Array(u))}catch(l){throw s(l),l}},cancel(c){return s(c),i.return()}},{highWaterMark:2})},EK=64*1024,{isFunction:H4}=We,WFe=(({Request:t,Response:e})=>({Request:t,Response:e}))(We.global),{ReadableStream:OK,TextEncoder:DK}=We.global,MK=(t,...e)=>{try{return!!t(...e)}catch{return!1}},HFe=t=>{t=We.merge.call({skipUndefined:!0},WFe,t);const{fetch:e,Request:n,Response:r}=t,i=e?H4(e):typeof fetch=="function",a=H4(n),o=H4(r);if(!i)return!1;const s=i&&H4(OK),c=i&&(typeof DK=="function"?(m=>p=>m.encode(p))(new DK):async m=>new Uint8Array(await new n(m).arrayBuffer())),l=a&&s&&MK(()=>{let m=!1;const p=new n(_s.origin,{body:new OK,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!p}),u=o&&s&&MK(()=>We.isReadableStream(new r("").body)),f={stream:u&&(m=>m.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!f[m]&&(f[m]=(p,y)=>{let x=p&&p[m];if(x)return x.call(p);throw new Gn(`Response type '${m}' is not supported`,Gn.ERR_NOT_SUPPORT,y)})});const d=async m=>{if(m==null)return 0;if(We.isBlob(m))return m.size;if(We.isSpecCompliantForm(m))return(await new n(_s.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(We.isArrayBufferView(m)||We.isArrayBuffer(m))return m.byteLength;if(We.isURLSearchParams(m)&&(m=m+""),We.isString(m))return(await c(m)).byteLength},h=async(m,p)=>{const y=We.toFiniteNumber(m.getContentLength());return y??d(p)};return async m=>{let{url:p,method:y,data:x,signal:S,cancelToken:C,timeout:_,onDownloadProgress:T,onUploadProgress:O,responseType:M,headers:I,withCredentials:V="same-origin",fetchOptions:k}=tce(m),L=e||fetch;M=M?(M+"").toLowerCase():"text";let $=FFe([S,C&&C.toAbortSignal()],_),W=null;const G=$&&$.unsubscribe&&(()=>{$.unsubscribe()});let oe;try{if(O&&l&&y!=="get"&&y!=="head"&&(oe=await h(I,x))!==0){let ae=new n(p,{method:"POST",body:x,duplex:"half"}),re;if(We.isFormData(x)&&(re=ae.headers.get("content-type"))&&I.setContentType(re),ae.body){const[te,ye]=SK(oe,x_(CK(O)));x=TK(ae.body,EK,te,ye)}}We.isString(V)||(V=V?"include":"omit");const U=a&&"credentials"in n.prototype,Y={...k,signal:$,method:y.toUpperCase(),headers:I.normalize().toJSON(),body:x,duplex:"half",credentials:U?V:void 0};W=a&&new n(p,Y);let J=await(a?L(W,k):L(p,Y));const ne=u&&(M==="stream"||M==="response");if(u&&(T||ne&&G)){const ae={};["status","statusText","headers"].forEach(we=>{ae[we]=J[we]});const re=We.toFiniteNumber(J.headers.get("content-length")),[te,ye]=T&&SK(re,x_(CK(T),!0))||[];J=new r(TK(J.body,EK,te,()=>{ye&&ye(),G&&G()}),ae)}M=M||"text";let F=await f[We.findKey(f,M)||"text"](J,m);return!ne&&G&&G(),await new Promise((ae,re)=>{Jse(ae,re,{data:F,headers:kc.from(J.headers),status:J.status,statusText:J.statusText,config:m,request:W})})}catch(U){throw G&&G(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new Gn("Network Error",Gn.ERR_NETWORK,m,W),{cause:U.cause||U}):Gn.from(U,U&&U.code,m,W)}}},qFe=new Map,nce=t=>{let e=t?t.env:{};const{fetch:n,Request:r,Response:i}=e,a=[r,i,n];let o=a.length,s=o,c,l,u=qFe;for(;s--;)c=a[s],l=u.get(c),l===void 0&&u.set(c,l=s?new Map:HFe(e)),u=l;return l};nce();const wN={http:uFe,xhr:UFe,fetch:{get:nce}};We.forEach(wN,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const RK=t=>`- ${t}`,KFe=t=>We.isFunction(t)||t===null||t===!1,rce={getAdapter:(t,e)=>{t=We.isArray(t)?t:[t];const{length:n}=t;let r,i;const a={};for(let o=0;o<n;o++){r=t[o];let s;if(i=r,!KFe(r)&&(i=wN[(s=String(r)).toLowerCase()],i===void 0))throw new Gn(`Unknown adapter '${s}'`);if(i&&(We.isFunction(i)||(i=i.get(e))))break;a[s||"#"+o]=i}if(!i){const o=Object.entries(a).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let s=n?o.length>1?`since :
`+o.map(RK).join(`
`):" "+RK(o[0]):"as no adapter specified";throw new Gn("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return i},adapters:wN};function vD(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new g2(null,t)}function IK(t){return vD(t),t.headers=kc.from(t.headers),t.data=mD.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),rce.getAdapter(t.adapter||bb.adapter,t)(t).then(function(r){return vD(t),r.data=mD.call(t,t.transformResponse,r),r.headers=kc.from(r.headers),r},function(r){return Qse(r)||(vD(t),r&&r.response&&(r.response.data=mD.call(t,t.transformResponse,r.response),r.response.headers=kc.from(r.response.headers))),Promise.reject(r)})}const ice="1.12.2",K6={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{K6[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const NK={};K6.transitional=function(e,n,r){function i(a,o){return"[Axios v"+ice+"] Transitional option '"+a+"'"+o+(r?". "+r:"")}return(a,o,s)=>{if(e===!1)throw new Gn(i(o," has been removed"+(n?" in "+n:"")),Gn.ERR_DEPRECATED);return n&&!NK[o]&&(NK[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(a,o,s):!0}};K6.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function YFe(t,e,n){if(typeof t!="object")throw new Gn("options must be an object",Gn.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const a=r[i],o=e[a];if(o){const s=t[a],c=s===void 0||o(s,a,t);if(c!==!0)throw new Gn("option "+a+" must be "+c,Gn.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Gn("Unknown option "+a,Gn.ERR_BAD_OPTION)}}const uC={assertOptions:YFe,validators:K6},Wf=uC.validators;let Mm=class{constructor(e){this.defaults=e||{},this.interceptors={request:new wK,response:new wK}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const a=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?a&&!String(r.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(r.stack+=`
`+a):r.stack=a}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Wm(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:a}=n;r!==void 0&&uC.assertOptions(r,{silentJSONParsing:Wf.transitional(Wf.boolean),forcedJSONParsing:Wf.transitional(Wf.boolean),clarifyTimeoutError:Wf.transitional(Wf.boolean)},!1),i!=null&&(We.isFunction(i)?n.paramsSerializer={serialize:i}:uC.assertOptions(i,{encode:Wf.function,serialize:Wf.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),uC.assertOptions(n,{baseUrl:Wf.spelling("baseURL"),withXsrfToken:Wf.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=a&&We.merge(a.common,a[n.method]);a&&We.forEach(["delete","get","head","post","put","patch","common"],m=>{delete a[m]}),n.headers=kc.concat(o,a);const s=[];let c=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(n)===!1||(c=c&&p.synchronous,s.unshift(p.fulfilled,p.rejected))});const l=[];this.interceptors.response.forEach(function(p){l.push(p.fulfilled,p.rejected)});let u,f=0,d;if(!c){const m=[IK.bind(this),void 0];for(m.unshift(...s),m.push(...l),d=m.length,u=Promise.resolve(n);f<d;)u=u.then(m[f++],m[f++]);return u}d=s.length;let h=n;for(;f<d;){const m=s[f++],p=s[f++];try{h=m(h)}catch(y){p.call(this,y);break}}try{u=IK.call(this,h)}catch(m){return Promise.reject(m)}for(f=0,d=l.length;f<d;)u=u.then(l[f++],l[f++]);return u}getUri(e){e=Wm(this.defaults,e);const n=ece(e.baseURL,e.url,e.allowAbsoluteUrls);return Yse(n,e.params,e.paramsSerializer)}};We.forEach(["delete","get","head","options"],function(e){Mm.prototype[e]=function(n,r){return this.request(Wm(r||{},{method:e,url:n,data:(r||{}).data}))}});We.forEach(["post","put","patch"],function(e){function n(r){return function(a,o,s){return this.request(Wm(s||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:o}))}}Mm.prototype[e]=n(),Mm.prototype[e+"Form"]=n(!0)});let XFe=class ace{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(i=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](i);r._listeners=null}),this.promise.then=i=>{let a;const o=new Promise(s=>{r.subscribe(s),a=s}).then(i);return o.cancel=function(){r.unsubscribe(a)},o},e(function(a,o,s){r.reason||(r.reason=new g2(a,o,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new ace(function(i){e=i}),cancel:e}}};function ZFe(t){return function(n){return t.apply(null,n)}}function QFe(t){return We.isObject(t)&&t.isAxiosError===!0}const bN={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(bN).forEach(([t,e])=>{bN[e]=t});function oce(t){const e=new Mm(t),n=Vse(Mm.prototype.request,e);return We.extend(n,Mm.prototype,e,{allOwnKeys:!0}),We.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return oce(Wm(t,i))},n}const Pa=oce(bb);Pa.Axios=Mm;Pa.CanceledError=g2;Pa.CancelToken=XFe;Pa.isCancel=Qse;Pa.VERSION=ice;Pa.toFormData=q6;Pa.AxiosError=Gn;Pa.Cancel=Pa.CanceledError;Pa.all=function(e){return Promise.all(e)};Pa.spread=ZFe;Pa.isAxiosError=QFe;Pa.mergeConfig=Wm;Pa.AxiosHeaders=kc;Pa.formToJSON=t=>Zse(We.isHTMLForm(t)?new FormData(t):t);Pa.getAdapter=rce.getAdapter;Pa.HttpStatusCode=bN;Pa.default=Pa;const{Axios:IYt,AxiosError:NYt,CanceledError:PYt,isCancel:kYt,CancelToken:AYt,VERSION:LYt,all:VYt,Cancel:$Yt,isAxiosError:jYt,spread:UYt,toFormData:FYt,AxiosHeaders:BYt,HttpStatusCode:zYt,formToJSON:GYt,getAdapter:WYt,mergeConfig:HYt}=Pa,JFe="/api",eBe={baseURL:JFe,withCredentials:!0},ni=Pa.create(eBe);ni.interceptors.response.use(t=>t,t=>Promise.reject(t));class sce{static async authorization(e){return(await ni.post("/auth/login",e)).data}static async logout(e){return(await ni.post("/auth/logout",e)).data}}const tBe=()=>{const t=$c(),{t:e}=Hn("login"),n=Yg(i=>i.setUser),r=jc({mutationFn:i=>Br.promise(sce.authorization(i),{loading:e("authorization.loading"),success:a=>{if("need_select"in a&&a.need_select)return e("authorization.select_profile");if("success"in a&&a.success){const o=a;return n({id:o.user.id,login:o.user.login,last_name:o.user.last_name,first_name:o.user.first_name,patr_name:o.user.patr_name,is_admin:o.user.is_admin}),t.invalidateQueries({queryKey:["profile"]}),e("authorization.success")}return e("authorization.completed")},error:a=>{switch(a.response?.status){case 401:return e("authorization.unauthorized");case 403:return e("authorization.forbidden");case 404:return e("authorization.not_found");case 500:case 502:return e("authorization.server_error");default:return a.response?.data?.message?`${e("authorization.error_prefix")} ${a.response.data.message}`:e("authorization.invalid_credentials")}}}).unwrap()});return{needSelect:r.data&&"need_select"in r.data?r.data.need_select:!1,persons:r.data&&"persons"in r.data?r.data.persons:void 0,authorize:r.mutateAsync,isAuthorizationLoading:r.isPending}},nBe=()=>{const{t}=Hn("login"),e=Yg(a=>a.clearUser),n=Sf(),r=jc({mutationFn:sce.logout,onSuccess:()=>{e(),n(ws.LOGIN)}});return{logout:()=>{Br.promise(r.mutateAsync(),{loading:t("logout.loading"),error:()=>t("logout.error")})},isLoggingOut:r.isPending}},cce=Object.freeze({status:"aborted"});function Le(t,e,n){function r(s,c){var l;Object.defineProperty(s,"_zod",{value:s._zod??{},enumerable:!1}),(l=s._zod).traits??(l.traits=new Set),s._zod.traits.add(t),e(s,c);for(const u in o.prototype)u in s||Object.defineProperty(s,u,{value:o.prototype[u].bind(s)});s._zod.constr=o,s._zod.def=c}const i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:t});function o(s){var c;const l=n?.Parent?new a:this;r(l,s),(c=l._zod).deferred??(c.deferred=[]);for(const u of l._zod.deferred)u();return l}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>n?.Parent&&s instanceof n.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(o,"name",{value:t}),o}const lce=Symbol("zod_brand");class Rm extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Y6 extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const w_={};function nc(t){return t&&Object.assign(w_,t),w_}function rBe(t){return t}function iBe(t){return t}function aBe(t){}function oBe(t){throw new Error}function sBe(t){}function gL(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function xt(t,e="|"){return t.map(n=>Pn(n)).join(e)}function b_(t,e){return typeof e=="bigint"?e.toString():e}function Sb(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function w1(t){return t==null}function X6(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function uce(t,e){const n=(t.toString().split(".")[1]||"").length,r=e.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(i=Number.parseInt(c[1]))}const a=n>i?n:i,o=Number.parseInt(t.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return o%s/10**a}const PK=Symbol("evaluating");function sr(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==PK)return r===void 0&&(r=PK,r=n()),r},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function cBe(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function mp(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function _h(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function lBe(t){return _h(t._zod.def)}function uBe(t,e){return e?e.reduce((n,r)=>n?.[r],t):t}function fBe(t){const e=Object.keys(t),n=e.map(r=>t[r]);return Promise.all(n).then(r=>{const i={};for(let a=0;a<e.length;a++)i[e[a]]=r[a];return i})}function dBe(t=10){const e="abcdefghijklmnopqrstuvwxyz";let n="";for(let r=0;r<t;r++)n+=e[Math.floor(Math.random()*e.length)];return n}function SN(t){return JSON.stringify(t)}const pL="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function _y(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const fce=Sb(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Hm(t){if(_y(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(_y(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Z6(t){return Hm(t)?{...t}:Array.isArray(t)?[...t]:t}function hBe(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}const gBe=t=>{const e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},S_=new Set(["string","number","symbol"]),dce=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Xg(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Eu(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n?.parent)&&(r._zod.parent=t),r}function ht(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function pBe(t){let e;return new Proxy({},{get(n,r,i){return e??(e=t()),Reflect.get(e,r,i)},set(n,r,i,a){return e??(e=t()),Reflect.set(e,r,i,a)},has(n,r){return e??(e=t()),Reflect.has(e,r)},deleteProperty(n,r){return e??(e=t()),Reflect.deleteProperty(e,r)},ownKeys(n){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(n,r){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,r)},defineProperty(n,r,i){return e??(e=t()),Reflect.defineProperty(e,r,i)}})}function Pn(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function hce(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const gce={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},pce={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function mce(t,e){const n=t._zod.def,r=_h(t._zod.def,{get shape(){const i={};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=n.shape[a])}return mp(this,"shape",i),i},checks:[]});return Eu(t,r)}function vce(t,e){const n=t._zod.def,r=_h(t._zod.def,{get shape(){const i={...t._zod.def.shape};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return mp(this,"shape",i),i},checks:[]});return Eu(t,r)}function yce(t,e){if(!Hm(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const i=_h(t._zod.def,{get shape(){const a={...t._zod.def.shape,...e};return mp(this,"shape",a),a},checks:[]});return Eu(t,i)}function xce(t,e){if(!Hm(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...t._zod.def,get shape(){const r={...t._zod.def.shape,...e};return mp(this,"shape",r),r},checks:t._zod.def.checks};return Eu(t,n)}function wce(t,e){const n=_h(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return mp(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return Eu(t,n)}function bce(t,e,n){const r=_h(e._zod.def,{get shape(){const i=e._zod.def.shape,a={...i};if(n)for(const o in n){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(a[o]=t?new t({type:"optional",innerType:i[o]}):i[o])}else for(const o in i)a[o]=t?new t({type:"optional",innerType:i[o]}):i[o];return mp(this,"shape",a),a},checks:[]});return Eu(e,r)}function Sce(t,e,n){const r=_h(e._zod.def,{get shape(){const i=e._zod.def.shape,a={...i};if(n)for(const o in n){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(a[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(const o in i)a[o]=new t({type:"nonoptional",innerType:i[o]});return mp(this,"shape",a),a},checks:[]});return Eu(e,r)}function ym(t,e=0){if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue!==!0)return!0;return!1}function af(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function h5(t){return typeof t=="string"?t:t?.message}function df(t,e,n){const r={...t,path:t.path??[]};if(!t.message){const i=h5(t.inst?._zod.def?.error?.(t))??h5(e?.error?.(t))??h5(n.customError?.(t))??h5(n.localeError?.(t))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,e?.reportInput||delete r.input,r}function Q6(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function J6(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Ty(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}function mBe(t){return Object.entries(t).filter(([e,n])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Cce(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}function _ce(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function vBe(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-e.length%4)%4);return Cce(e+n)}function yBe(t){return _ce(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function xBe(t){const e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");const n=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)n[r/2]=Number.parseInt(e.slice(r,r+2),16);return n}function wBe(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}class bBe{constructor(...e){}}const Tce=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:pce,Class:bBe,NUMBER_FORMAT_RANGES:gce,aborted:ym,allowsEval:fce,assert:sBe,assertEqual:rBe,assertIs:aBe,assertNever:oBe,assertNotEqual:iBe,assignProp:mp,base64ToUint8Array:Cce,base64urlToUint8Array:vBe,cached:Sb,captureStackTrace:pL,cleanEnum:mBe,cleanRegex:X6,clone:Eu,cloneDef:lBe,createTransparentProxy:pBe,defineLazy:sr,esc:SN,escapeRegex:Xg,extend:yce,finalizeIssue:df,floatSafeRemainder:uce,getElementAtPath:uBe,getEnumValues:gL,getLengthableOrigin:J6,getParsedType:gBe,getSizableOrigin:Q6,hexToUint8Array:xBe,isObject:_y,isPlainObject:Hm,issue:Ty,joinValues:xt,jsonStringifyReplacer:b_,merge:wce,mergeDefs:_h,normalizeParams:ht,nullish:w1,numKeys:hBe,objectClone:cBe,omit:vce,optionalKeys:hce,partial:bce,pick:mce,prefixIssues:af,primitiveTypes:dce,promiseAllObject:fBe,propertyKeyTypes:S_,randomString:dBe,required:Sce,safeExtend:xce,shallowClone:Z6,stringifyPrimitive:Pn,uint8ArrayToBase64:_ce,uint8ArrayToBase64url:yBe,uint8ArrayToHex:wBe,unwrapMessage:h5},Symbol.toStringTag,{value:"Module"})),Ece=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,b_,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},e8=Le("$ZodError",Ece),Rl=Le("$ZodError",Ece,{Parent:Error});function mL(t,e=n=>n.message){const n={},r=[];for(const i of t.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}function vL(t,e){const n=e||function(a){return a.message},r={_errors:[]},i=a=>{for(const o of a.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)r._errors.push(n(o));else{let s=r,c=0;for(;c<o.path.length;){const l=o.path[c];c===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(n(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return i(t),r}function Oce(t,e){const n=e||function(a){return a.message},r={errors:[]},i=(a,o=[])=>{var s,c;for(const l of a.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>i({issues:u},l.path));else if(l.code==="invalid_key")i({issues:l.issues},l.path);else if(l.code==="invalid_element")i({issues:l.issues},l.path);else{const u=[...o,...l.path];if(u.length===0){r.errors.push(n(l));continue}let f=r,d=0;for(;d<u.length;){const h=u[d],m=d===u.length-1;typeof h=="string"?(f.properties??(f.properties={}),(s=f.properties)[h]??(s[h]={errors:[]}),f=f.properties[h]):(f.items??(f.items=[]),(c=f.items)[h]??(c[h]={errors:[]}),f=f.items[h]),m&&f.errors.push(n(l)),d++}}};return i(t),r}function Dce(t){const e=[],n=t.map(r=>typeof r=="object"?r.key:r);for(const r of n)typeof r=="number"?e.push(`[${r}]`):typeof r=="symbol"?e.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?e.push(`[${JSON.stringify(r)}]`):(e.length&&e.push("."),e.push(r));return e.join("")}function Mce(t){const e=[],n=[...t.issues].sort((r,i)=>(r.path??[]).length-(i.path??[]).length);for(const r of n)e.push(`✖ ${r.message}`),r.path?.length&&e.push(`  → at ${Dce(r.path)}`);return e.join(`
`)}const Cb=t=>(e,n,r,i)=>{const a=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Rm;if(o.issues.length){const s=new(i?.Err??t)(o.issues.map(c=>df(c,a,nc())));throw pL(s,i?.callee),s}return o.value},C_=Cb(Rl),_b=t=>async(e,n,r,i)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let o=e._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){const s=new(i?.Err??t)(o.issues.map(c=>df(c,a,nc())));throw pL(s,i?.callee),s}return o.value},__=_b(Rl),Tb=t=>(e,n,r)=>{const i=r?{...r,async:!1}:{async:!1},a=e._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Rm;return a.issues.length?{success:!1,error:new(t??e8)(a.issues.map(o=>df(o,i,nc())))}:{success:!0,data:a.value}},Rce=Tb(Rl),Eb=t=>async(e,n,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let a=e._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new t(a.issues.map(o=>df(o,i,nc())))}:{success:!0,data:a.value}},Ice=Eb(Rl),yL=t=>(e,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Cb(t)(e,n,i)},SBe=yL(Rl),xL=t=>(e,n,r)=>Cb(t)(e,n,r),CBe=xL(Rl),wL=t=>async(e,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return _b(t)(e,n,i)},_Be=wL(Rl),bL=t=>async(e,n,r)=>_b(t)(e,n,r),TBe=bL(Rl),SL=t=>(e,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Tb(t)(e,n,i)},EBe=SL(Rl),CL=t=>(e,n,r)=>Tb(t)(e,n,r),OBe=CL(Rl),_L=t=>async(e,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Eb(t)(e,n,i)},DBe=_L(Rl),TL=t=>async(e,n,r)=>Eb(t)(e,n,r),MBe=TL(Rl),Nce=/^[cC][^\s-]{8,}$/,Pce=/^[0-9a-z]+$/,kce=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ace=/^[0-9a-vA-V]{20}$/,Lce=/^[A-Za-z0-9]{27}$/,Vce=/^[a-zA-Z0-9_-]{21}$/,$ce=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,RBe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,jce=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ey=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,IBe=Ey(4),NBe=Ey(6),PBe=Ey(7),Uce=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,kBe=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ABe=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Fce=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,LBe=Fce,VBe=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$Be="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Bce(){return new RegExp($Be,"u")}const zce=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Gce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Wce=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Hce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qce=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,EL=/^[A-Za-z0-9_-]*$/,OL=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Kce=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Yce=/^\+(?:[0-9]){6,14}[0-9]$/,Xce="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Zce=new RegExp(`^${Xce}$`);function Qce(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Jce(t){return new RegExp(`^${Qce(t)}$`)}function ele(t){const e=Qce({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${n.join("|")})`;return new RegExp(`^${Xce}T(?:${r})$`)}const tle=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},nle=/^-?\d+n?$/,rle=/^-?\d+$/,ile=/^-?\d+(?:\.\d+)?/,ale=/^(?:true|false)$/i,ole=/^null$/i,sle=/^undefined$/i,cle=/^[^A-Z]*$/,lle=/^[^a-z]*$/,ule=/^[0-9a-fA-F]*$/;function Ob(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function Db(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}const jBe=/^[0-9a-fA-F]{32}$/,UBe=Ob(22,"=="),FBe=Db(22),BBe=/^[0-9a-fA-F]{40}$/,zBe=Ob(27,"="),GBe=Db(27),WBe=/^[0-9a-fA-F]{64}$/,HBe=Ob(43,"="),qBe=Db(43),KBe=/^[0-9a-fA-F]{96}$/,YBe=Ob(64,""),XBe=Db(64),ZBe=/^[0-9a-fA-F]{128}$/,QBe=Ob(86,"=="),JBe=Db(86),DL=Object.freeze(Object.defineProperty({__proto__:null,base64:qce,base64url:EL,bigint:nle,boolean:ale,browserEmail:VBe,cidrv4:Wce,cidrv6:Hce,cuid:Nce,cuid2:Pce,date:Zce,datetime:ele,domain:Kce,duration:$ce,e164:Yce,email:Uce,emoji:Bce,extendedDuration:RBe,guid:jce,hex:ule,hostname:OL,html5Email:kBe,idnEmail:LBe,integer:rle,ipv4:zce,ipv6:Gce,ksuid:Lce,lowercase:cle,md5_base64:UBe,md5_base64url:FBe,md5_hex:jBe,nanoid:Vce,null:ole,number:ile,rfc5322Email:ABe,sha1_base64:zBe,sha1_base64url:GBe,sha1_hex:BBe,sha256_base64:HBe,sha256_base64url:qBe,sha256_hex:WBe,sha384_base64:YBe,sha384_base64url:XBe,sha384_hex:KBe,sha512_base64:QBe,sha512_base64url:JBe,sha512_hex:ZBe,string:tle,time:Jce,ulid:kce,undefined:sle,unicodeEmail:Fce,uppercase:lle,uuid:Ey,uuid4:IBe,uuid6:NBe,uuid7:PBe,xid:Ace},Symbol.toStringTag,{value:"Module"})),wa=Le("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),fle={number:"number",bigint:"bigint",object:"date"},ML=Le("$ZodCheckLessThan",(t,e)=>{wa.init(t,e);const n=fle[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,a=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<a&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),RL=Le("$ZodCheckGreaterThan",(t,e)=>{wa.init(t,e);const n=fle[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,a=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>a&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),dle=Le("$ZodCheckMultipleOf",(t,e)=>{wa.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):uce(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),hle=Le("$ZodCheckNumberFormat",(t,e)=>{wa.init(t,e),e.format=e.format||"float64";const n=e.format?.includes("int"),r=n?"int":"number",[i,a]=gce[e.format];t._zod.onattach.push(o=>{const s=o._zod.bag;s.format=e.format,s.minimum=i,s.maximum=a,n&&(s.pattern=rle)}),t._zod.check=o=>{const s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort});return}}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inst:t})}}),gle=Le("$ZodCheckBigIntFormat",(t,e)=>{wa.init(t,e);const[n,r]=pce[e.format];t._zod.onattach.push(i=>{const a=i._zod.bag;a.format=e.format,a.minimum=n,a.maximum=r}),t._zod.check=i=>{const a=i.value;a<n&&i.issues.push({origin:"bigint",input:a,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),a>r&&i.issues.push({origin:"bigint",input:a,code:"too_big",maximum:r,inst:t})}}),ple=Le("$ZodCheckMaxSize",(t,e)=>{var n;wa.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!w1(i)&&i.size!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;i.size<=e.maximum||r.issues.push({origin:Q6(i),code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),mle=Le("$ZodCheckMinSize",(t,e)=>{var n;wa.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!w1(i)&&i.size!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;i.size>=e.minimum||r.issues.push({origin:Q6(i),code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),vle=Le("$ZodCheckSizeEquals",(t,e)=>{var n;wa.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!w1(i)&&i.size!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=r=>{const i=r.value,a=i.size;if(a===e.size)return;const o=a>e.size;r.issues.push({origin:Q6(i),...o?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),yle=Le("$ZodCheckMaxLength",(t,e)=>{var n;wa.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!w1(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const o=J6(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),xle=Le("$ZodCheckMinLength",(t,e)=>{var n;wa.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!w1(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const o=J6(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),wle=Le("$ZodCheckLengthEquals",(t,e)=>{var n;wa.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!w1(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,a=i.length;if(a===e.length)return;const o=J6(i),s=a>e.length;r.issues.push({origin:o,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),Mb=Le("$ZodCheckStringFormat",(t,e)=>{var n,r;wa.init(t,e),t._zod.onattach.push(i=>{const a=i._zod.bag;a.format=e.format,e.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),ble=Le("$ZodCheckRegex",(t,e)=>{Mb.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Sle=Le("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=cle),Mb.init(t,e)}),Cle=Le("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=lle),Mb.init(t,e)}),_le=Le("$ZodCheckIncludes",(t,e)=>{wa.init(t,e);const n=Xg(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(i=>{const a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),Tle=Le("$ZodCheckStartsWith",(t,e)=>{wa.init(t,e);const n=new RegExp(`^${Xg(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),Ele=Le("$ZodCheckEndsWith",(t,e)=>{wa.init(t,e);const n=new RegExp(`.*${Xg(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}});function kK(t,e,n){t.issues.length&&e.issues.push(...af(n,t.issues))}const Ole=Le("$ZodCheckProperty",(t,e)=>{wa.init(t,e),t._zod.check=n=>{const r=e.schema._zod.run({value:n.value[e.property],issues:[]},{});if(r instanceof Promise)return r.then(i=>kK(i,n,e.property));kK(r,n,e.property)}}),Dle=Le("$ZodCheckMimeType",(t,e)=>{wa.init(t,e);const n=new Set(e.mime);t._zod.onattach.push(r=>{r._zod.bag.mime=e.mime}),t._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:e.mime,input:r.value.type,inst:t,continue:!e.abort})}}),Mle=Le("$ZodCheckOverwrite",(t,e)=>{wa.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class Rle{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
`).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),a=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of a)this.content.push(o)}compile(){const e=Function,n=this?.args,i=[...(this?.content??[""]).map(a=>`  ${a}`)];return new e(...n,i.join(`
`))}}const Ile={major:4,minor:1,patch:11},jn=Le("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Ile;const r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(const i of r)for(const a of i._zod.onattach)a(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{const i=(o,s,c)=>{let l=ym(o),u;for(const f of s){if(f._zod.def.when){if(!f._zod.def.when(o))continue}else if(l)continue;const d=o.issues.length,h=f._zod.check(o);if(h instanceof Promise&&c?.async===!1)throw new Rm;if(u||h instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await h,o.issues.length!==d&&(l||(l=ym(o,d)))});else{if(o.issues.length===d)continue;l||(l=ym(o,d))}}return u?u.then(()=>o):o},a=(o,s,c)=>{if(ym(o))return o.aborted=!0,o;const l=i(s,r,c);if(l instanceof Promise){if(c.async===!1)throw new Rm;return l.then(u=>t._zod.parse(u,c))}return t._zod.parse(l,c)};t._zod.run=(o,s)=>{if(s.skipChecks)return t._zod.parse(o,s);if(s.direction==="backward"){const l=t._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return l instanceof Promise?l.then(u=>a(u,o,s)):a(l,o,s)}const c=t._zod.parse(o,s);if(c instanceof Promise){if(s.async===!1)throw new Rm;return c.then(l=>i(l,r,s))}return i(c,r,s)}}t["~standard"]={validate:i=>{try{const a=Rce(t,i);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Ice(t,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}}),Rb=Le("$ZodString",(t,e)=>{jn.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??tle(t._zod.bag),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),xi=Le("$ZodStringFormat",(t,e)=>{Mb.init(t,e),Rb.init(t,e)}),Nle=Le("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=jce),xi.init(t,e)}),Ple=Le("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Ey(r))}else e.pattern??(e.pattern=Ey());xi.init(t,e)}),kle=Le("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Uce),xi.init(t,e)}),Ale=Le("$ZodURL",(t,e)=>{xi.init(t,e),t._zod.check=n=>{try{const r=n.value.trim(),i=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:OL.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),Lle=Le("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Bce()),xi.init(t,e)}),Vle=Le("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Vce),xi.init(t,e)}),$le=Le("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Nce),xi.init(t,e)}),jle=Le("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Pce),xi.init(t,e)}),Ule=Le("$ZodULID",(t,e)=>{e.pattern??(e.pattern=kce),xi.init(t,e)}),Fle=Le("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Ace),xi.init(t,e)}),Ble=Le("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Lce),xi.init(t,e)}),zle=Le("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=ele(e)),xi.init(t,e)}),Gle=Le("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Zce),xi.init(t,e)}),Wle=Le("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Jce(e)),xi.init(t,e)}),Hle=Le("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=$ce),xi.init(t,e)}),qle=Le("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=zce),xi.init(t,e),t._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),Kle=Le("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Gce),xi.init(t,e),t._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),Yle=Le("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Wce),xi.init(t,e)}),Xle=Le("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Hce),xi.init(t,e),t._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[i,a]=r;if(!a)throw new Error;const o=Number(a);if(`${o}`!==a)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function IL(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Zle=Le("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=qce),xi.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),t._zod.check=n=>{IL(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function Qle(t){if(!EL.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return IL(n)}const Jle=Le("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=EL),xi.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),t._zod.check=n=>{Qle(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),eue=Le("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Yce),xi.init(t,e)});function tue(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const nue=Le("$ZodJWT",(t,e)=>{xi.init(t,e),t._zod.check=n=>{tue(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),rue=Le("$ZodCustomStringFormat",(t,e)=>{xi.init(t,e),t._zod.check=n=>{e.fn(n.value)||n.issues.push({code:"invalid_format",format:e.format,input:n.value,inst:t,continue:!e.abort})}}),NL=Le("$ZodNumber",(t,e)=>{jn.init(t,e),t._zod.pattern=t._zod.bag.pattern??ile,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...a?{received:a}:{}}),n}}),iue=Le("$ZodNumber",(t,e)=>{hle.init(t,e),NL.init(t,e)}),PL=Le("$ZodBoolean",(t,e)=>{jn.init(t,e),t._zod.pattern=ale,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),n}}),kL=Le("$ZodBigInt",(t,e)=>{jn.init(t,e),t._zod.pattern=nle,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:t}),n}}),aue=Le("$ZodBigInt",(t,e)=>{gle.init(t,e),kL.init(t,e)}),oue=Le("$ZodSymbol",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;return typeof i=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:t}),n}}),sue=Le("$ZodUndefined",(t,e)=>{jn.init(t,e),t._zod.pattern=sle,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(n,r)=>{const i=n.value;return typeof i>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:t}),n}}),cue=Le("$ZodNull",(t,e)=>{jn.init(t,e),t._zod.pattern=ole,t._zod.values=new Set([null]),t._zod.parse=(n,r)=>{const i=n.value;return i===null||n.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),n}}),lue=Le("$ZodAny",(t,e)=>{jn.init(t,e),t._zod.parse=n=>n}),uue=Le("$ZodUnknown",(t,e)=>{jn.init(t,e),t._zod.parse=n=>n}),fue=Le("$ZodNever",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)}),due=Le("$ZodVoid",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;return typeof i>"u"||n.issues.push({expected:"void",code:"invalid_type",input:i,inst:t}),n}}),hue=Le("$ZodDate",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=new Date(n.value)}catch{}const i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:t}),n}});function AK(t,e,n){t.issues.length&&e.issues.push(...af(n,t.issues)),e.value[n]=t.value}const gue=Le("$ZodArray",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),n;n.value=Array(i.length);const a=[];for(let o=0;o<i.length;o++){const s=i[o],c=e.element._zod.run({value:s,issues:[]},r);c instanceof Promise?a.push(c.then(l=>AK(l,n,o))):AK(c,n,o)}return a.length?Promise.all(a).then(()=>n):n}});function T_(t,e,n,r){t.issues.length&&e.issues.push(...af(n,t.issues)),t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}function pue(t){const e=Object.keys(t.shape);for(const r of e)if(!t.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=hce(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function mue(t,e,n,r,i,a){const o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type;for(const u of Object.keys(e)){if(s.has(u))continue;if(l==="never"){o.push(u);continue}const f=c.run({value:e[u],issues:[]},r);f instanceof Promise?t.push(f.then(d=>T_(d,n,u,e))):T_(f,n,u,e)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:a}),t.length?Promise.all(t).then(()=>n):n}const vue=Le("$ZodObject",(t,e)=>{if(jn.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){const s=e.shape;Object.defineProperty(e,"shape",{get:()=>{const c={...s};return Object.defineProperty(e,"shape",{value:c}),c}})}const r=Sb(()=>pue(e));sr(t._zod,"propValues",()=>{const s=e.shape,c={};for(const l in s){const u=s[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(const f of u.values)c[l].add(f)}}return c});const i=_y,a=e.catchall;let o;t._zod.parse=(s,c)=>{o??(o=r.value);const l=s.value;if(!i(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:t}),s;s.value={};const u=[],f=o.shape;for(const d of o.keys){const m=f[d]._zod.run({value:l[d],issues:[]},c);m instanceof Promise?u.push(m.then(p=>T_(p,s,d,l))):T_(m,s,d,l)}return a?mue(u,l,s,c,r.value,t):u.length?Promise.all(u).then(()=>s):s}}),yue=Le("$ZodObjectJIT",(t,e)=>{vue.init(t,e);const n=t._zod.parse,r=Sb(()=>pue(e)),i=d=>{const h=new Rle(["shape","payload","ctx"]),m=r.value,p=C=>{const _=SN(C);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};h.write("const input = payload.value;");const y=Object.create(null);let x=0;for(const C of m.keys)y[C]=`key_${x++}`;h.write("const newResult = {};");for(const C of m.keys){const _=y[C],T=SN(C);h.write(`const ${_} = ${p(C)};`),h.write(`
        if (${_}.issues.length) {
          payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
            ...iss,
            path: iss.path ? [${T}, ...iss.path] : [${T}]
          })));
        }
        
        
        if (${_}.value === undefined) {
          if (${T} in input) {
            newResult[${T}] = undefined;
          }
        } else {
          newResult[${T}] = ${_}.value;
        }
        
      `)}h.write("payload.value = newResult;"),h.write("return payload;");const S=h.compile();return(C,_)=>S(d,C,_)};let a;const o=_y,s=!w_.jitless,l=s&&fce.value,u=e.catchall;let f;t._zod.parse=(d,h)=>{f??(f=r.value);const m=d.value;return o(m)?s&&l&&h?.async===!1&&h.jitless!==!0?(a||(a=i(e.shape)),d=a(d,h),u?mue([],m,d,h,f,t):d):n(d,h):(d.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),d)}});function LK(t,e,n,r){for(const a of t)if(a.issues.length===0)return e.value=a.value,e;const i=t.filter(a=>!ym(a));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(a=>a.issues.map(o=>df(o,r,nc())))}),e)}const AL=Le("$ZodUnion",(t,e)=>{jn.init(t,e),sr(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),sr(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),sr(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),sr(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(a=>a._zod.pattern);return new RegExp(`^(${i.map(a=>X6(a.source)).join("|")})$`)}});const n=e.options.length===1,r=e.options[0]._zod.run;t._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1;const s=[];for(const c of e.options){const l=c._zod.run({value:i.value,issues:[]},a);if(l instanceof Promise)s.push(l),o=!0;else{if(l.issues.length===0)return l;s.push(l)}}return o?Promise.all(s).then(c=>LK(c,i,t,a)):LK(s,i,t,a)}}),xue=Le("$ZodDiscriminatedUnion",(t,e)=>{AL.init(t,e);const n=t._zod.parse;sr(t._zod,"propValues",()=>{const i={};for(const a of e.options){const o=a._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const[s,c]of Object.entries(o)){i[s]||(i[s]=new Set);for(const l of c)i[s].add(l)}}return i});const r=Sb(()=>{const i=e.options,a=new Map;for(const o of i){const s=o._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(const c of s){if(a.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);a.set(c,o)}}return a});t._zod.parse=(i,a)=>{const o=i.value;if(!_y(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),i;const s=r.value.get(o?.[e.discriminator]);return s?s._zod.run(i,a):e.unionFallback?n(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:o,path:[e.discriminator],inst:t}),i)}}),wue=Le("$ZodIntersection",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{const i=n.value,a=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([c,l])=>VK(n,c,l)):VK(n,a,o)}});function CN(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Hm(t)&&Hm(e)){const n=Object.keys(e),r=Object.keys(t).filter(a=>n.indexOf(a)!==-1),i={...t,...e};for(const a of r){const o=CN(t[a],e[a]);if(!o.valid)return{valid:!1,mergeErrorPath:[a,...o.mergeErrorPath]};i[a]=o.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const i=t[r],a=e[r],o=CN(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function VK(t,e,n){if(e.issues.length&&t.issues.push(...e.issues),n.issues.length&&t.issues.push(...n.issues),ym(t))return t;const r=CN(e.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return t.value=r.data,t}const LL=Le("$ZodTuple",(t,e)=>{jn.init(t,e);const n=e.items,r=n.length-[...n].reverse().findIndex(i=>i._zod.optin!=="optional");t._zod.parse=(i,a)=>{const o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:t,expected:"tuple",code:"invalid_type"}),i;i.value=[];const s=[];if(!e.rest){const l=o.length>n.length,u=o.length<r-1;if(l||u)return i.issues.push({...l?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},input:o,inst:t,origin:"array"}),i}let c=-1;for(const l of n){if(c++,c>=o.length&&c>=r)continue;const u=l._zod.run({value:o[c],issues:[]},a);u instanceof Promise?s.push(u.then(f=>q4(f,i,c))):q4(u,i,c)}if(e.rest){const l=o.slice(n.length);for(const u of l){c++;const f=e.rest._zod.run({value:u,issues:[]},a);f instanceof Promise?s.push(f.then(d=>q4(d,i,c))):q4(f,i,c)}}return s.length?Promise.all(s).then(()=>i):i}});function q4(t,e,n){t.issues.length&&e.issues.push(...af(n,t.issues)),e.value[n]=t.value}const bue=Le("$ZodRecord",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Hm(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),n;const a=[];if(e.keyType._zod.values){const o=e.keyType._zod.values;n.value={};for(const c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const l=e.valueType._zod.run({value:i[c],issues:[]},r);l instanceof Promise?a.push(l.then(u=>{u.issues.length&&n.issues.push(...af(c,u.issues)),n.value[c]=u.value})):(l.issues.length&&n.issues.push(...af(c,l.issues)),n.value[c]=l.value)}let s;for(const c in i)o.has(c)||(s=s??[],s.push(c));s&&s.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:s})}else{n.value={};for(const o of Reflect.ownKeys(i)){if(o==="__proto__")continue;const s=e.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(l=>df(l,r,nc())),input:o,path:[o],inst:t}),n.value[s.value]=s.value;continue}const c=e.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(l=>{l.issues.length&&n.issues.push(...af(o,l.issues)),n.value[s.value]=l.value})):(c.issues.length&&n.issues.push(...af(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Sue=Le("$ZodMap",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:t}),n;const a=[];n.value=new Map;for(const[o,s]of i){const c=e.keyType._zod.run({value:o,issues:[]},r),l=e.valueType._zod.run({value:s,issues:[]},r);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([u,f])=>{$K(u,f,n,o,i,t,r)})):$K(c,l,n,o,i,t,r)}return a.length?Promise.all(a).then(()=>n):n}});function $K(t,e,n,r,i,a,o){t.issues.length&&(S_.has(typeof r)?n.issues.push(...af(r,t.issues)):n.issues.push({code:"invalid_key",origin:"map",input:i,inst:a,issues:t.issues.map(s=>df(s,o,nc()))})),e.issues.length&&(S_.has(typeof r)?n.issues.push(...af(r,e.issues)):n.issues.push({origin:"map",code:"invalid_element",input:i,inst:a,key:r,issues:e.issues.map(s=>df(s,o,nc()))})),n.value.set(t.value,e.value)}const Cue=Le("$ZodSet",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:t,expected:"set",code:"invalid_type"}),n;const a=[];n.value=new Set;for(const o of i){const s=e.valueType._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(c=>jK(c,n))):jK(s,n)}return a.length?Promise.all(a).then(()=>n):n}});function jK(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}const _ue=Le("$ZodEnum",(t,e)=>{jn.init(t,e);const n=gL(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(i=>S_.has(typeof i)).map(i=>typeof i=="string"?Xg(i):i.toString()).join("|")})$`),t._zod.parse=(i,a)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:t}),i}}),Tue=Le("$ZodLiteral",(t,e)=>{if(jn.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?Xg(n):n?Xg(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,r)=>{const i=n.value;return t._zod.values.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),Eue=Le("$ZodFile",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;return i instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:i,inst:t}),n}}),Oue=Le("$ZodTransform",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Y6(t.constructor.name);const i=e.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(n.value=o,n));if(i instanceof Promise)throw new Rm;return n.value=i,n}});function UK(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}const Due=Le("$ZodOptional",(t,e)=>{jn.init(t,e),t._zod.optin="optional",t._zod.optout="optional",sr(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),sr(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${X6(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(a=>UK(a,n.value)):UK(i,n.value)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),Mue=Le("$ZodNullable",(t,e)=>{jn.init(t,e),sr(t._zod,"optin",()=>e.innerType._zod.optin),sr(t._zod,"optout",()=>e.innerType._zod.optout),sr(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${X6(n.source)}|null)$`):void 0}),sr(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),Rue=Le("$ZodDefault",(t,e)=>{jn.init(t,e),t._zod.optin="optional",sr(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(a=>FK(a,e)):FK(i,e)}});function FK(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Iue=Le("$ZodPrefault",(t,e)=>{jn.init(t,e),t._zod.optin="optional",sr(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),Nue=Le("$ZodNonOptional",(t,e)=>{jn.init(t,e),sr(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(a=>BK(a,t)):BK(i,t)}});function BK(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const Pue=Le("$ZodSuccess",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Y6("ZodSuccess");const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(a=>(n.value=a.issues.length===0,n)):(n.value=i.issues.length===0,n)}}),kue=Le("$ZodCatch",(t,e)=>{jn.init(t,e),sr(t._zod,"optin",()=>e.innerType._zod.optin),sr(t._zod,"optout",()=>e.innerType._zod.optout),sr(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(a=>(n.value=a.value,a.issues.length&&(n.value=e.catchValue({...n,error:{issues:a.issues.map(o=>df(o,r,nc()))},input:n.value}),n.issues=[]),n)):(n.value=i.value,i.issues.length&&(n.value=e.catchValue({...n,error:{issues:i.issues.map(a=>df(a,r,nc()))},input:n.value}),n.issues=[]),n)}}),Aue=Le("$ZodNaN",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:t,expected:"nan",code:"invalid_type"}),n)}),Lue=Le("$ZodPipe",(t,e)=>{jn.init(t,e),sr(t._zod,"values",()=>e.in._zod.values),sr(t._zod,"optin",()=>e.in._zod.optin),sr(t._zod,"optout",()=>e.out._zod.optout),sr(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){const a=e.out._zod.run(n,r);return a instanceof Promise?a.then(o=>K4(o,e.in,r)):K4(a,e.in,r)}const i=e.in._zod.run(n,r);return i instanceof Promise?i.then(a=>K4(a,e.out,r)):K4(i,e.out,r)}});function K4(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},n)}const VL=Le("$ZodCodec",(t,e)=>{jn.init(t,e),sr(t._zod,"values",()=>e.in._zod.values),sr(t._zod,"optin",()=>e.in._zod.optin),sr(t._zod,"optout",()=>e.out._zod.optout),sr(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){const a=e.in._zod.run(n,r);return a instanceof Promise?a.then(o=>Y4(o,e,r)):Y4(a,e,r)}else{const a=e.out._zod.run(n,r);return a instanceof Promise?a.then(o=>Y4(o,e,r)):Y4(a,e,r)}}});function Y4(t,e,n){if(t.issues.length)return t.aborted=!0,t;if((n.direction||"forward")==="forward"){const i=e.transform(t.value,t);return i instanceof Promise?i.then(a=>X4(t,a,e.out,n)):X4(t,i,e.out,n)}else{const i=e.reverseTransform(t.value,t);return i instanceof Promise?i.then(a=>X4(t,a,e.in,n)):X4(t,i,e.in,n)}}function X4(t,e,n,r){return t.issues.length?(t.aborted=!0,t):n._zod.run({value:e,issues:t.issues},r)}const Vue=Le("$ZodReadonly",(t,e)=>{jn.init(t,e),sr(t._zod,"propValues",()=>e.innerType._zod.propValues),sr(t._zod,"values",()=>e.innerType._zod.values),sr(t._zod,"optin",()=>e.innerType._zod.optin),sr(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(zK):zK(i)}});function zK(t){return t.value=Object.freeze(t.value),t}const $ue=Le("$ZodTemplateLiteral",(t,e)=>{jn.init(t,e);const n=[];for(const r of e.parts)if(typeof r=="object"&&r!==null){if(!r._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);const i=r._zod.pattern instanceof RegExp?r._zod.pattern.source:r._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${r._zod.traits}`);const a=i.startsWith("^")?1:0,o=i.endsWith("$")?i.length-1:i.length;n.push(i.slice(a,o))}else if(r===null||dce.has(typeof r))n.push(Xg(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);t._zod.pattern=new RegExp(`^${n.join("")}$`),t._zod.parse=(r,i)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:t,expected:"template_literal",code:"invalid_type"}),r):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),r)}),jue=Le("$ZodFunction",(t,e)=>(jn.init(t,e),t._def=e,t._zod.def=e,t.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return function(...r){const i=t._def.input?C_(t._def.input,r):r,a=Reflect.apply(n,this,i);return t._def.output?C_(t._def.output,a):a}},t.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return async function(...r){const i=t._def.input?await __(t._def.input,r):r,a=await Reflect.apply(n,this,i);return t._def.output?await __(t._def.output,a):a}},t._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:t}),n):(t._def.output&&t._def.output._zod.def.type==="promise"?n.value=t.implementAsync(n.value):n.value=t.implement(n.value),n),t.input=(...n)=>{const r=t.constructor;return Array.isArray(n[0])?new r({type:"function",input:new LL({type:"tuple",items:n[0],rest:n[1]}),output:t._def.output}):new r({type:"function",input:n[0],output:t._def.output})},t.output=n=>{const r=t.constructor;return new r({type:"function",input:t._def.input,output:n})},t)),Uue=Le("$ZodPromise",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>Promise.resolve(n.value).then(i=>e.innerType._zod.run({value:i,issues:[]},r))}),Fue=Le("$ZodLazy",(t,e)=>{jn.init(t,e),sr(t._zod,"innerType",()=>e.getter()),sr(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),sr(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),sr(t._zod,"optin",()=>t._zod.innerType._zod.optin??void 0),sr(t._zod,"optout",()=>t._zod.innerType._zod.optout??void 0),t._zod.parse=(n,r)=>t._zod.innerType._zod.run(n,r)}),Bue=Le("$ZodCustom",(t,e)=>{wa.init(t,e),jn.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,i=e.fn(r);if(i instanceof Promise)return i.then(a=>GK(a,n,r,t));GK(i,n,r,t)}});function GK(t,e,n,r){if(!t){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(Ty(i))}}const eze=()=>{const t={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return i=>{switch(i.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${i.expected}، ولكن تم إدخال ${n(i.input)}`;case"invalid_value":return i.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${Pn(i.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?` أكبر من اللازم: يفترض أن تكون ${i.origin??"القيمة"} ${a} ${i.maximum.toString()} ${o.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${i.origin??"القيمة"} ${a} ${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`أصغر من اللازم: يفترض لـ ${i.origin} أن يكون ${a} ${i.minimum.toString()} ${o.unit}`:`أصغر من اللازم: يفترض لـ ${i.origin} أن يكون ${a} ${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${i.prefix}"`:a.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${a.suffix}"`:a.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${a.includes}"`:a.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${a.pattern}`:`${r[a.format]??i.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${i.divisor}`;case"unrecognized_keys":return`معرف${i.keys.length>1?"ات":""} غريب${i.keys.length>1?"ة":""}: ${xt(i.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${i.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${i.origin}`;default:return"مدخل غير مقبول"}}};function tze(){return{localeError:eze()}}const nze=()=>{const t={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${i.expected}, daxil olan ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Yanlış dəyər: gözlənilən ${Pn(i.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Çox böyük: gözlənilən ${i.origin??"dəyər"} ${a}${i.maximum.toString()} ${o.unit??"element"}`:`Çox böyük: gözlənilən ${i.origin??"dəyər"} ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Çox kiçik: gözlənilən ${i.origin} ${a}${i.minimum.toString()} ${o.unit}`:`Çox kiçik: gözlənilən ${i.origin} ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Yanlış mətn: "${a.prefix}" ilə başlamalıdır`:a.format==="ends_with"?`Yanlış mətn: "${a.suffix}" ilə bitməlidir`:a.format==="includes"?`Yanlış mətn: "${a.includes}" daxil olmalıdır`:a.format==="regex"?`Yanlış mətn: ${a.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${r[a.format]??i.format}`}case"not_multiple_of":return`Yanlış ədəd: ${i.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${i.keys.length>1?"lar":""}: ${xt(i.keys,", ")}`;case"invalid_key":return`${i.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${i.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function rze(){return{localeError:nze()}}function WK(t,e,n,r){const i=Math.abs(t),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?e:a>=2&&a<=4?n:r}const ize=()=>{const t={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"лік";case"object":{if(Array.isArray(i))return"масіў";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return i=>{switch(i.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${i.expected}, атрымана ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Няправільны ўвод: чакалася ${Pn(i.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);if(o){const s=Number(i.maximum),c=WK(s,o.unit.one,o.unit.few,o.unit.many);return`Занадта вялікі: чакалася, што ${i.origin??"значэнне"} павінна ${o.verb} ${a}${i.maximum.toString()} ${c}`}return`Занадта вялікі: чакалася, што ${i.origin??"значэнне"} павінна быць ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);if(o){const s=Number(i.minimum),c=WK(s,o.unit.one,o.unit.few,o.unit.many);return`Занадта малы: чакалася, што ${i.origin} павінна ${o.verb} ${a}${i.minimum.toString()} ${c}`}return`Занадта малы: чакалася, што ${i.origin} павінна быць ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${a.prefix}"`:a.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${a.suffix}"`:a.format==="includes"?`Няправільны радок: павінен змяшчаць "${a.includes}"`:a.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${a.pattern}`:`Няправільны ${r[a.format]??i.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${i.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${i.keys.length>1?"ключы":"ключ"}: ${xt(i.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${i.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${i.origin}`;default:return"Няправільны ўвод"}}};function aze(){return{localeError:ize()}}const oze=()=>{const t={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return i=>{switch(i.code){case"invalid_type":return`Tipus invàlid: s'esperava ${i.expected}, s'ha rebut ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Valor invàlid: s'esperava ${Pn(i.values[0])}`:`Opció invàlida: s'esperava una de ${xt(i.values," o ")}`;case"too_big":{const a=i.inclusive?"com a màxim":"menys de",o=e(i.origin);return o?`Massa gran: s'esperava que ${i.origin??"el valor"} contingués ${a} ${i.maximum.toString()} ${o.unit??"elements"}`:`Massa gran: s'esperava que ${i.origin??"el valor"} fos ${a} ${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?"com a mínim":"més de",o=e(i.origin);return o?`Massa petit: s'esperava que ${i.origin} contingués ${a} ${i.minimum.toString()} ${o.unit}`:`Massa petit: s'esperava que ${i.origin} fos ${a} ${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Format invàlid: ha de començar amb "${a.prefix}"`:a.format==="ends_with"?`Format invàlid: ha d'acabar amb "${a.suffix}"`:a.format==="includes"?`Format invàlid: ha d'incloure "${a.includes}"`:a.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${a.pattern}`:`Format invàlid per a ${r[a.format]??i.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${i.divisor}`;case"unrecognized_keys":return`Clau${i.keys.length>1?"s":""} no reconeguda${i.keys.length>1?"s":""}: ${xt(i.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${i.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${i.origin}`;default:return"Entrada invàlida"}}};function sze(){return{localeError:oze()}}const cze=()=>{const t={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(i))return"pole";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return i=>{switch(i.code){case"invalid_type":return`Neplatný vstup: očekáváno ${i.expected}, obdrženo ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Neplatný vstup: očekáváno ${Pn(i.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Hodnota je příliš velká: ${i.origin??"hodnota"} musí mít ${a}${i.maximum.toString()} ${o.unit??"prvků"}`:`Hodnota je příliš velká: ${i.origin??"hodnota"} musí být ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Hodnota je příliš malá: ${i.origin??"hodnota"} musí mít ${a}${i.minimum.toString()} ${o.unit??"prvků"}`:`Hodnota je příliš malá: ${i.origin??"hodnota"} musí být ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Neplatný řetězec: musí začínat na "${a.prefix}"`:a.format==="ends_with"?`Neplatný řetězec: musí končit na "${a.suffix}"`:a.format==="includes"?`Neplatný řetězec: musí obsahovat "${a.includes}"`:a.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${a.pattern}`:`Neplatný formát ${r[a.format]??i.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${i.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${xt(i.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${i.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${i.origin}`;default:return"Neplatný vstup"}}};function lze(){return{localeError:cze()}}const uze=()=>{const t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},e={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function n(o){return t[o]??null}function r(o){return e[o]??o}const i=o=>{const s=typeof o;switch(s){case"number":return Number.isNaN(o)?"NaN":"tal";case"object":return Array.isArray(o)?"liste":o===null?"null":Object.getPrototypeOf(o)!==Object.prototype&&o.constructor?o.constructor.name:"objekt"}return s},a={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Ugyldigt input: forventede ${r(o.expected)}, fik ${r(i(o.input))}`;case"invalid_value":return o.values.length===1?`Ugyldig værdi: forventede ${Pn(o.values[0])}`:`Ugyldigt valg: forventede en af følgende ${xt(o.values,"|")}`;case"too_big":{const s=o.inclusive?"<=":"<",c=n(o.origin),l=r(o.origin);return c?`For stor: forventede ${l??"value"} ${c.verb} ${s} ${o.maximum.toString()} ${c.unit??"elementer"}`:`For stor: forventede ${l??"value"} havde ${s} ${o.maximum.toString()}`}case"too_small":{const s=o.inclusive?">=":">",c=n(o.origin),l=r(o.origin);return c?`For lille: forventede ${l} ${c.verb} ${s} ${o.minimum.toString()} ${c.unit}`:`For lille: forventede ${l} havde ${s} ${o.minimum.toString()}`}case"invalid_format":{const s=o;return s.format==="starts_with"?`Ugyldig streng: skal starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: skal ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: skal indeholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: skal matche mønsteret ${s.pattern}`:`Ugyldig ${a[s.format]??o.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${xt(o.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${o.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${o.origin}`;default:return"Ugyldigt input"}}};function fze(){return{localeError:uze()}}const dze=()=>{const t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"Zahl";case"object":{if(Array.isArray(i))return"Array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return i=>{switch(i.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${i.expected}, erhalten ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Ungültige Eingabe: erwartet ${Pn(i.values[0])}`:`Ungültige Option: erwartet eine von ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Zu groß: erwartet, dass ${i.origin??"Wert"} ${a}${i.maximum.toString()} ${o.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${i.origin??"Wert"} ${a}${i.maximum.toString()} ist`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Zu klein: erwartet, dass ${i.origin} ${a}${i.minimum.toString()} ${o.unit} hat`:`Zu klein: erwartet, dass ${i.origin} ${a}${i.minimum.toString()} ist`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Ungültiger String: muss mit "${a.prefix}" beginnen`:a.format==="ends_with"?`Ungültiger String: muss mit "${a.suffix}" enden`:a.format==="includes"?`Ungültiger String: muss "${a.includes}" enthalten`:a.format==="regex"?`Ungültiger String: muss dem Muster ${a.pattern} entsprechen`:`Ungültig: ${r[a.format]??i.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${i.divisor} sein`;case"unrecognized_keys":return`${i.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${xt(i.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${i.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${i.origin}`;default:return"Ungültige Eingabe"}}};function hze(){return{localeError:dze()}}const gze=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},pze=()=>{const t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(r){return t[r]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Invalid input: expected ${r.expected}, received ${gze(r.input)}`;case"invalid_value":return r.values.length===1?`Invalid input: expected ${Pn(r.values[0])}`:`Invalid option: expected one of ${xt(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",a=e(r.origin);return a?`Too big: expected ${r.origin??"value"} to have ${i}${r.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${r.origin??"value"} to be ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",a=e(r.origin);return a?`Too small: expected ${r.origin} to have ${i}${r.minimum.toString()} ${a.unit}`:`Too small: expected ${r.origin} to be ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${n[i.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${xt(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function zue(){return{localeError:pze()}}const mze=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},vze=()=>{const t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(r){return t[r]??null}const n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return r=>{switch(r.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${r.expected}, riceviĝis ${mze(r.input)}`;case"invalid_value":return r.values.length===1?`Nevalida enigo: atendiĝis ${Pn(r.values[0])}`:`Nevalida opcio: atendiĝis unu el ${xt(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",a=e(r.origin);return a?`Tro granda: atendiĝis ke ${r.origin??"valoro"} havu ${i}${r.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${r.origin??"valoro"} havu ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",a=e(r.origin);return a?`Tro malgranda: atendiĝis ke ${r.origin} havu ${i}${r.minimum.toString()} ${a.unit}`:`Tro malgranda: atendiĝis ke ${r.origin} estu ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${i.prefix}"`:i.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${i.suffix}"`:i.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${i.includes}"`:i.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${i.pattern}`:`Nevalida ${n[i.format]??r.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${r.divisor}`;case"unrecognized_keys":return`Nekonata${r.keys.length>1?"j":""} ŝlosilo${r.keys.length>1?"j":""}: ${xt(r.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${r.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${r.origin}`;default:return"Nevalida enigo"}}};function yze(){return{localeError:vze()}}const xze=()=>{const t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},e={string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};function n(o){return t[o]??null}function r(o){return e[o]??o}const i=o=>{const s=typeof o;switch(s){case"number":return Number.isNaN(o)?"NaN":"number";case"object":return Array.isArray(o)?"array":o===null?"null":Object.getPrototypeOf(o)!==Object.prototype?o.constructor.name:"object"}return s},a={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Entrada inválida: se esperaba ${r(o.expected)}, recibido ${r(i(o.input))}`;case"invalid_value":return o.values.length===1?`Entrada inválida: se esperaba ${Pn(o.values[0])}`:`Opción inválida: se esperaba una de ${xt(o.values,"|")}`;case"too_big":{const s=o.inclusive?"<=":"<",c=n(o.origin),l=r(o.origin);return c?`Demasiado grande: se esperaba que ${l??"valor"} tuviera ${s}${o.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: se esperaba que ${l??"valor"} fuera ${s}${o.maximum.toString()}`}case"too_small":{const s=o.inclusive?">=":">",c=n(o.origin),l=r(o.origin);return c?`Demasiado pequeño: se esperaba que ${l} tuviera ${s}${o.minimum.toString()} ${c.unit}`:`Demasiado pequeño: se esperaba que ${l} fuera ${s}${o.minimum.toString()}`}case"invalid_format":{const s=o;return s.format==="starts_with"?`Cadena inválida: debe comenzar con "${s.prefix}"`:s.format==="ends_with"?`Cadena inválida: debe terminar en "${s.suffix}"`:s.format==="includes"?`Cadena inválida: debe incluir "${s.includes}"`:s.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${s.pattern}`:`Inválido ${a[s.format]??o.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${o.divisor}`;case"unrecognized_keys":return`Llave${o.keys.length>1?"s":""} desconocida${o.keys.length>1?"s":""}: ${xt(o.keys,", ")}`;case"invalid_key":return`Llave inválida en ${r(o.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${r(o.origin)}`;default:return"Entrada inválida"}}};function wze(){return{localeError:xze()}}const bze=()=>{const t={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"عدد";case"object":{if(Array.isArray(i))return"آرایه";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return i=>{switch(i.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${i.expected} می‌بود، ${n(i.input)} دریافت شد`;case"invalid_value":return i.values.length===1?`ورودی نامعتبر: می‌بایست ${Pn(i.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${xt(i.values,"|")} می‌بود`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`خیلی بزرگ: ${i.origin??"مقدار"} باید ${a}${i.maximum.toString()} ${o.unit??"عنصر"} باشد`:`خیلی بزرگ: ${i.origin??"مقدار"} باید ${a}${i.maximum.toString()} باشد`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`خیلی کوچک: ${i.origin} باید ${a}${i.minimum.toString()} ${o.unit} باشد`:`خیلی کوچک: ${i.origin} باید ${a}${i.minimum.toString()} باشد`}case"invalid_format":{const a=i;return a.format==="starts_with"?`رشته نامعتبر: باید با "${a.prefix}" شروع شود`:a.format==="ends_with"?`رشته نامعتبر: باید با "${a.suffix}" تمام شود`:a.format==="includes"?`رشته نامعتبر: باید شامل "${a.includes}" باشد`:a.format==="regex"?`رشته نامعتبر: باید با الگوی ${a.pattern} مطابقت داشته باشد`:`${r[a.format]??i.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${i.divisor} باشد`;case"unrecognized_keys":return`کلید${i.keys.length>1?"های":""} ناشناس: ${xt(i.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${i.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${i.origin}`;default:return"ورودی نامعتبر"}}};function Sze(){return{localeError:bze()}}const Cze=()=>{const t={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return i=>{switch(i.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${i.expected}, oli ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Virheellinen syöte: täytyy olla ${Pn(i.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Liian suuri: ${o.subject} täytyy olla ${a}${i.maximum.toString()} ${o.unit}`.trim():`Liian suuri: arvon täytyy olla ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Liian pieni: ${o.subject} täytyy olla ${a}${i.minimum.toString()} ${o.unit}`.trim():`Liian pieni: arvon täytyy olla ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${a.prefix}"`:a.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${a.suffix}"`:a.format==="includes"?`Virheellinen syöte: täytyy sisältää "${a.includes}"`:a.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${a.pattern}`:`Virheellinen ${r[a.format]??i.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${i.divisor} monikerta`;case"unrecognized_keys":return`${i.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${xt(i.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function _ze(){return{localeError:Cze()}}const Tze=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"nombre";case"object":{if(Array.isArray(i))return"tableau";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return i=>{switch(i.code){case"invalid_type":return`Entrée invalide : ${i.expected} attendu, ${n(i.input)} reçu`;case"invalid_value":return i.values.length===1?`Entrée invalide : ${Pn(i.values[0])} attendu`:`Option invalide : une valeur parmi ${xt(i.values,"|")} attendue`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Trop grand : ${i.origin??"valeur"} doit ${o.verb} ${a}${i.maximum.toString()} ${o.unit??"élément(s)"}`:`Trop grand : ${i.origin??"valeur"} doit être ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Trop petit : ${i.origin} doit ${o.verb} ${a}${i.minimum.toString()} ${o.unit}`:`Trop petit : ${i.origin} doit être ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Chaîne invalide : doit commencer par "${a.prefix}"`:a.format==="ends_with"?`Chaîne invalide : doit se terminer par "${a.suffix}"`:a.format==="includes"?`Chaîne invalide : doit inclure "${a.includes}"`:a.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${a.pattern}`:`${r[a.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${i.divisor}`;case"unrecognized_keys":return`Clé${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${xt(i.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${i.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entrée invalide"}}};function Eze(){return{localeError:Tze()}}const Oze=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return i=>{switch(i.code){case"invalid_type":return`Entrée invalide : attendu ${i.expected}, reçu ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Entrée invalide : attendu ${Pn(i.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"≤":"<",o=e(i.origin);return o?`Trop grand : attendu que ${i.origin??"la valeur"} ait ${a}${i.maximum.toString()} ${o.unit}`:`Trop grand : attendu que ${i.origin??"la valeur"} soit ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?"≥":">",o=e(i.origin);return o?`Trop petit : attendu que ${i.origin} ait ${a}${i.minimum.toString()} ${o.unit}`:`Trop petit : attendu que ${i.origin} soit ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Chaîne invalide : doit commencer par "${a.prefix}"`:a.format==="ends_with"?`Chaîne invalide : doit se terminer par "${a.suffix}"`:a.format==="includes"?`Chaîne invalide : doit inclure "${a.includes}"`:a.format==="regex"?`Chaîne invalide : doit correspondre au motif ${a.pattern}`:`${r[a.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${i.divisor}`;case"unrecognized_keys":return`Clé${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${xt(i.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${i.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entrée invalide"}}};function Dze(){return{localeError:Oze()}}const Mze=()=>{const t={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return i=>{switch(i.code){case"invalid_type":return`קלט לא תקין: צריך ${i.expected}, התקבל ${n(i.input)}`;case"invalid_value":return i.values.length===1?`קלט לא תקין: צריך ${Pn(i.values[0])}`:`קלט לא תקין: צריך אחת מהאפשרויות  ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`גדול מדי: ${i.origin??"value"} צריך להיות ${a}${i.maximum.toString()} ${o.unit??"elements"}`:`גדול מדי: ${i.origin??"value"} צריך להיות ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`קטן מדי: ${i.origin} צריך להיות ${a}${i.minimum.toString()} ${o.unit}`:`קטן מדי: ${i.origin} צריך להיות ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`מחרוזת לא תקינה: חייבת להתחיל ב"${a.prefix}"`:a.format==="ends_with"?`מחרוזת לא תקינה: חייבת להסתיים ב "${a.suffix}"`:a.format==="includes"?`מחרוזת לא תקינה: חייבת לכלול "${a.includes}"`:a.format==="regex"?`מחרוזת לא תקינה: חייבת להתאים לתבנית ${a.pattern}`:`${r[a.format]??i.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${i.divisor}`;case"unrecognized_keys":return`מפתח${i.keys.length>1?"ות":""} לא מזוה${i.keys.length>1?"ים":"ה"}: ${xt(i.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${i.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${i.origin}`;default:return"קלט לא תקין"}}};function Rze(){return{localeError:Mze()}}const Ize=()=>{const t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"szám";case"object":{if(Array.isArray(i))return"tömb";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return i=>{switch(i.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${i.expected}, a kapott érték ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Érvénytelen bemenet: a várt érték ${Pn(i.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Túl nagy: ${i.origin??"érték"} mérete túl nagy ${a}${i.maximum.toString()} ${o.unit??"elem"}`:`Túl nagy: a bemeneti érték ${i.origin??"érték"} túl nagy: ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Túl kicsi: a bemeneti érték ${i.origin} mérete túl kicsi ${a}${i.minimum.toString()} ${o.unit}`:`Túl kicsi: a bemeneti érték ${i.origin} túl kicsi ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Érvénytelen string: "${a.prefix}" értékkel kell kezdődnie`:a.format==="ends_with"?`Érvénytelen string: "${a.suffix}" értékkel kell végződnie`:a.format==="includes"?`Érvénytelen string: "${a.includes}" értéket kell tartalmaznia`:a.format==="regex"?`Érvénytelen string: ${a.pattern} mintának kell megfelelnie`:`Érvénytelen ${r[a.format]??i.format}`}case"not_multiple_of":return`Érvénytelen szám: ${i.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${i.keys.length>1?"s":""}: ${xt(i.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${i.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${i.origin}`;default:return"Érvénytelen bemenet"}}};function Nze(){return{localeError:Ize()}}const Pze=()=>{const t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Input tidak valid: diharapkan ${i.expected}, diterima ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Input tidak valid: diharapkan ${Pn(i.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Terlalu besar: diharapkan ${i.origin??"value"} memiliki ${a}${i.maximum.toString()} ${o.unit??"elemen"}`:`Terlalu besar: diharapkan ${i.origin??"value"} menjadi ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Terlalu kecil: diharapkan ${i.origin} memiliki ${a}${i.minimum.toString()} ${o.unit}`:`Terlalu kecil: diharapkan ${i.origin} menjadi ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`String tidak valid: harus dimulai dengan "${a.prefix}"`:a.format==="ends_with"?`String tidak valid: harus berakhir dengan "${a.suffix}"`:a.format==="includes"?`String tidak valid: harus menyertakan "${a.includes}"`:a.format==="regex"?`String tidak valid: harus sesuai pola ${a.pattern}`:`${r[a.format]??i.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${i.keys.length>1?"s":""}: ${xt(i.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${i.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${i.origin}`;default:return"Input tidak valid"}}};function kze(){return{localeError:Pze()}}const Aze=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"númer";case"object":{if(Array.isArray(t))return"fylki";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},Lze=()=>{const t={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function e(r){return t[r]??null}const n={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"};return r=>{switch(r.code){case"invalid_type":return`Rangt gildi: Þú slóst inn ${Aze(r.input)} þar sem á að vera ${r.expected}`;case"invalid_value":return r.values.length===1?`Rangt gildi: gert ráð fyrir ${Pn(r.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${xt(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",a=e(r.origin);return a?`Of stórt: gert er ráð fyrir að ${r.origin??"gildi"} hafi ${i}${r.maximum.toString()} ${a.unit??"hluti"}`:`Of stórt: gert er ráð fyrir að ${r.origin??"gildi"} sé ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",a=e(r.origin);return a?`Of lítið: gert er ráð fyrir að ${r.origin} hafi ${i}${r.minimum.toString()} ${a.unit}`:`Of lítið: gert er ráð fyrir að ${r.origin} sé ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Ógildur strengur: verður að byrja á "${i.prefix}"`:i.format==="ends_with"?`Ógildur strengur: verður að enda á "${i.suffix}"`:i.format==="includes"?`Ógildur strengur: verður að innihalda "${i.includes}"`:i.format==="regex"?`Ógildur strengur: verður að fylgja mynstri ${i.pattern}`:`Rangt ${n[i.format]??r.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${r.divisor}`;case"unrecognized_keys":return`Óþekkt ${r.keys.length>1?"ir lyklar":"ur lykill"}: ${xt(r.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${r.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${r.origin}`;default:return"Rangt gildi"}}};function Vze(){return{localeError:Lze()}}const $ze=()=>{const t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"numero";case"object":{if(Array.isArray(i))return"vettore";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Input non valido: atteso ${i.expected}, ricevuto ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Input non valido: atteso ${Pn(i.values[0])}`:`Opzione non valida: atteso uno tra ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Troppo grande: ${i.origin??"valore"} deve avere ${a}${i.maximum.toString()} ${o.unit??"elementi"}`:`Troppo grande: ${i.origin??"valore"} deve essere ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Troppo piccolo: ${i.origin} deve avere ${a}${i.minimum.toString()} ${o.unit}`:`Troppo piccolo: ${i.origin} deve essere ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Stringa non valida: deve iniziare con "${a.prefix}"`:a.format==="ends_with"?`Stringa non valida: deve terminare con "${a.suffix}"`:a.format==="includes"?`Stringa non valida: deve includere "${a.includes}"`:a.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${a.pattern}`:`Invalid ${r[a.format]??i.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${i.divisor}`;case"unrecognized_keys":return`Chiav${i.keys.length>1?"i":"e"} non riconosciut${i.keys.length>1?"e":"a"}: ${xt(i.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${i.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${i.origin}`;default:return"Input non valido"}}};function jze(){return{localeError:$ze()}}const Uze=()=>{const t={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"数値";case"object":{if(Array.isArray(i))return"配列";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return i=>{switch(i.code){case"invalid_type":return`無効な入力: ${i.expected}が期待されましたが、${n(i.input)}が入力されました`;case"invalid_value":return i.values.length===1?`無効な入力: ${Pn(i.values[0])}が期待されました`:`無効な選択: ${xt(i.values,"、")}のいずれかである必要があります`;case"too_big":{const a=i.inclusive?"以下である":"より小さい",o=e(i.origin);return o?`大きすぎる値: ${i.origin??"値"}は${i.maximum.toString()}${o.unit??"要素"}${a}必要があります`:`大きすぎる値: ${i.origin??"値"}は${i.maximum.toString()}${a}必要があります`}case"too_small":{const a=i.inclusive?"以上である":"より大きい",o=e(i.origin);return o?`小さすぎる値: ${i.origin}は${i.minimum.toString()}${o.unit}${a}必要があります`:`小さすぎる値: ${i.origin}は${i.minimum.toString()}${a}必要があります`}case"invalid_format":{const a=i;return a.format==="starts_with"?`無効な文字列: "${a.prefix}"で始まる必要があります`:a.format==="ends_with"?`無効な文字列: "${a.suffix}"で終わる必要があります`:a.format==="includes"?`無効な文字列: "${a.includes}"を含む必要があります`:a.format==="regex"?`無効な文字列: パターン${a.pattern}に一致する必要があります`:`無効な${r[a.format]??i.format}`}case"not_multiple_of":return`無効な数値: ${i.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${i.keys.length>1?"群":""}: ${xt(i.keys,"、")}`;case"invalid_key":return`${i.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${i.origin}内の無効な値`;default:return"無効な入力"}}};function Fze(){return{localeError:Uze()}}const Bze=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"რიცხვი";case"object":{if(Array.isArray(t))return"მასივი";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return{string:"სტრინგი",boolean:"ბულეანი",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"ფუნქცია"}[e]??e},zze=()=>{const t={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function e(r){return t[r]??null}const n={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"};return r=>{switch(r.code){case"invalid_type":return`არასწორი შეყვანა: მოსალოდნელი ${r.expected}, მიღებული ${Bze(r.input)}`;case"invalid_value":return r.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${Pn(r.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${xt(r.values,"|")}-დან`;case"too_big":{const i=r.inclusive?"<=":"<",a=e(r.origin);return a?`ზედმეტად დიდი: მოსალოდნელი ${r.origin??"მნიშვნელობა"} ${a.verb} ${i}${r.maximum.toString()} ${a.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${r.origin??"მნიშვნელობა"} იყოს ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",a=e(r.origin);return a?`ზედმეტად პატარა: მოსალოდნელი ${r.origin} ${a.verb} ${i}${r.minimum.toString()} ${a.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${r.origin} იყოს ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`არასწორი სტრინგი: უნდა იწყებოდეს "${i.prefix}"-ით`:i.format==="ends_with"?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${i.suffix}"-ით`:i.format==="includes"?`არასწორი სტრინგი: უნდა შეიცავდეს "${i.includes}"-ს`:i.format==="regex"?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${i.pattern}`:`არასწორი ${n[i.format]??r.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${r.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${r.keys.length>1?"ები":"ი"}: ${xt(r.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${r.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${r.origin}-ში`;default:return"არასწორი შეყვანა"}}};function Gze(){return{localeError:zze()}}const Wze=()=>{const t={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(i))return"អារេ (Array)";if(i===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return i=>{switch(i.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${i.expected} ប៉ុន្តែទទួលបាន ${n(i.input)}`;case"invalid_value":return i.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${Pn(i.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`ធំពេក៖ ត្រូវការ ${i.origin??"តម្លៃ"} ${a} ${i.maximum.toString()} ${o.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${i.origin??"តម្លៃ"} ${a} ${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`តូចពេក៖ ត្រូវការ ${i.origin} ${a} ${i.minimum.toString()} ${o.unit}`:`តូចពេក៖ ត្រូវការ ${i.origin} ${a} ${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${a.prefix}"`:a.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${a.suffix}"`:a.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${a.includes}"`:a.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${a.pattern}`:`មិនត្រឹមត្រូវ៖ ${r[a.format]??i.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${i.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${xt(i.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${i.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${i.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function Gue(){return{localeError:Wze()}}function Hze(){return Gue()}const qze=()=>{const t={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return i=>{switch(i.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${i.expected}, 받은 타입은 ${n(i.input)}입니다`;case"invalid_value":return i.values.length===1?`잘못된 입력: 값은 ${Pn(i.values[0])} 이어야 합니다`:`잘못된 옵션: ${xt(i.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const a=i.inclusive?"이하":"미만",o=a==="미만"?"이어야 합니다":"여야 합니다",s=e(i.origin),c=s?.unit??"요소";return s?`${i.origin??"값"}이 너무 큽니다: ${i.maximum.toString()}${c} ${a}${o}`:`${i.origin??"값"}이 너무 큽니다: ${i.maximum.toString()} ${a}${o}`}case"too_small":{const a=i.inclusive?"이상":"초과",o=a==="이상"?"이어야 합니다":"여야 합니다",s=e(i.origin),c=s?.unit??"요소";return s?`${i.origin??"값"}이 너무 작습니다: ${i.minimum.toString()}${c} ${a}${o}`:`${i.origin??"값"}이 너무 작습니다: ${i.minimum.toString()} ${a}${o}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`잘못된 문자열: "${a.prefix}"(으)로 시작해야 합니다`:a.format==="ends_with"?`잘못된 문자열: "${a.suffix}"(으)로 끝나야 합니다`:a.format==="includes"?`잘못된 문자열: "${a.includes}"을(를) 포함해야 합니다`:a.format==="regex"?`잘못된 문자열: 정규식 ${a.pattern} 패턴과 일치해야 합니다`:`잘못된 ${r[a.format]??i.format}`}case"not_multiple_of":return`잘못된 숫자: ${i.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${xt(i.keys,", ")}`;case"invalid_key":return`잘못된 키: ${i.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${i.origin}`;default:return"잘못된 입력"}}};function Kze(){return{localeError:qze()}}const Yze=t=>g5(typeof t,t),g5=(t,e=void 0)=>{switch(t){case"number":return Number.isNaN(e)?"NaN":"skaičius";case"bigint":return"sveikasis skaičius";case"string":return"eilutė";case"boolean":return"loginė reikšmė";case"undefined":case"void":return"neapibrėžta reikšmė";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return e===void 0?"nežinomas objektas":e===null?"nulinė reikšmė":Array.isArray(e)?"masyvas":Object.getPrototypeOf(e)!==Object.prototype&&e.constructor?e.constructor.name:"objektas";case"null":return"nulinė reikšmė"}return t},$x=t=>t.charAt(0).toUpperCase()+t.slice(1);function HK(t){const e=Math.abs(t),n=e%10,r=e%100;return r>=11&&r<=19||n===0?"many":n===1?"one":"few"}const Xze=()=>{const t={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function e(r,i,a,o){const s=t[r]??null;return s===null?s:{unit:s.unit[i],verb:s.verb[o][a?"inclusive":"notInclusive"]}}const n={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"};return r=>{switch(r.code){case"invalid_type":return`Gautas tipas ${Yze(r.input)}, o tikėtasi - ${g5(r.expected)}`;case"invalid_value":return r.values.length===1?`Privalo būti ${Pn(r.values[0])}`:`Privalo būti vienas iš ${xt(r.values,"|")} pasirinkimų`;case"too_big":{const i=g5(r.origin),a=e(r.origin,HK(Number(r.maximum)),r.inclusive??!1,"smaller");if(a?.verb)return`${$x(i??r.origin??"reikšmė")} ${a.verb} ${r.maximum.toString()} ${a.unit??"elementų"}`;const o=r.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${$x(i??r.origin??"reikšmė")} turi būti ${o} ${r.maximum.toString()} ${a?.unit}`}case"too_small":{const i=g5(r.origin),a=e(r.origin,HK(Number(r.minimum)),r.inclusive??!1,"bigger");if(a?.verb)return`${$x(i??r.origin??"reikšmė")} ${a.verb} ${r.minimum.toString()} ${a.unit??"elementų"}`;const o=r.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${$x(i??r.origin??"reikšmė")} turi būti ${o} ${r.minimum.toString()} ${a?.unit}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Eilutė privalo prasidėti "${i.prefix}"`:i.format==="ends_with"?`Eilutė privalo pasibaigti "${i.suffix}"`:i.format==="includes"?`Eilutė privalo įtraukti "${i.includes}"`:i.format==="regex"?`Eilutė privalo atitikti ${i.pattern}`:`Neteisingas ${n[i.format]??r.format}`}case"not_multiple_of":return`Skaičius privalo būti ${r.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${r.keys.length>1?"i":"as"} rakt${r.keys.length>1?"ai":"as"}: ${xt(r.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{const i=g5(r.origin);return`${$x(i??r.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function Zze(){return{localeError:Xze()}}const Qze=()=>{const t={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"број";case"object":{if(Array.isArray(i))return"низа";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return i=>{switch(i.code){case"invalid_type":return`Грешен внес: се очекува ${i.expected}, примено ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Invalid input: expected ${Pn(i.values[0])}`:`Грешана опција: се очекува една ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Премногу голем: се очекува ${i.origin??"вредноста"} да има ${a}${i.maximum.toString()} ${o.unit??"елементи"}`:`Премногу голем: се очекува ${i.origin??"вредноста"} да биде ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Премногу мал: се очекува ${i.origin} да има ${a}${i.minimum.toString()} ${o.unit}`:`Премногу мал: се очекува ${i.origin} да биде ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Неважечка низа: мора да започнува со "${a.prefix}"`:a.format==="ends_with"?`Неважечка низа: мора да завршува со "${a.suffix}"`:a.format==="includes"?`Неважечка низа: мора да вклучува "${a.includes}"`:a.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${a.pattern}`:`Invalid ${r[a.format]??i.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${xt(i.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${i.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${i.origin}`;default:return"Грешен внес"}}};function Jze(){return{localeError:Qze()}}const eGe=()=>{const t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"nombor";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Input tidak sah: dijangka ${i.expected}, diterima ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Input tidak sah: dijangka ${Pn(i.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Terlalu besar: dijangka ${i.origin??"nilai"} ${o.verb} ${a}${i.maximum.toString()} ${o.unit??"elemen"}`:`Terlalu besar: dijangka ${i.origin??"nilai"} adalah ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Terlalu kecil: dijangka ${i.origin} ${o.verb} ${a}${i.minimum.toString()} ${o.unit}`:`Terlalu kecil: dijangka ${i.origin} adalah ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`String tidak sah: mesti bermula dengan "${a.prefix}"`:a.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${a.suffix}"`:a.format==="includes"?`String tidak sah: mesti mengandungi "${a.includes}"`:a.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${a.pattern}`:`${r[a.format]??i.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${xt(i.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${i.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${i.origin}`;default:return"Input tidak sah"}}};function tGe(){return{localeError:eGe()}}const nGe=()=>{const t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"getal";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return i=>{switch(i.code){case"invalid_type":return`Ongeldige invoer: verwacht ${i.expected}, ontving ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Ongeldige invoer: verwacht ${Pn(i.values[0])}`:`Ongeldige optie: verwacht één van ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Te lang: verwacht dat ${i.origin??"waarde"} ${a}${i.maximum.toString()} ${o.unit??"elementen"} bevat`:`Te lang: verwacht dat ${i.origin??"waarde"} ${a}${i.maximum.toString()} is`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Te kort: verwacht dat ${i.origin} ${a}${i.minimum.toString()} ${o.unit} bevat`:`Te kort: verwacht dat ${i.origin} ${a}${i.minimum.toString()} is`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Ongeldige tekst: moet met "${a.prefix}" beginnen`:a.format==="ends_with"?`Ongeldige tekst: moet op "${a.suffix}" eindigen`:a.format==="includes"?`Ongeldige tekst: moet "${a.includes}" bevatten`:a.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${a.pattern}`:`Ongeldig: ${r[a.format]??i.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${i.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${i.keys.length>1?"s":""}: ${xt(i.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${i.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${i.origin}`;default:return"Ongeldige invoer"}}};function rGe(){return{localeError:nGe()}}const iGe=()=>{const t={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"tall";case"object":{if(Array.isArray(i))return"liste";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Ugyldig input: forventet ${i.expected}, fikk ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Ugyldig verdi: forventet ${Pn(i.values[0])}`:`Ugyldig valg: forventet en av ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`For stor(t): forventet ${i.origin??"value"} til å ha ${a}${i.maximum.toString()} ${o.unit??"elementer"}`:`For stor(t): forventet ${i.origin??"value"} til å ha ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`For lite(n): forventet ${i.origin} til å ha ${a}${i.minimum.toString()} ${o.unit}`:`For lite(n): forventet ${i.origin} til å ha ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Ugyldig streng: må starte med "${a.prefix}"`:a.format==="ends_with"?`Ugyldig streng: må ende med "${a.suffix}"`:a.format==="includes"?`Ugyldig streng: må inneholde "${a.includes}"`:a.format==="regex"?`Ugyldig streng: må matche mønsteret ${a.pattern}`:`Ugyldig ${r[a.format]??i.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${xt(i.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${i.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${i.origin}`;default:return"Ugyldig input"}}};function aGe(){return{localeError:iGe()}}const oGe=()=>{const t={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"numara";case"object":{if(Array.isArray(i))return"saf";if(i===null)return"gayb";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return i=>{switch(i.code){case"invalid_type":return`Fâsit giren: umulan ${i.expected}, alınan ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Fâsit giren: umulan ${Pn(i.values[0])}`:`Fâsit tercih: mûteberler ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Fazla büyük: ${i.origin??"value"}, ${a}${i.maximum.toString()} ${o.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${i.origin??"value"}, ${a}${i.maximum.toString()} olmalıydı.`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Fazla küçük: ${i.origin}, ${a}${i.minimum.toString()} ${o.unit} sahip olmalıydı.`:`Fazla küçük: ${i.origin}, ${a}${i.minimum.toString()} olmalıydı.`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Fâsit metin: "${a.prefix}" ile başlamalı.`:a.format==="ends_with"?`Fâsit metin: "${a.suffix}" ile bitmeli.`:a.format==="includes"?`Fâsit metin: "${a.includes}" ihtivâ etmeli.`:a.format==="regex"?`Fâsit metin: ${a.pattern} nakşına uymalı.`:`Fâsit ${r[a.format]??i.format}`}case"not_multiple_of":return`Fâsit sayı: ${i.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${i.keys.length>1?"s":""}: ${xt(i.keys,", ")}`;case"invalid_key":return`${i.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${i.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function sGe(){return{localeError:oGe()}}const cGe=()=>{const t={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"عدد";case"object":{if(Array.isArray(i))return"ارې";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return i=>{switch(i.code){case"invalid_type":return`ناسم ورودي: باید ${i.expected} وای, مګر ${n(i.input)} ترلاسه شو`;case"invalid_value":return i.values.length===1?`ناسم ورودي: باید ${Pn(i.values[0])} وای`:`ناسم انتخاب: باید یو له ${xt(i.values,"|")} څخه وای`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`ډیر لوی: ${i.origin??"ارزښت"} باید ${a}${i.maximum.toString()} ${o.unit??"عنصرونه"} ولري`:`ډیر لوی: ${i.origin??"ارزښت"} باید ${a}${i.maximum.toString()} وي`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`ډیر کوچنی: ${i.origin} باید ${a}${i.minimum.toString()} ${o.unit} ولري`:`ډیر کوچنی: ${i.origin} باید ${a}${i.minimum.toString()} وي`}case"invalid_format":{const a=i;return a.format==="starts_with"?`ناسم متن: باید د "${a.prefix}" سره پیل شي`:a.format==="ends_with"?`ناسم متن: باید د "${a.suffix}" سره پای ته ورسيږي`:a.format==="includes"?`ناسم متن: باید "${a.includes}" ولري`:a.format==="regex"?`ناسم متن: باید د ${a.pattern} سره مطابقت ولري`:`${r[a.format]??i.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${i.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${i.keys.length>1?"کلیډونه":"کلیډ"}: ${xt(i.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${i.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${i.origin} کې`;default:return"ناسمه ورودي"}}};function lGe(){return{localeError:cGe()}}const uGe=()=>{const t={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"liczba";case"object":{if(Array.isArray(i))return"tablica";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return i=>{switch(i.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${i.expected}, otrzymano ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${Pn(i.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Za duża wartość: oczekiwano, że ${i.origin??"wartość"} będzie mieć ${a}${i.maximum.toString()} ${o.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${i.origin??"wartość"} będzie wynosić ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Za mała wartość: oczekiwano, że ${i.origin??"wartość"} będzie mieć ${a}${i.minimum.toString()} ${o.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${i.origin??"wartość"} będzie wynosić ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${a.prefix}"`:a.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${a.suffix}"`:a.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${a.includes}"`:a.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${a.pattern}`:`Nieprawidłow(y/a/e) ${r[a.format]??i.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${i.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${i.keys.length>1?"s":""}: ${xt(i.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${i.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${i.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function fGe(){return{localeError:uGe()}}const dGe=()=>{const t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"número";case"object":{if(Array.isArray(i))return"array";if(i===null)return"nulo";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return i=>{switch(i.code){case"invalid_type":return`Tipo inválido: esperado ${i.expected}, recebido ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Entrada inválida: esperado ${Pn(i.values[0])}`:`Opção inválida: esperada uma das ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Muito grande: esperado que ${i.origin??"valor"} tivesse ${a}${i.maximum.toString()} ${o.unit??"elementos"}`:`Muito grande: esperado que ${i.origin??"valor"} fosse ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Muito pequeno: esperado que ${i.origin} tivesse ${a}${i.minimum.toString()} ${o.unit}`:`Muito pequeno: esperado que ${i.origin} fosse ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Texto inválido: deve começar com "${a.prefix}"`:a.format==="ends_with"?`Texto inválido: deve terminar com "${a.suffix}"`:a.format==="includes"?`Texto inválido: deve incluir "${a.includes}"`:a.format==="regex"?`Texto inválido: deve corresponder ao padrão ${a.pattern}`:`${r[a.format]??i.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${i.divisor}`;case"unrecognized_keys":return`Chave${i.keys.length>1?"s":""} desconhecida${i.keys.length>1?"s":""}: ${xt(i.keys,", ")}`;case"invalid_key":return`Chave inválida em ${i.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${i.origin}`;default:return"Campo inválido"}}};function hGe(){return{localeError:dGe()}}function qK(t,e,n,r){const i=Math.abs(t),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?e:a>=2&&a<=4?n:r}const gGe=()=>{const t={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"число";case"object":{if(Array.isArray(i))return"массив";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return i=>{switch(i.code){case"invalid_type":return`Неверный ввод: ожидалось ${i.expected}, получено ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Неверный ввод: ожидалось ${Pn(i.values[0])}`:`Неверный вариант: ожидалось одно из ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);if(o){const s=Number(i.maximum),c=qK(s,o.unit.one,o.unit.few,o.unit.many);return`Слишком большое значение: ожидалось, что ${i.origin??"значение"} будет иметь ${a}${i.maximum.toString()} ${c}`}return`Слишком большое значение: ожидалось, что ${i.origin??"значение"} будет ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);if(o){const s=Number(i.minimum),c=qK(s,o.unit.one,o.unit.few,o.unit.many);return`Слишком маленькое значение: ожидалось, что ${i.origin} будет иметь ${a}${i.minimum.toString()} ${c}`}return`Слишком маленькое значение: ожидалось, что ${i.origin} будет ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Неверная строка: должна начинаться с "${a.prefix}"`:a.format==="ends_with"?`Неверная строка: должна заканчиваться на "${a.suffix}"`:a.format==="includes"?`Неверная строка: должна содержать "${a.includes}"`:a.format==="regex"?`Неверная строка: должна соответствовать шаблону ${a.pattern}`:`Неверный ${r[a.format]??i.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${i.divisor}`;case"unrecognized_keys":return`Нераспознанн${i.keys.length>1?"ые":"ый"} ключ${i.keys.length>1?"и":""}: ${xt(i.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${i.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${i.origin}`;default:return"Неверные входные данные"}}};function pGe(){return{localeError:gGe()}}const mGe=()=>{const t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"število";case"object":{if(Array.isArray(i))return"tabela";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return i=>{switch(i.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${i.expected}, prejeto ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Neveljaven vnos: pričakovano ${Pn(i.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Preveliko: pričakovano, da bo ${i.origin??"vrednost"} imelo ${a}${i.maximum.toString()} ${o.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${i.origin??"vrednost"} ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Premajhno: pričakovano, da bo ${i.origin} imelo ${a}${i.minimum.toString()} ${o.unit}`:`Premajhno: pričakovano, da bo ${i.origin} ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Neveljaven niz: mora se začeti z "${a.prefix}"`:a.format==="ends_with"?`Neveljaven niz: mora se končati z "${a.suffix}"`:a.format==="includes"?`Neveljaven niz: mora vsebovati "${a.includes}"`:a.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${a.pattern}`:`Neveljaven ${r[a.format]??i.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${i.divisor}`;case"unrecognized_keys":return`Neprepoznan${i.keys.length>1?"i ključi":" ključ"}: ${xt(i.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${i.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${i.origin}`;default:return"Neveljaven vnos"}}};function vGe(){return{localeError:mGe()}}const yGe=()=>{const t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"antal";case"object":{if(Array.isArray(i))return"lista";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return i=>{switch(i.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${i.expected}, fick ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Ogiltig inmatning: förväntat ${Pn(i.values[0])}`:`Ogiltigt val: förväntade en av ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`För stor(t): förväntade ${i.origin??"värdet"} att ha ${a}${i.maximum.toString()} ${o.unit??"element"}`:`För stor(t): förväntat ${i.origin??"värdet"} att ha ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`För lite(t): förväntade ${i.origin??"värdet"} att ha ${a}${i.minimum.toString()} ${o.unit}`:`För lite(t): förväntade ${i.origin??"värdet"} att ha ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Ogiltig sträng: måste börja med "${a.prefix}"`:a.format==="ends_with"?`Ogiltig sträng: måste sluta med "${a.suffix}"`:a.format==="includes"?`Ogiltig sträng: måste innehålla "${a.includes}"`:a.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${a.pattern}"`:`Ogiltig(t) ${r[a.format]??i.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${xt(i.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${i.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${i.origin??"värdet"}`;default:return"Ogiltig input"}}};function xGe(){return{localeError:yGe()}}const wGe=()=>{const t={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(i))return"அணி";if(i===null)return"வெறுமை";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${i.expected}, பெறப்பட்டது ${n(i.input)}`;case"invalid_value":return i.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${Pn(i.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${xt(i.values,"|")} இல் ஒன்று`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${i.origin??"மதிப்பு"} ${a}${i.maximum.toString()} ${o.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${i.origin??"மதிப்பு"} ${a}${i.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${i.origin} ${a}${i.minimum.toString()} ${o.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${i.origin} ${a}${i.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const a=i;return a.format==="starts_with"?`தவறான சரம்: "${a.prefix}" இல் தொடங்க வேண்டும்`:a.format==="ends_with"?`தவறான சரம்: "${a.suffix}" இல் முடிவடைய வேண்டும்`:a.format==="includes"?`தவறான சரம்: "${a.includes}" ஐ உள்ளடக்க வேண்டும்`:a.format==="regex"?`தவறான சரம்: ${a.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${r[a.format]??i.format}`}case"not_multiple_of":return`தவறான எண்: ${i.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${i.keys.length>1?"கள்":""}: ${xt(i.keys,", ")}`;case"invalid_key":return`${i.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${i.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function bGe(){return{localeError:wGe()}}const SGe=()=>{const t={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(i))return"อาร์เรย์ (Array)";if(i===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return i=>{switch(i.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${i.expected} แต่ได้รับ ${n(i.input)}`;case"invalid_value":return i.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${Pn(i.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"ไม่เกิน":"น้อยกว่า",o=e(i.origin);return o?`เกินกำหนด: ${i.origin??"ค่า"} ควรมี${a} ${i.maximum.toString()} ${o.unit??"รายการ"}`:`เกินกำหนด: ${i.origin??"ค่า"} ควรมี${a} ${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?"อย่างน้อย":"มากกว่า",o=e(i.origin);return o?`น้อยกว่ากำหนด: ${i.origin} ควรมี${a} ${i.minimum.toString()} ${o.unit}`:`น้อยกว่ากำหนด: ${i.origin} ควรมี${a} ${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${a.prefix}"`:a.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${a.suffix}"`:a.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${a.includes}" อยู่ในข้อความ`:a.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${a.pattern}`:`รูปแบบไม่ถูกต้อง: ${r[a.format]??i.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${i.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${xt(i.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${i.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${i.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function CGe(){return{localeError:SGe()}}const _Ge=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},TGe=()=>{const t={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function e(r){return t[r]??null}const n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return r=>{switch(r.code){case"invalid_type":return`Geçersiz değer: beklenen ${r.expected}, alınan ${_Ge(r.input)}`;case"invalid_value":return r.values.length===1?`Geçersiz değer: beklenen ${Pn(r.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${xt(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",a=e(r.origin);return a?`Çok büyük: beklenen ${r.origin??"değer"} ${i}${r.maximum.toString()} ${a.unit??"öğe"}`:`Çok büyük: beklenen ${r.origin??"değer"} ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",a=e(r.origin);return a?`Çok küçük: beklenen ${r.origin} ${i}${r.minimum.toString()} ${a.unit}`:`Çok küçük: beklenen ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Geçersiz metin: "${i.prefix}" ile başlamalı`:i.format==="ends_with"?`Geçersiz metin: "${i.suffix}" ile bitmeli`:i.format==="includes"?`Geçersiz metin: "${i.includes}" içermeli`:i.format==="regex"?`Geçersiz metin: ${i.pattern} desenine uymalı`:`Geçersiz ${n[i.format]??r.format}`}case"not_multiple_of":return`Geçersiz sayı: ${r.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${r.keys.length>1?"lar":""}: ${xt(r.keys,", ")}`;case"invalid_key":return`${r.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${r.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function EGe(){return{localeError:TGe()}}const OGe=()=>{const t={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"число";case"object":{if(Array.isArray(i))return"масив";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return i=>{switch(i.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${i.expected}, отримано ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Неправильні вхідні дані: очікується ${Pn(i.values[0])}`:`Неправильна опція: очікується одне з ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Занадто велике: очікується, що ${i.origin??"значення"} ${o.verb} ${a}${i.maximum.toString()} ${o.unit??"елементів"}`:`Занадто велике: очікується, що ${i.origin??"значення"} буде ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Занадто мале: очікується, що ${i.origin} ${o.verb} ${a}${i.minimum.toString()} ${o.unit}`:`Занадто мале: очікується, що ${i.origin} буде ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Неправильний рядок: повинен починатися з "${a.prefix}"`:a.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${a.suffix}"`:a.format==="includes"?`Неправильний рядок: повинен містити "${a.includes}"`:a.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${a.pattern}`:`Неправильний ${r[a.format]??i.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${i.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${i.keys.length>1?"і":""}: ${xt(i.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${i.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${i.origin}`;default:return"Неправильні вхідні дані"}}};function Wue(){return{localeError:OGe()}}function DGe(){return Wue()}const MGe=()=>{const t={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"نمبر";case"object":{if(Array.isArray(i))return"آرے";if(i===null)return"نل";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return i=>{switch(i.code){case"invalid_type":return`غلط ان پٹ: ${i.expected} متوقع تھا، ${n(i.input)} موصول ہوا`;case"invalid_value":return i.values.length===1?`غلط ان پٹ: ${Pn(i.values[0])} متوقع تھا`:`غلط آپشن: ${xt(i.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`بہت بڑا: ${i.origin??"ویلیو"} کے ${a}${i.maximum.toString()} ${o.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${i.origin??"ویلیو"} کا ${a}${i.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`بہت چھوٹا: ${i.origin} کے ${a}${i.minimum.toString()} ${o.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${i.origin} کا ${a}${i.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const a=i;return a.format==="starts_with"?`غلط سٹرنگ: "${a.prefix}" سے شروع ہونا چاہیے`:a.format==="ends_with"?`غلط سٹرنگ: "${a.suffix}" پر ختم ہونا چاہیے`:a.format==="includes"?`غلط سٹرنگ: "${a.includes}" شامل ہونا چاہیے`:a.format==="regex"?`غلط سٹرنگ: پیٹرن ${a.pattern} سے میچ ہونا چاہیے`:`غلط ${r[a.format]??i.format}`}case"not_multiple_of":return`غلط نمبر: ${i.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${i.keys.length>1?"ز":""}: ${xt(i.keys,"، ")}`;case"invalid_key":return`${i.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${i.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function RGe(){return{localeError:MGe()}}const IGe=()=>{const t={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"số";case"object":{if(Array.isArray(i))return"mảng";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return i=>{switch(i.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${i.expected}, nhận được ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Đầu vào không hợp lệ: mong đợi ${Pn(i.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Quá lớn: mong đợi ${i.origin??"giá trị"} ${o.verb} ${a}${i.maximum.toString()} ${o.unit??"phần tử"}`:`Quá lớn: mong đợi ${i.origin??"giá trị"} ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Quá nhỏ: mong đợi ${i.origin} ${o.verb} ${a}${i.minimum.toString()} ${o.unit}`:`Quá nhỏ: mong đợi ${i.origin} ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${a.prefix}"`:a.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${a.suffix}"`:a.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${a.includes}"`:a.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${a.pattern}`:`${r[a.format]??i.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${i.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${xt(i.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${i.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${i.origin}`;default:return"Đầu vào không hợp lệ"}}};function NGe(){return{localeError:IGe()}}const PGe=()=>{const t={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(i))return"数组";if(i===null)return"空值(null)";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return i=>{switch(i.code){case"invalid_type":return`无效输入：期望 ${i.expected}，实际接收 ${n(i.input)}`;case"invalid_value":return i.values.length===1?`无效输入：期望 ${Pn(i.values[0])}`:`无效选项：期望以下之一 ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`数值过大：期望 ${i.origin??"值"} ${a}${i.maximum.toString()} ${o.unit??"个元素"}`:`数值过大：期望 ${i.origin??"值"} ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`数值过小：期望 ${i.origin} ${a}${i.minimum.toString()} ${o.unit}`:`数值过小：期望 ${i.origin} ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`无效字符串：必须以 "${a.prefix}" 开头`:a.format==="ends_with"?`无效字符串：必须以 "${a.suffix}" 结尾`:a.format==="includes"?`无效字符串：必须包含 "${a.includes}"`:a.format==="regex"?`无效字符串：必须满足正则表达式 ${a.pattern}`:`无效${r[a.format]??i.format}`}case"not_multiple_of":return`无效数字：必须是 ${i.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${xt(i.keys,", ")}`;case"invalid_key":return`${i.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${i.origin} 中包含无效值(value)`;default:return"无效输入"}}};function kGe(){return{localeError:PGe()}}const AGe=()=>{const t={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return i=>{switch(i.code){case"invalid_type":return`無效的輸入值：預期為 ${i.expected}，但收到 ${n(i.input)}`;case"invalid_value":return i.values.length===1?`無效的輸入值：預期為 ${Pn(i.values[0])}`:`無效的選項：預期為以下其中之一 ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`數值過大：預期 ${i.origin??"值"} 應為 ${a}${i.maximum.toString()} ${o.unit??"個元素"}`:`數值過大：預期 ${i.origin??"值"} 應為 ${a}${i.maximum.toString()}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`數值過小：預期 ${i.origin} 應為 ${a}${i.minimum.toString()} ${o.unit}`:`數值過小：預期 ${i.origin} 應為 ${a}${i.minimum.toString()}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`無效的字串：必須以 "${a.prefix}" 開頭`:a.format==="ends_with"?`無效的字串：必須以 "${a.suffix}" 結尾`:a.format==="includes"?`無效的字串：必須包含 "${a.includes}"`:a.format==="regex"?`無效的字串：必須符合格式 ${a.pattern}`:`無效的 ${r[a.format]??i.format}`}case"not_multiple_of":return`無效的數字：必須為 ${i.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${i.keys.length>1?"們":""}：${xt(i.keys,"、")}`;case"invalid_key":return`${i.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${i.origin} 中有無效的值`;default:return"無效的輸入值"}}};function LGe(){return{localeError:AGe()}}const VGe=()=>{const t={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function e(i){return t[i]??null}const n=i=>{const a=typeof i;switch(a){case"number":return Number.isNaN(i)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(i))return"akopọ";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return a},r={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return i=>{switch(i.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${i.expected}, àmọ̀ a rí ${n(i.input)}`;case"invalid_value":return i.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${Pn(i.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${xt(i.values,"|")}`;case"too_big":{const a=i.inclusive?"<=":"<",o=e(i.origin);return o?`Tó pọ̀ jù: a ní láti jẹ́ pé ${i.origin??"iye"} ${o.verb} ${a}${i.maximum} ${o.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${a}${i.maximum}`}case"too_small":{const a=i.inclusive?">=":">",o=e(i.origin);return o?`Kéré ju: a ní láti jẹ́ pé ${i.origin} ${o.verb} ${a}${i.minimum} ${o.unit}`:`Kéré ju: a ní láti jẹ́ ${a}${i.minimum}`}case"invalid_format":{const a=i;return a.format==="starts_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${a.prefix}"`:a.format==="ends_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${a.suffix}"`:a.format==="includes"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${a.includes}"`:a.format==="regex"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${a.pattern}`:`Aṣìṣe: ${r[a.format]??i.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${i.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${xt(i.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${i.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${i.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function $Ge(){return{localeError:VGe()}}const Hue=Object.freeze(Object.defineProperty({__proto__:null,ar:tze,az:rze,be:aze,ca:sze,cs:lze,da:fze,de:hze,en:zue,eo:yze,es:wze,fa:Sze,fi:_ze,fr:Eze,frCA:Dze,he:Rze,hu:Nze,id:kze,is:Vze,it:jze,ja:Fze,ka:Gze,kh:Hze,km:Gue,ko:Kze,lt:Zze,mk:Jze,ms:tGe,nl:rGe,no:aGe,ota:sGe,pl:fGe,ps:lGe,pt:hGe,ru:pGe,sl:vGe,sv:xGe,ta:bGe,th:CGe,tr:EGe,ua:DGe,uk:Wue,ur:RGe,vi:NGe,yo:$Ge,zhCN:kGe,zhTW:LGe},Symbol.toStringTag,{value:"Module"})),que=Symbol("ZodOutput"),Kue=Symbol("ZodInput");class $L{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];if(this._map.set(e,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function jL(){return new $L}const xm=jL();function Yue(t,e){return new t({type:"string",...ht(e)})}function Xue(t,e){return new t({type:"string",coerce:!0,...ht(e)})}function UL(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ht(e)})}function E_(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ht(e)})}function FL(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ht(e)})}function BL(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ht(e)})}function zL(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ht(e)})}function GL(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ht(e)})}function t8(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ht(e)})}function WL(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ht(e)})}function HL(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ht(e)})}function qL(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ht(e)})}function KL(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ht(e)})}function YL(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ht(e)})}function XL(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ht(e)})}function ZL(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ht(e)})}function QL(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ht(e)})}function JL(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ht(e)})}function eV(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ht(e)})}function tV(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ht(e)})}function nV(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ht(e)})}function rV(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ht(e)})}function iV(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ht(e)})}function aV(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ht(e)})}const Zue={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Que(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ht(e)})}function Jue(t,e){return new t({type:"string",format:"date",check:"string_format",...ht(e)})}function efe(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ht(e)})}function tfe(t,e){return new t({type:"string",format:"duration",check:"string_format",...ht(e)})}function nfe(t,e){return new t({type:"number",checks:[],...ht(e)})}function rfe(t,e){return new t({type:"number",coerce:!0,checks:[],...ht(e)})}function ife(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ht(e)})}function afe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...ht(e)})}function ofe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...ht(e)})}function sfe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...ht(e)})}function cfe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...ht(e)})}function lfe(t,e){return new t({type:"boolean",...ht(e)})}function ufe(t,e){return new t({type:"boolean",coerce:!0,...ht(e)})}function ffe(t,e){return new t({type:"bigint",...ht(e)})}function dfe(t,e){return new t({type:"bigint",coerce:!0,...ht(e)})}function hfe(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...ht(e)})}function gfe(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...ht(e)})}function pfe(t,e){return new t({type:"symbol",...ht(e)})}function mfe(t,e){return new t({type:"undefined",...ht(e)})}function vfe(t,e){return new t({type:"null",...ht(e)})}function yfe(t){return new t({type:"any"})}function xfe(t){return new t({type:"unknown"})}function wfe(t,e){return new t({type:"never",...ht(e)})}function bfe(t,e){return new t({type:"void",...ht(e)})}function Sfe(t,e){return new t({type:"date",...ht(e)})}function Cfe(t,e){return new t({type:"date",coerce:!0,...ht(e)})}function _fe(t,e){return new t({type:"nan",...ht(e)})}function qm(t,e){return new ML({check:"less_than",...ht(e),value:t,inclusive:!1})}function uf(t,e){return new ML({check:"less_than",...ht(e),value:t,inclusive:!0})}function Km(t,e){return new RL({check:"greater_than",...ht(e),value:t,inclusive:!1})}function pl(t,e){return new RL({check:"greater_than",...ht(e),value:t,inclusive:!0})}function Tfe(t){return Km(0,t)}function Efe(t){return qm(0,t)}function Ofe(t){return uf(0,t)}function Dfe(t){return pl(0,t)}function Cw(t,e){return new dle({check:"multiple_of",...ht(e),value:t})}function n8(t,e){return new ple({check:"max_size",...ht(e),maximum:t})}function _w(t,e){return new mle({check:"min_size",...ht(e),minimum:t})}function oV(t,e){return new vle({check:"size_equals",...ht(e),size:t})}function r8(t,e){return new yle({check:"max_length",...ht(e),maximum:t})}function Oy(t,e){return new xle({check:"min_length",...ht(e),minimum:t})}function i8(t,e){return new wle({check:"length_equals",...ht(e),length:t})}function sV(t,e){return new ble({check:"string_format",format:"regex",...ht(e),pattern:t})}function cV(t){return new Sle({check:"string_format",format:"lowercase",...ht(t)})}function lV(t){return new Cle({check:"string_format",format:"uppercase",...ht(t)})}function uV(t,e){return new _le({check:"string_format",format:"includes",...ht(e),includes:t})}function fV(t,e){return new Tle({check:"string_format",format:"starts_with",...ht(e),prefix:t})}function dV(t,e){return new Ele({check:"string_format",format:"ends_with",...ht(e),suffix:t})}function Mfe(t,e,n){return new Ole({check:"property",property:t,schema:e,...ht(n)})}function hV(t,e){return new Dle({check:"mime_type",mime:t,...ht(e)})}function b1(t){return new Mle({check:"overwrite",tx:t})}function gV(t){return b1(e=>e.normalize(t))}function pV(){return b1(t=>t.trim())}function mV(){return b1(t=>t.toLowerCase())}function vV(){return b1(t=>t.toUpperCase())}function Rfe(t,e,n){return new t({type:"array",element:e,...ht(n)})}function jGe(t,e,n){return new t({type:"union",options:e,...ht(n)})}function UGe(t,e,n,r){return new t({type:"union",options:n,discriminator:e,...ht(r)})}function FGe(t,e,n){return new t({type:"intersection",left:e,right:n})}function BGe(t,e,n,r){const i=n instanceof jn,a=i?r:n,o=i?n:null;return new t({type:"tuple",items:e,rest:o,...ht(a)})}function zGe(t,e,n,r){return new t({type:"record",keyType:e,valueType:n,...ht(r)})}function GGe(t,e,n,r){return new t({type:"map",keyType:e,valueType:n,...ht(r)})}function WGe(t,e,n){return new t({type:"set",valueType:e,...ht(n)})}function HGe(t,e,n){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new t({type:"enum",entries:r,...ht(n)})}function qGe(t,e,n){return new t({type:"enum",entries:e,...ht(n)})}function KGe(t,e,n){return new t({type:"literal",values:Array.isArray(e)?e:[e],...ht(n)})}function Ife(t,e){return new t({type:"file",...ht(e)})}function YGe(t,e){return new t({type:"transform",transform:e})}function XGe(t,e){return new t({type:"optional",innerType:e})}function ZGe(t,e){return new t({type:"nullable",innerType:e})}function QGe(t,e,n){return new t({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():Z6(n)}})}function JGe(t,e,n){return new t({type:"nonoptional",innerType:e,...ht(n)})}function eWe(t,e){return new t({type:"success",innerType:e})}function tWe(t,e,n){return new t({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}function nWe(t,e,n){return new t({type:"pipe",in:e,out:n})}function rWe(t,e){return new t({type:"readonly",innerType:e})}function iWe(t,e,n){return new t({type:"template_literal",parts:e,...ht(n)})}function aWe(t,e){return new t({type:"lazy",getter:e})}function oWe(t,e){return new t({type:"promise",innerType:e})}function Nfe(t,e,n){const r=ht(n);return r.abort??(r.abort=!0),new t({type:"custom",check:"custom",fn:e,...r})}function Pfe(t,e,n){return new t({type:"custom",check:"custom",fn:e,...ht(n)})}function kfe(t){const e=Afe(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Ty(r,n.value,e._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),n.issues.push(Ty(i))}},t(n.value,n)));return e}function Afe(t,e){const n=new wa({check:"custom",...ht(e)});return n._zod.check=t,n}function Lfe(t,e){const n=ht(e);let r=n.truthy??["true","1","yes","on","y","enabled"],i=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(h=>typeof h=="string"?h.toLowerCase():h),i=i.map(h=>typeof h=="string"?h.toLowerCase():h));const a=new Set(r),o=new Set(i),s=t.Codec??VL,c=t.Boolean??PL,l=t.String??Rb,u=new l({type:"string",error:n.error}),f=new c({type:"boolean",error:n.error}),d=new s({type:"pipe",in:u,out:f,transform:((h,m)=>{let p=h;return n.case!=="sensitive"&&(p=p.toLowerCase()),a.has(p)?!0:o.has(p)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...a,...o],input:m.value,inst:d,continue:!1}),{})}),reverseTransform:((h,m)=>h===!0?r[0]||"true":i[0]||"false"),error:n.error});return d}function Ib(t,e,n,r={}){const i=ht(r),a={...ht(r),check:"string_format",type:"string",format:e,fn:typeof n=="function"?n:s=>n.test(s),...i};return n instanceof RegExp&&(a.pattern=n),new t(a)}class _N{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??xm,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,a={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},o=this.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(e,s);const c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{const f={...n,schemaPath:[...n.schemaPath,e],path:n.path},d=e._zod.parent;if(d)s.ref=d,this.process(d,f),this.seen.get(d).isParent=!0;else{const h=s.schema;switch(i.type){case"string":{const m=h;m.type="string";const{minimum:p,maximum:y,format:x,patterns:S,contentEncoding:C}=e._zod.bag;if(typeof p=="number"&&(m.minLength=p),typeof y=="number"&&(m.maxLength=y),x&&(m.format=a[x]??x,m.format===""&&delete m.format),C&&(m.contentEncoding=C),S&&S.size>0){const _=[...S];_.length===1?m.pattern=_[0].source:_.length>1&&(s.schema.allOf=[..._.map(T=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{const m=h,{minimum:p,maximum:y,format:x,multipleOf:S,exclusiveMaximum:C,exclusiveMinimum:_}=e._zod.bag;typeof x=="string"&&x.includes("int")?m.type="integer":m.type="number",typeof _=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.minimum=_,m.exclusiveMinimum=!0):m.exclusiveMinimum=_),typeof p=="number"&&(m.minimum=p,typeof _=="number"&&this.target!=="draft-4"&&(_>=p?delete m.minimum:delete m.exclusiveMinimum)),typeof C=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.maximum=C,m.exclusiveMaximum=!0):m.exclusiveMaximum=C),typeof y=="number"&&(m.maximum=y,typeof C=="number"&&this.target!=="draft-4"&&(C<=y?delete m.maximum:delete m.exclusiveMaximum)),typeof S=="number"&&(m.multipleOf=S);break}case"boolean":{const m=h;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{this.target==="openapi-3.0"?(h.type="string",h.nullable=!0,h.enum=[null]):h.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{h.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const m=h,{minimum:p,maximum:y}=e._zod.bag;typeof p=="number"&&(m.minItems=p),typeof y=="number"&&(m.maxItems=y),m.type="array",m.items=this.process(i.element,{...f,path:[...f.path,"items"]});break}case"object":{const m=h;m.type="object",m.properties={};const p=i.shape;for(const S in p)m.properties[S]=this.process(p[S],{...f,path:[...f.path,"properties",S]});const y=new Set(Object.keys(p)),x=new Set([...y].filter(S=>{const C=i.shape[S]._zod;return this.io==="input"?C.optin===void 0:C.optout===void 0}));x.size>0&&(m.required=Array.from(x)),i.catchall?._zod.def.type==="never"?m.additionalProperties=!1:i.catchall?i.catchall&&(m.additionalProperties=this.process(i.catchall,{...f,path:[...f.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{const m=h,p=i.options.map((y,x)=>this.process(y,{...f,path:[...f.path,"anyOf",x]}));m.anyOf=p;break}case"intersection":{const m=h,p=this.process(i.left,{...f,path:[...f.path,"allOf",0]}),y=this.process(i.right,{...f,path:[...f.path,"allOf",1]}),x=C=>"allOf"in C&&Object.keys(C).length===1,S=[...x(p)?p.allOf:[p],...x(y)?y.allOf:[y]];m.allOf=S;break}case"tuple":{const m=h;m.type="array";const p=this.target==="draft-2020-12"?"prefixItems":"items",y=this.target==="draft-2020-12"||this.target==="openapi-3.0"?"items":"additionalItems",x=i.items.map((T,O)=>this.process(T,{...f,path:[...f.path,p,O]})),S=i.rest?this.process(i.rest,{...f,path:[...f.path,y,...this.target==="openapi-3.0"?[i.items.length]:[]]}):null;this.target==="draft-2020-12"?(m.prefixItems=x,S&&(m.items=S)):this.target==="openapi-3.0"?(m.items={anyOf:x},S&&m.items.anyOf.push(S),m.minItems=x.length,S||(m.maxItems=x.length)):(m.items=x,S&&(m.additionalItems=S));const{minimum:C,maximum:_}=e._zod.bag;typeof C=="number"&&(m.minItems=C),typeof _=="number"&&(m.maxItems=_);break}case"record":{const m=h;m.type="object",(this.target==="draft-7"||this.target==="draft-2020-12")&&(m.propertyNames=this.process(i.keyType,{...f,path:[...f.path,"propertyNames"]})),m.additionalProperties=this.process(i.valueType,{...f,path:[...f.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const m=h,p=gL(i.entries);p.every(y=>typeof y=="number")&&(m.type="number"),p.every(y=>typeof y=="string")&&(m.type="string"),m.enum=p;break}case"literal":{const m=h,p=[];for(const y of i.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");p.push(Number(y))}else p.push(y);if(p.length!==0)if(p.length===1){const y=p[0];m.type=y===null?"null":typeof y,this.target==="draft-4"||this.target==="openapi-3.0"?m.enum=[y]:m.const=y}else p.every(y=>typeof y=="number")&&(m.type="number"),p.every(y=>typeof y=="string")&&(m.type="string"),p.every(y=>typeof y=="boolean")&&(m.type="string"),p.every(y=>y===null)&&(m.type="null"),m.enum=p;break}case"file":{const m=h,p={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:x,mime:S}=e._zod.bag;y!==void 0&&(p.minLength=y),x!==void 0&&(p.maxLength=x),S?S.length===1?(p.contentMediaType=S[0],Object.assign(m,p)):m.anyOf=S.map(C=>({...p,contentMediaType:C})):Object.assign(m,p);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const m=this.process(i.innerType,f);this.target==="openapi-3.0"?(s.ref=i.innerType,h.nullable=!0):h.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(i.innerType,f),s.ref=i.innerType;break}case"success":{const m=h;m.type="boolean";break}case"default":{this.process(i.innerType,f),s.ref=i.innerType,h.default=JSON.parse(JSON.stringify(i.defaultValue));break}case"prefault":{this.process(i.innerType,f),s.ref=i.innerType,this.io==="input"&&(h._prefault=JSON.parse(JSON.stringify(i.defaultValue)));break}case"catch":{this.process(i.innerType,f),s.ref=i.innerType;let m;try{m=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}h.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const m=h,p=e._zod.pattern;if(!p)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=p.source;break}case"pipe":{const m=this.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;this.process(m,f),s.ref=m;break}case"readonly":{this.process(i.innerType,f),s.ref=i.innerType,h.readOnly=!0;break}case"promise":{this.process(i.innerType,f),s.ref=i.innerType;break}case"optional":{this.process(i.innerType,f),s.ref=i.innerType;break}case"lazy":{const m=e._zod.innerType;this.process(m,f),s.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema");break}}}}const l=this.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),this.io==="input"&&oo(e)&&(delete s.schema.examples,delete s.schema.default),this.io==="input"&&s.schema._prefault&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,this.seen.get(e).schema}emit(e,n){const r={cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0},i=this.seen.get(e);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=u=>{const f=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const p=r.external.registry.get(u[0])?.id,y=r.external.uri??(S=>S);if(p)return{ref:y(p)};const x=u[1].defId??u[1].schema.id??`schema${this.counter++}`;return u[1].defId=x,{defId:x,ref:`${y("__shared")}#/${f}/${x}`}}if(u[1]===i)return{ref:"#"};const h=`#/${f}/`,m=u[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:h+m}},o=u=>{if(u[1].schema.$ref)return;const f=u[1],{ref:d,defId:h}=a(u);f.def={...f.schema},h&&(f.defId=h);const m=f.schema;for(const p in m)delete m[p];m.$ref=d};if(r.cycles==="throw")for(const u of this.seen.entries()){const f=u[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>

Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of this.seen.entries()){const f=u[1];if(e===u[0]){o(u);continue}if(r.external){const h=r.external.registry.get(u[0])?.id;if(e!==u[0]&&h){o(u);continue}}if(this.metadataRegistry.get(u[0])?.id){o(u);continue}if(f.cycle){o(u);continue}if(f.count>1&&r.reused==="ref"){o(u);continue}}const s=(u,f)=>{const d=this.seen.get(u),h=d.def??d.schema,m={...h};if(d.ref===null)return;const p=d.ref;if(d.ref=null,p){s(p,f);const y=this.seen.get(p).schema;y.$ref&&(f.target==="draft-7"||f.target==="draft-4"||f.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(y)):(Object.assign(h,y),Object.assign(h,m))}d.isParent||this.override({zodSchema:u,jsonSchema:h,path:d.path??[]})};for(const u of[...this.seen.entries()].reverse())s(u[0],{target:this.target});const c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?c.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),r.external?.uri){const u=r.external.registry.get(e)?.id;if(!u)throw new Error("Schema is missing an `id` property");c.$id=r.external.uri(u)}Object.assign(c,i.def);const l=r.external?.defs??{};for(const u of this.seen.entries()){const f=u[1];f.def&&f.defId&&(l[f.defId]=f.def)}r.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?c.$defs=l:c.definitions=l);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}}function Vfe(t,e){if(t instanceof $L){const r=new _N(e),i={};for(const s of t._idmap.entries()){const[c,l]=s;r.process(l)}const a={},o={registry:t,uri:e?.uri,defs:i};for(const s of t._idmap.entries()){const[c,l]=s;a[c]=r.emit(l,{...e,external:o})}if(Object.keys(i).length>0){const s=r.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[s]:i}}return{schemas:a}}const n=new _N(e);return n.process(t),n.emit(t,e)}function oo(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const i=t._zod.def;switch(i.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return oo(i.element,n);case"object":{for(const a in i.shape)if(oo(i.shape[a],n))return!0;return!1}case"union":{for(const a of i.options)if(oo(a,n))return!0;return!1}case"intersection":return oo(i.left,n)||oo(i.right,n);case"tuple":{for(const a of i.items)if(oo(a,n))return!0;return!!(i.rest&&oo(i.rest,n))}case"record":return oo(i.keyType,n)||oo(i.valueType,n);case"map":return oo(i.keyType,n)||oo(i.valueType,n);case"set":return oo(i.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return oo(i.innerType,n);case"lazy":return oo(i.getter(),n);case"default":return oo(i.innerType,n);case"prefault":return oo(i.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return oo(i.in,n)||oo(i.out,n);case"success":return!1;case"catch":return!1;case"function":return!1}throw new Error(`Unknown schema type: ${i.type}`)}const sWe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),cWe=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:lue,$ZodArray:gue,$ZodAsyncError:Rm,$ZodBase64:Zle,$ZodBase64URL:Jle,$ZodBigInt:kL,$ZodBigIntFormat:aue,$ZodBoolean:PL,$ZodCIDRv4:Yle,$ZodCIDRv6:Xle,$ZodCUID:$le,$ZodCUID2:jle,$ZodCatch:kue,$ZodCheck:wa,$ZodCheckBigIntFormat:gle,$ZodCheckEndsWith:Ele,$ZodCheckGreaterThan:RL,$ZodCheckIncludes:_le,$ZodCheckLengthEquals:wle,$ZodCheckLessThan:ML,$ZodCheckLowerCase:Sle,$ZodCheckMaxLength:yle,$ZodCheckMaxSize:ple,$ZodCheckMimeType:Dle,$ZodCheckMinLength:xle,$ZodCheckMinSize:mle,$ZodCheckMultipleOf:dle,$ZodCheckNumberFormat:hle,$ZodCheckOverwrite:Mle,$ZodCheckProperty:Ole,$ZodCheckRegex:ble,$ZodCheckSizeEquals:vle,$ZodCheckStartsWith:Tle,$ZodCheckStringFormat:Mb,$ZodCheckUpperCase:Cle,$ZodCodec:VL,$ZodCustom:Bue,$ZodCustomStringFormat:rue,$ZodDate:hue,$ZodDefault:Rue,$ZodDiscriminatedUnion:xue,$ZodE164:eue,$ZodEmail:kle,$ZodEmoji:Lle,$ZodEncodeError:Y6,$ZodEnum:_ue,$ZodError:e8,$ZodFile:Eue,$ZodFunction:jue,$ZodGUID:Nle,$ZodIPv4:qle,$ZodIPv6:Kle,$ZodISODate:Gle,$ZodISODateTime:zle,$ZodISODuration:Hle,$ZodISOTime:Wle,$ZodIntersection:wue,$ZodJWT:nue,$ZodKSUID:Ble,$ZodLazy:Fue,$ZodLiteral:Tue,$ZodMap:Sue,$ZodNaN:Aue,$ZodNanoID:Vle,$ZodNever:fue,$ZodNonOptional:Nue,$ZodNull:cue,$ZodNullable:Mue,$ZodNumber:NL,$ZodNumberFormat:iue,$ZodObject:vue,$ZodObjectJIT:yue,$ZodOptional:Due,$ZodPipe:Lue,$ZodPrefault:Iue,$ZodPromise:Uue,$ZodReadonly:Vue,$ZodRealError:Rl,$ZodRecord:bue,$ZodRegistry:$L,$ZodSet:Cue,$ZodString:Rb,$ZodStringFormat:xi,$ZodSuccess:Pue,$ZodSymbol:oue,$ZodTemplateLiteral:$ue,$ZodTransform:Oue,$ZodTuple:LL,$ZodType:jn,$ZodULID:Ule,$ZodURL:Ale,$ZodUUID:Ple,$ZodUndefined:sue,$ZodUnion:AL,$ZodUnknown:uue,$ZodVoid:due,$ZodXID:Fle,$brand:lce,$constructor:Le,$input:Kue,$output:que,Doc:Rle,JSONSchema:sWe,JSONSchemaGenerator:_N,NEVER:cce,TimePrecision:Zue,_any:yfe,_array:Rfe,_base64:nV,_base64url:rV,_bigint:ffe,_boolean:lfe,_catch:tWe,_check:Afe,_cidrv4:eV,_cidrv6:tV,_coercedBigint:dfe,_coercedBoolean:ufe,_coercedDate:Cfe,_coercedNumber:rfe,_coercedString:Xue,_cuid:qL,_cuid2:KL,_custom:Nfe,_date:Sfe,_decode:xL,_decodeAsync:bL,_default:QGe,_discriminatedUnion:UGe,_e164:iV,_email:UL,_emoji:WL,_encode:yL,_encodeAsync:wL,_endsWith:dV,_enum:HGe,_file:Ife,_float32:afe,_float64:ofe,_gt:Km,_gte:pl,_guid:E_,_includes:uV,_int:ife,_int32:sfe,_int64:hfe,_intersection:FGe,_ipv4:QL,_ipv6:JL,_isoDate:Jue,_isoDateTime:Que,_isoDuration:tfe,_isoTime:efe,_jwt:aV,_ksuid:ZL,_lazy:aWe,_length:i8,_literal:KGe,_lowercase:cV,_lt:qm,_lte:uf,_map:GGe,_max:uf,_maxLength:r8,_maxSize:n8,_mime:hV,_min:pl,_minLength:Oy,_minSize:_w,_multipleOf:Cw,_nan:_fe,_nanoid:HL,_nativeEnum:qGe,_negative:Efe,_never:wfe,_nonnegative:Dfe,_nonoptional:JGe,_nonpositive:Ofe,_normalize:gV,_null:vfe,_nullable:ZGe,_number:nfe,_optional:XGe,_overwrite:b1,_parse:Cb,_parseAsync:_b,_pipe:nWe,_positive:Tfe,_promise:oWe,_property:Mfe,_readonly:rWe,_record:zGe,_refine:Pfe,_regex:sV,_safeDecode:CL,_safeDecodeAsync:TL,_safeEncode:SL,_safeEncodeAsync:_L,_safeParse:Tb,_safeParseAsync:Eb,_set:WGe,_size:oV,_startsWith:fV,_string:Yue,_stringFormat:Ib,_stringbool:Lfe,_success:eWe,_superRefine:kfe,_symbol:pfe,_templateLiteral:iWe,_toLowerCase:mV,_toUpperCase:vV,_transform:YGe,_trim:pV,_tuple:BGe,_uint32:cfe,_uint64:gfe,_ulid:YL,_undefined:mfe,_union:jGe,_unknown:xfe,_uppercase:lV,_url:t8,_uuid:FL,_uuidv4:BL,_uuidv6:zL,_uuidv7:GL,_void:bfe,_xid:XL,clone:Eu,config:nc,decode:CBe,decodeAsync:TBe,encode:SBe,encodeAsync:_Be,flattenError:mL,formatError:vL,globalConfig:w_,globalRegistry:xm,isValidBase64:IL,isValidBase64URL:Qle,isValidJWT:tue,locales:Hue,parse:C_,parseAsync:__,prettifyError:Mce,regexes:DL,registry:jL,safeDecode:OBe,safeDecodeAsync:MBe,safeEncode:EBe,safeEncodeAsync:DBe,safeParse:Rce,safeParseAsync:Ice,toDotPath:Dce,toJSONSchema:Vfe,treeifyError:Oce,util:Tce,version:Ile},Symbol.toStringTag,{value:"Module"})),yV=Le("ZodISODateTime",(t,e)=>{zle.init(t,e),Ni.init(t,e)});function $fe(t){return Que(yV,t)}const xV=Le("ZodISODate",(t,e)=>{Gle.init(t,e),Ni.init(t,e)});function jfe(t){return Jue(xV,t)}const wV=Le("ZodISOTime",(t,e)=>{Wle.init(t,e),Ni.init(t,e)});function Ufe(t){return efe(wV,t)}const bV=Le("ZodISODuration",(t,e)=>{Hle.init(t,e),Ni.init(t,e)});function Ffe(t){return tfe(bV,t)}const lWe=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:xV,ZodISODateTime:yV,ZodISODuration:bV,ZodISOTime:wV,date:jfe,datetime:$fe,duration:Ffe,time:Ufe},Symbol.toStringTag,{value:"Module"})),Bfe=(t,e)=>{e8.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>vL(t,n)},flatten:{value:n=>mL(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,b_,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,b_,2)}},isEmpty:{get(){return t.issues.length===0}}})},uWe=Le("ZodError",Bfe),Il=Le("ZodError",Bfe,{Parent:Error}),zfe=Cb(Il),Gfe=_b(Il),Wfe=Tb(Il),Hfe=Eb(Il),qfe=yL(Il),Kfe=xL(Il),Yfe=wL(Il),Xfe=bL(Il),Zfe=SL(Il),Qfe=CL(Il),Jfe=_L(Il),ede=TL(Il),Qn=Le("ZodType",(t,e)=>(jn.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone(_h(e,{checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]})),t.clone=(n,r)=>Eu(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t)),t.parse=(n,r)=>zfe(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>Wfe(t,n,r),t.parseAsync=async(n,r)=>Gfe(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>Hfe(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>qfe(t,n,r),t.decode=(n,r)=>Kfe(t,n,r),t.encodeAsync=async(n,r)=>Yfe(t,n,r),t.decodeAsync=async(n,r)=>Xfe(t,n,r),t.safeEncode=(n,r)=>Zfe(t,n,r),t.safeDecode=(n,r)=>Qfe(t,n,r),t.safeEncodeAsync=async(n,r)=>Jfe(t,n,r),t.safeDecodeAsync=async(n,r)=>ede(t,n,r),t.refine=(n,r)=>t.check(Ude(n,r)),t.superRefine=n=>t.check(Fde(n)),t.overwrite=n=>t.check(b1(n)),t.optional=()=>D_(t),t.nullable=()=>M_(t),t.nullish=()=>D_(M_(t)),t.nonoptional=n=>Dde(t,n),t.array=()=>u8(t),t.or=n=>GV([t,n]),t.and=n=>hde(t,n),t.transform=n=>R_(t,qV(n)),t.default=n=>Tde(t,n),t.prefault=n=>Ode(t,n),t.catch=n=>Ide(t,n),t.pipe=n=>R_(t,n),t.readonly=()=>kde(t),t.describe=n=>{const r=t.clone();return xm.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){return xm.get(t)?.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return xm.get(t);const r=t.clone();return xm.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),SV=Le("_ZodString",(t,e)=>{Rb.init(t,e),Qn.init(t,e);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(sV(...r)),t.includes=(...r)=>t.check(uV(...r)),t.startsWith=(...r)=>t.check(fV(...r)),t.endsWith=(...r)=>t.check(dV(...r)),t.min=(...r)=>t.check(Oy(...r)),t.max=(...r)=>t.check(r8(...r)),t.length=(...r)=>t.check(i8(...r)),t.nonempty=(...r)=>t.check(Oy(1,...r)),t.lowercase=r=>t.check(cV(r)),t.uppercase=r=>t.check(lV(r)),t.trim=()=>t.check(pV()),t.normalize=(...r)=>t.check(gV(...r)),t.toLowerCase=()=>t.check(mV()),t.toUpperCase=()=>t.check(vV())}),a8=Le("ZodString",(t,e)=>{Rb.init(t,e),SV.init(t,e),t.email=n=>t.check(UL(CV,n)),t.url=n=>t.check(t8(o8,n)),t.jwt=n=>t.check(aV($V,n)),t.emoji=n=>t.check(WL(_V,n)),t.guid=n=>t.check(E_(O_,n)),t.uuid=n=>t.check(FL(V0,n)),t.uuidv4=n=>t.check(BL(V0,n)),t.uuidv6=n=>t.check(zL(V0,n)),t.uuidv7=n=>t.check(GL(V0,n)),t.nanoid=n=>t.check(HL(TV,n)),t.guid=n=>t.check(E_(O_,n)),t.cuid=n=>t.check(qL(EV,n)),t.cuid2=n=>t.check(KL(OV,n)),t.ulid=n=>t.check(YL(DV,n)),t.base64=n=>t.check(nV(AV,n)),t.base64url=n=>t.check(rV(LV,n)),t.xid=n=>t.check(XL(MV,n)),t.ksuid=n=>t.check(ZL(RV,n)),t.ipv4=n=>t.check(QL(IV,n)),t.ipv6=n=>t.check(JL(NV,n)),t.cidrv4=n=>t.check(eV(PV,n)),t.cidrv6=n=>t.check(tV(kV,n)),t.e164=n=>t.check(iV(VV,n)),t.datetime=n=>t.check($fe(n)),t.date=n=>t.check(jfe(n)),t.time=n=>t.check(Ufe(n)),t.duration=n=>t.check(Ffe(n))});function Ra(t){return Yue(a8,t)}const Ni=Le("ZodStringFormat",(t,e)=>{xi.init(t,e),SV.init(t,e)}),CV=Le("ZodEmail",(t,e)=>{kle.init(t,e),Ni.init(t,e)});function fWe(t){return UL(CV,t)}const O_=Le("ZodGUID",(t,e)=>{Nle.init(t,e),Ni.init(t,e)});function dWe(t){return E_(O_,t)}const V0=Le("ZodUUID",(t,e)=>{Ple.init(t,e),Ni.init(t,e)});function hWe(t){return FL(V0,t)}function gWe(t){return BL(V0,t)}function pWe(t){return zL(V0,t)}function mWe(t){return GL(V0,t)}const o8=Le("ZodURL",(t,e)=>{Ale.init(t,e),Ni.init(t,e)});function vWe(t){return t8(o8,t)}function yWe(t){return t8(o8,{protocol:/^https?$/,hostname:Kce,...ht(t)})}const _V=Le("ZodEmoji",(t,e)=>{Lle.init(t,e),Ni.init(t,e)});function xWe(t){return WL(_V,t)}const TV=Le("ZodNanoID",(t,e)=>{Vle.init(t,e),Ni.init(t,e)});function wWe(t){return HL(TV,t)}const EV=Le("ZodCUID",(t,e)=>{$le.init(t,e),Ni.init(t,e)});function bWe(t){return qL(EV,t)}const OV=Le("ZodCUID2",(t,e)=>{jle.init(t,e),Ni.init(t,e)});function SWe(t){return KL(OV,t)}const DV=Le("ZodULID",(t,e)=>{Ule.init(t,e),Ni.init(t,e)});function CWe(t){return YL(DV,t)}const MV=Le("ZodXID",(t,e)=>{Fle.init(t,e),Ni.init(t,e)});function _We(t){return XL(MV,t)}const RV=Le("ZodKSUID",(t,e)=>{Ble.init(t,e),Ni.init(t,e)});function TWe(t){return ZL(RV,t)}const IV=Le("ZodIPv4",(t,e)=>{qle.init(t,e),Ni.init(t,e)});function EWe(t){return QL(IV,t)}const NV=Le("ZodIPv6",(t,e)=>{Kle.init(t,e),Ni.init(t,e)});function OWe(t){return JL(NV,t)}const PV=Le("ZodCIDRv4",(t,e)=>{Yle.init(t,e),Ni.init(t,e)});function DWe(t){return eV(PV,t)}const kV=Le("ZodCIDRv6",(t,e)=>{Xle.init(t,e),Ni.init(t,e)});function MWe(t){return tV(kV,t)}const AV=Le("ZodBase64",(t,e)=>{Zle.init(t,e),Ni.init(t,e)});function RWe(t){return nV(AV,t)}const LV=Le("ZodBase64URL",(t,e)=>{Jle.init(t,e),Ni.init(t,e)});function IWe(t){return rV(LV,t)}const VV=Le("ZodE164",(t,e)=>{eue.init(t,e),Ni.init(t,e)});function NWe(t){return iV(VV,t)}const $V=Le("ZodJWT",(t,e)=>{nue.init(t,e),Ni.init(t,e)});function PWe(t){return aV($V,t)}const Nb=Le("ZodCustomStringFormat",(t,e)=>{rue.init(t,e),Ni.init(t,e)});function kWe(t,e,n={}){return Ib(Nb,t,e,n)}function AWe(t){return Ib(Nb,"hostname",OL,t)}function LWe(t){return Ib(Nb,"hex",ule,t)}function VWe(t,e){const n=e?.enc??"hex",r=`${t}_${n}`,i=DL[r];if(!i)throw new Error(`Unrecognized hash format: ${r}`);return Ib(Nb,r,i,e)}const s8=Le("ZodNumber",(t,e)=>{NL.init(t,e),Qn.init(t,e),t.gt=(r,i)=>t.check(Km(r,i)),t.gte=(r,i)=>t.check(pl(r,i)),t.min=(r,i)=>t.check(pl(r,i)),t.lt=(r,i)=>t.check(qm(r,i)),t.lte=(r,i)=>t.check(uf(r,i)),t.max=(r,i)=>t.check(uf(r,i)),t.int=r=>t.check(TN(r)),t.safe=r=>t.check(TN(r)),t.positive=r=>t.check(Km(0,r)),t.nonnegative=r=>t.check(pl(0,r)),t.negative=r=>t.check(qm(0,r)),t.nonpositive=r=>t.check(uf(0,r)),t.multipleOf=(r,i)=>t.check(Cw(r,i)),t.step=(r,i)=>t.check(Cw(r,i)),t.finite=()=>t;const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function tde(t){return nfe(s8,t)}const p2=Le("ZodNumberFormat",(t,e)=>{iue.init(t,e),s8.init(t,e)});function TN(t){return ife(p2,t)}function $We(t){return afe(p2,t)}function jWe(t){return ofe(p2,t)}function UWe(t){return sfe(p2,t)}function FWe(t){return cfe(p2,t)}const c8=Le("ZodBoolean",(t,e)=>{PL.init(t,e),Qn.init(t,e)});function jV(t){return lfe(c8,t)}const l8=Le("ZodBigInt",(t,e)=>{kL.init(t,e),Qn.init(t,e),t.gte=(r,i)=>t.check(pl(r,i)),t.min=(r,i)=>t.check(pl(r,i)),t.gt=(r,i)=>t.check(Km(r,i)),t.gte=(r,i)=>t.check(pl(r,i)),t.min=(r,i)=>t.check(pl(r,i)),t.lt=(r,i)=>t.check(qm(r,i)),t.lte=(r,i)=>t.check(uf(r,i)),t.max=(r,i)=>t.check(uf(r,i)),t.positive=r=>t.check(Km(BigInt(0),r)),t.negative=r=>t.check(qm(BigInt(0),r)),t.nonpositive=r=>t.check(uf(BigInt(0),r)),t.nonnegative=r=>t.check(pl(BigInt(0),r)),t.multipleOf=(r,i)=>t.check(Cw(r,i));const n=t._zod.bag;t.minValue=n.minimum??null,t.maxValue=n.maximum??null,t.format=n.format??null});function BWe(t){return ffe(l8,t)}const UV=Le("ZodBigIntFormat",(t,e)=>{aue.init(t,e),l8.init(t,e)});function zWe(t){return hfe(UV,t)}function GWe(t){return gfe(UV,t)}const nde=Le("ZodSymbol",(t,e)=>{oue.init(t,e),Qn.init(t,e)});function WWe(t){return pfe(nde,t)}const rde=Le("ZodUndefined",(t,e)=>{sue.init(t,e),Qn.init(t,e)});function HWe(t){return mfe(rde,t)}const ide=Le("ZodNull",(t,e)=>{cue.init(t,e),Qn.init(t,e)});function ade(t){return vfe(ide,t)}const ode=Le("ZodAny",(t,e)=>{lue.init(t,e),Qn.init(t,e)});function qWe(){return yfe(ode)}const sde=Le("ZodUnknown",(t,e)=>{uue.init(t,e),Qn.init(t,e)});function Dy(){return xfe(sde)}const cde=Le("ZodNever",(t,e)=>{fue.init(t,e),Qn.init(t,e)});function FV(t){return wfe(cde,t)}const lde=Le("ZodVoid",(t,e)=>{due.init(t,e),Qn.init(t,e)});function KWe(t){return bfe(lde,t)}const BV=Le("ZodDate",(t,e)=>{hue.init(t,e),Qn.init(t,e),t.min=(r,i)=>t.check(pl(r,i)),t.max=(r,i)=>t.check(uf(r,i));const n=t._zod.bag;t.minDate=n.minimum?new Date(n.minimum):null,t.maxDate=n.maximum?new Date(n.maximum):null});function oy(t){return Sfe(BV,t)}const ude=Le("ZodArray",(t,e)=>{gue.init(t,e),Qn.init(t,e),t.element=e.element,t.min=(n,r)=>t.check(Oy(n,r)),t.nonempty=n=>t.check(Oy(1,n)),t.max=(n,r)=>t.check(r8(n,r)),t.length=(n,r)=>t.check(i8(n,r)),t.unwrap=()=>t.element});function u8(t,e){return Rfe(ude,t,e)}function YWe(t){const e=t._zod.def.shape;return HV(Object.keys(e))}const f8=Le("ZodObject",(t,e)=>{yue.init(t,e),Qn.init(t,e),sr(t,"shape",()=>e.shape),t.keyof=()=>HV(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Dy()}),t.loose=()=>t.clone({...t._zod.def,catchall:Dy()}),t.strict=()=>t.clone({...t._zod.def,catchall:FV()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>yce(t,n),t.safeExtend=n=>xce(t,n),t.merge=n=>wce(t,n),t.pick=n=>mce(t,n),t.omit=n=>vce(t,n),t.partial=(...n)=>bce(KV,t,n[0]),t.required=(...n)=>Sce(YV,t,n[0])});function m2(t,e){const n={type:"object",shape:t??{},...ht(e)};return new f8(n)}function XWe(t,e){return new f8({type:"object",shape:t,catchall:FV(),...ht(e)})}function ZWe(t,e){return new f8({type:"object",shape:t,catchall:Dy(),...ht(e)})}const zV=Le("ZodUnion",(t,e)=>{AL.init(t,e),Qn.init(t,e),t.options=e.options});function GV(t,e){return new zV({type:"union",options:t,...ht(e)})}const fde=Le("ZodDiscriminatedUnion",(t,e)=>{zV.init(t,e),xue.init(t,e)});function QWe(t,e,n){return new fde({type:"union",options:e,discriminator:t,...ht(n)})}const dde=Le("ZodIntersection",(t,e)=>{wue.init(t,e),Qn.init(t,e)});function hde(t,e){return new dde({type:"intersection",left:t,right:e})}const gde=Le("ZodTuple",(t,e)=>{LL.init(t,e),Qn.init(t,e),t.rest=n=>t.clone({...t._zod.def,rest:n})});function pde(t,e,n){const r=e instanceof jn,i=r?n:e,a=r?e:null;return new gde({type:"tuple",items:t,rest:a,...ht(i)})}const WV=Le("ZodRecord",(t,e)=>{bue.init(t,e),Qn.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function mde(t,e,n){return new WV({type:"record",keyType:t,valueType:e,...ht(n)})}function JWe(t,e,n){const r=Eu(t);return r._zod.values=void 0,new WV({type:"record",keyType:r,valueType:e,...ht(n)})}const vde=Le("ZodMap",(t,e)=>{Sue.init(t,e),Qn.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function eHe(t,e,n){return new vde({type:"map",keyType:t,valueType:e,...ht(n)})}const yde=Le("ZodSet",(t,e)=>{Cue.init(t,e),Qn.init(t,e),t.min=(...n)=>t.check(_w(...n)),t.nonempty=n=>t.check(_w(1,n)),t.max=(...n)=>t.check(n8(...n)),t.size=(...n)=>t.check(oV(...n))});function tHe(t,e){return new yde({type:"set",valueType:t,...ht(e)})}const Tw=Le("ZodEnum",(t,e)=>{_ue.init(t,e),Qn.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{const a={};for(const o of r)if(n.has(o))a[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Tw({...e,checks:[],...ht(i),entries:a})},t.exclude=(r,i)=>{const a={...e.entries};for(const o of r)if(n.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new Tw({...e,checks:[],...ht(i),entries:a})}});function HV(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new Tw({type:"enum",entries:n,...ht(e)})}function nHe(t,e){return new Tw({type:"enum",entries:t,...ht(e)})}const xde=Le("ZodLiteral",(t,e)=>{Tue.init(t,e),Qn.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function wde(t,e){return new xde({type:"literal",values:Array.isArray(t)?t:[t],...ht(e)})}const bde=Le("ZodFile",(t,e)=>{Eue.init(t,e),Qn.init(t,e),t.min=(n,r)=>t.check(_w(n,r)),t.max=(n,r)=>t.check(n8(n,r)),t.mime=(n,r)=>t.check(hV(Array.isArray(n)?n:[n],r))});function rHe(t){return Ife(bde,t)}const Sde=Le("ZodTransform",(t,e)=>{Oue.init(t,e),Qn.init(t,e),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Y6(t.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(Ty(a,n.value,e));else{const o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),n.issues.push(Ty(o))}};const i=e.transform(n.value,n);return i instanceof Promise?i.then(a=>(n.value=a,n)):(n.value=i,n)}});function qV(t){return new Sde({type:"transform",transform:t})}const KV=Le("ZodOptional",(t,e)=>{Due.init(t,e),Qn.init(t,e),t.unwrap=()=>t._zod.def.innerType});function D_(t){return new KV({type:"optional",innerType:t})}const Cde=Le("ZodNullable",(t,e)=>{Mue.init(t,e),Qn.init(t,e),t.unwrap=()=>t._zod.def.innerType});function M_(t){return new Cde({type:"nullable",innerType:t})}function iHe(t){return D_(M_(t))}const _de=Le("ZodDefault",(t,e)=>{Rue.init(t,e),Qn.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Tde(t,e){return new _de({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Z6(e)}})}const Ede=Le("ZodPrefault",(t,e)=>{Iue.init(t,e),Qn.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ode(t,e){return new Ede({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Z6(e)}})}const YV=Le("ZodNonOptional",(t,e)=>{Nue.init(t,e),Qn.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Dde(t,e){return new YV({type:"nonoptional",innerType:t,...ht(e)})}const Mde=Le("ZodSuccess",(t,e)=>{Pue.init(t,e),Qn.init(t,e),t.unwrap=()=>t._zod.def.innerType});function aHe(t){return new Mde({type:"success",innerType:t})}const Rde=Le("ZodCatch",(t,e)=>{kue.init(t,e),Qn.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Ide(t,e){return new Rde({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Nde=Le("ZodNaN",(t,e)=>{Aue.init(t,e),Qn.init(t,e)});function oHe(t){return _fe(Nde,t)}const XV=Le("ZodPipe",(t,e)=>{Lue.init(t,e),Qn.init(t,e),t.in=e.in,t.out=e.out});function R_(t,e){return new XV({type:"pipe",in:t,out:e})}const ZV=Le("ZodCodec",(t,e)=>{XV.init(t,e),VL.init(t,e)});function sHe(t,e,n){return new ZV({type:"pipe",in:t,out:e,transform:n.decode,reverseTransform:n.encode})}const Pde=Le("ZodReadonly",(t,e)=>{Vue.init(t,e),Qn.init(t,e),t.unwrap=()=>t._zod.def.innerType});function kde(t){return new Pde({type:"readonly",innerType:t})}const Ade=Le("ZodTemplateLiteral",(t,e)=>{$ue.init(t,e),Qn.init(t,e)});function cHe(t,e){return new Ade({type:"template_literal",parts:t,...ht(e)})}const Lde=Le("ZodLazy",(t,e)=>{Fue.init(t,e),Qn.init(t,e),t.unwrap=()=>t._zod.def.getter()});function Vde(t){return new Lde({type:"lazy",getter:t})}const $de=Le("ZodPromise",(t,e)=>{Uue.init(t,e),Qn.init(t,e),t.unwrap=()=>t._zod.def.innerType});function lHe(t){return new $de({type:"promise",innerType:t})}const jde=Le("ZodFunction",(t,e)=>{jue.init(t,e),Qn.init(t,e)});function KK(t){return new jde({type:"function",input:Array.isArray(t?.input)?pde(t?.input):t?.input??u8(Dy()),output:t?.output??Dy()})}const d8=Le("ZodCustom",(t,e)=>{Bue.init(t,e),Qn.init(t,e)});function uHe(t){const e=new wa({check:"custom"});return e._zod.check=t,e}function fHe(t,e){return Nfe(d8,t??(()=>!0),e)}function Ude(t,e={}){return Pfe(d8,t,e)}function Fde(t){return kfe(t)}function dHe(t,e={error:`Input not instance of ${t.name}`}){const n=new d8({type:"custom",check:"custom",fn:r=>r instanceof t,abort:!0,...ht(e)});return n._zod.bag.Class=t,n}const hHe=(...t)=>Lfe({Codec:ZV,Boolean:c8,String:a8},...t);function gHe(t){const e=Vde(()=>GV([Ra(t),tde(),jV(),ade(),u8(e),mde(Ra(),e)]));return e}function pHe(t,e){return R_(qV(t),e)}const mHe={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function vHe(t){nc({customError:t})}function yHe(){return nc().customError}var EN;EN||(EN={});function xHe(t){return Xue(a8,t)}function wHe(t){return rfe(s8,t)}function bHe(t){return ufe(c8,t)}function SHe(t){return dfe(l8,t)}function CHe(t){return Cfe(BV,t)}const _He=Object.freeze(Object.defineProperty({__proto__:null,bigint:SHe,boolean:bHe,date:CHe,number:wHe,string:xHe},Symbol.toStringTag,{value:"Module"}));nc(zue());const Dr=Object.freeze(Object.defineProperty({__proto__:null,$brand:lce,$input:Kue,$output:que,NEVER:cce,TimePrecision:Zue,ZodAny:ode,ZodArray:ude,ZodBase64:AV,ZodBase64URL:LV,ZodBigInt:l8,ZodBigIntFormat:UV,ZodBoolean:c8,ZodCIDRv4:PV,ZodCIDRv6:kV,ZodCUID:EV,ZodCUID2:OV,ZodCatch:Rde,ZodCodec:ZV,ZodCustom:d8,ZodCustomStringFormat:Nb,ZodDate:BV,ZodDefault:_de,ZodDiscriminatedUnion:fde,ZodE164:VV,ZodEmail:CV,ZodEmoji:_V,ZodEnum:Tw,ZodError:uWe,ZodFile:bde,get ZodFirstPartyTypeKind(){return EN},ZodFunction:jde,ZodGUID:O_,ZodIPv4:IV,ZodIPv6:NV,ZodISODate:xV,ZodISODateTime:yV,ZodISODuration:bV,ZodISOTime:wV,ZodIntersection:dde,ZodIssueCode:mHe,ZodJWT:$V,ZodKSUID:RV,ZodLazy:Lde,ZodLiteral:xde,ZodMap:vde,ZodNaN:Nde,ZodNanoID:TV,ZodNever:cde,ZodNonOptional:YV,ZodNull:ide,ZodNullable:Cde,ZodNumber:s8,ZodNumberFormat:p2,ZodObject:f8,ZodOptional:KV,ZodPipe:XV,ZodPrefault:Ede,ZodPromise:$de,ZodReadonly:Pde,ZodRealError:Il,ZodRecord:WV,ZodSet:yde,ZodString:a8,ZodStringFormat:Ni,ZodSuccess:Mde,ZodSymbol:nde,ZodTemplateLiteral:Ade,ZodTransform:Sde,ZodTuple:gde,ZodType:Qn,ZodULID:DV,ZodURL:o8,ZodUUID:V0,ZodUndefined:rde,ZodUnion:zV,ZodUnknown:sde,ZodVoid:lde,ZodXID:MV,_ZodString:SV,_default:Tde,_function:KK,any:qWe,array:u8,base64:RWe,base64url:IWe,bigint:BWe,boolean:jV,catch:Ide,check:uHe,cidrv4:DWe,cidrv6:MWe,clone:Eu,codec:sHe,coerce:_He,config:nc,core:cWe,cuid:bWe,cuid2:SWe,custom:fHe,date:oy,decode:Kfe,decodeAsync:Xfe,discriminatedUnion:QWe,e164:NWe,email:fWe,emoji:xWe,encode:qfe,encodeAsync:Yfe,endsWith:dV,enum:HV,file:rHe,flattenError:mL,float32:$We,float64:jWe,formatError:vL,function:KK,getErrorMap:yHe,globalRegistry:xm,gt:Km,gte:pl,guid:dWe,hash:VWe,hex:LWe,hostname:AWe,httpUrl:yWe,includes:uV,instanceof:dHe,int:TN,int32:UWe,int64:zWe,intersection:hde,ipv4:EWe,ipv6:OWe,iso:lWe,json:gHe,jwt:PWe,keyof:YWe,ksuid:TWe,lazy:Vde,length:i8,literal:wde,locales:Hue,looseObject:ZWe,lowercase:cV,lt:qm,lte:uf,map:eHe,maxLength:r8,maxSize:n8,mime:hV,minLength:Oy,minSize:_w,multipleOf:Cw,nan:oHe,nanoid:wWe,nativeEnum:nHe,negative:Efe,never:FV,nonnegative:Dfe,nonoptional:Dde,nonpositive:Ofe,normalize:gV,null:ade,nullable:M_,nullish:iHe,number:tde,object:m2,optional:D_,overwrite:b1,parse:zfe,parseAsync:Gfe,partialRecord:JWe,pipe:R_,positive:Tfe,prefault:Ode,preprocess:pHe,prettifyError:Mce,promise:lHe,property:Mfe,readonly:kde,record:mde,refine:Ude,regex:sV,regexes:DL,registry:jL,safeDecode:Qfe,safeDecodeAsync:ede,safeEncode:Zfe,safeEncodeAsync:Jfe,safeParse:Wfe,safeParseAsync:Hfe,set:tHe,setErrorMap:vHe,size:oV,startsWith:fV,strictObject:XWe,string:Ra,stringFormat:kWe,stringbool:hHe,success:aHe,superRefine:Fde,symbol:WWe,templateLiteral:cHe,toJSONSchema:Vfe,toLowerCase:mV,toUpperCase:vV,transform:qV,treeifyError:Oce,trim:pV,tuple:pde,uint32:FWe,uint64:GWe,ulid:CWe,undefined:HWe,union:GV,unknown:Dy,uppercase:lV,url:vWe,util:Tce,uuid:hWe,uuidv4:gWe,uuidv6:pWe,uuidv7:mWe,void:KWe,xid:_We},Symbol.toStringTag,{value:"Module"})),THe=m2({login:Ra().min(1,"Логин обязателен для заполнения"),password:Ra().min(1,"Пароль обязателен для заполнения")}),YK=(t,e,n)=>{if(t&&"reportValidity"in t){const r=St(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},ON=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?YK(r.ref,n,t):r&&r.refs&&r.refs.forEach(i=>YK(i,n,t))}},XK=(t,e)=>{e.shouldUseNativeValidation&&ON(t,e);const n={};for(const r in t){const i=St(e.fields,r),a=Object.assign(t[r]||{},{ref:i&&i.ref});if(EHe(e.names||Object.keys(t),r)){const o=Object.assign({},St(n,r));kr(o,"root",a),kr(n,r,o)}else kr(n,r,a)}return n},EHe=(t,e)=>{const n=ZK(e);return t.some(r=>ZK(r).match(`^${n}\\.\\d+`))};function ZK(t){return t.replace(/\]|\[/g,"")}function QK(t,e){try{var n=t()}catch(r){return e(r)}return n&&n.then?n.then(void 0,e):n}function OHe(t,e){for(var n={};t.length;){var r=t[0],i=r.code,a=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(u){return u.errors.forEach(function(f){return t.push(f)})}),e){var c=n[o].types,l=c&&c[r.code];n[o]=HA(o,e,n,i,l?[].concat(l,r.message):r.message)}t.shift()}return n}function DHe(t,e){for(var n={};t.length;){var r=t[0],i=r.code,a=r.message,o=r.path.join(".");if(!n[o])if(r.code==="invalid_union"&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code==="invalid_union"&&r.errors.forEach(function(u){return u.forEach(function(f){return t.push(f)})}),e){var c=n[o].types,l=c&&c[r.code];n[o]=HA(o,e,n,i,l?[].concat(l,r.message):r.message)}t.shift()}return n}function v2(t,e,n){if(n===void 0&&(n={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(t))return function(r,i,a){try{return Promise.resolve(QK(function(){return Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(o){return a.shouldUseNativeValidation&&ON({},a),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(s){return Array.isArray(s?.issues)})(o))return{values:{},errors:XK(OHe(o.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw o}))}catch(o){return Promise.reject(o)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(t))return function(r,i,a){try{return Promise.resolve(QK(function(){return Promise.resolve((n.mode==="sync"?C_:__)(t,r,e)).then(function(o){return a.shouldUseNativeValidation&&ON({},a),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(s){return s instanceof e8})(o))return{values:{},errors:XK(DHe(o.issues,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw o}))}catch(o){return Promise.reject(o)}};throw new Error("Invalid input: not a Zod schema")}const MHe=()=>{const{t}=Hn("login"),{authorize:e,needSelect:n,persons:r,isAuthorizationLoading:i}=tBe(),[a,o]=D.useState(null),s=Sf(),c=c2({resolver:v2(THe),defaultValues:{login:"",password:""},mode:"all"}),l=async h=>{const m=await e(h);"need_select"in m&&m.need_select&&"persons"in m&&m.persons?o(h):"success"in m&&m.success&&s(ws.DASHBOARD)},u=async h=>{if(!a)return;(await e({...a,person_id:h.toString()})).success&&s(ws.DASHBOARD)},f=()=>{o(null)},d=!!n&&!!r&&!!a;return w.jsxs(w.Fragment,{children:[w.jsx(l2,{...c,children:w.jsxs("form",{className:XO.form,onSubmit:c.handleSubmit(l),children:[w.jsx(xn,{control:c.control,name:"login",render:({field:h})=>w.jsxs(wn,{className:XO.field,children:[w.jsx(ir,{htmlFor:h.name,children:t("login_form.login_label")}),w.jsx(bn,{children:w.jsx(Ar,{id:h.name,type:"text",placeholder:t("login_form.login_placeholder"),onKeyDown:y_,...h})}),w.jsx(Ig,{})]})}),w.jsx(xn,{control:c.control,name:"password",render:({field:h})=>w.jsxs(wn,{className:XO.field,children:[w.jsx(ir,{htmlFor:h.name,children:t("login_form.password_label")}),w.jsx(bn,{children:w.jsx(Ar,{id:h.name,type:"password",placeholder:t("login_form.password_placeholder"),onKeyDown:y_,...h})}),w.jsx(Ig,{})]})}),w.jsx("div",{children:w.jsx(bt,{disabled:!c.formState.isValid||i,loading:i,type:"submit",children:t("login_form.submit_button")})})]})}),w.jsx(yUe,{isOpen:d,onOpenChange:h=>{h||f()},persons:r||[],onSelect:u,isLoading:i})]})},RHe="_wrapper_1n1no_1",IHe={wrapper:RHe};function Oc({className:t,...e}){return w.jsx("div",{"data-slot":"card",className:rt("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...e})}function Jf({className:t,...e}){return w.jsx("div",{"data-slot":"card-header",className:rt("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...e})}function pg({className:t,...e}){return w.jsx("div",{"data-slot":"card-title",className:rt("leading-none font-semibold",t),...e})}function Jp({className:t,...e}){return w.jsx("div",{"data-slot":"card-description",className:rt("text-muted-foreground text-sm",t),...e})}function Yu({className:t,...e}){return w.jsx("div",{"data-slot":"card-content",className:rt("px-6",t),...e})}const NHe=()=>{const{t}=Hn("login");return w.jsxs(Oc,{className:IHe.wrapper,children:[w.jsxs(Jf,{children:[w.jsx(pg,{children:t("login_card.title")}),w.jsx(Jp,{children:t("login_card.description")})]}),w.jsx(Yu,{children:w.jsx(MHe,{})})]})};function QV(t){const e=t+"CollectionProvider",[n,r]=Uc(e),[i,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:y,children:x}=p,S=Ce.useRef(null),C=Ce.useRef(new Map).current;return w.jsx(i,{scope:y,itemMap:C,collectionRef:S,children:x})};o.displayName=e;const s=t+"CollectionSlot",c=Hg(s),l=Ce.forwardRef((p,y)=>{const{scope:x,children:S}=p,C=a(s,x),_=$n(y,C.collectionRef);return w.jsx(c,{ref:_,children:S})});l.displayName=s;const u=t+"CollectionItemSlot",f="data-radix-collection-item",d=Hg(u),h=Ce.forwardRef((p,y)=>{const{scope:x,children:S,...C}=p,_=Ce.useRef(null),T=$n(y,_),O=a(u,x);return Ce.useEffect(()=>(O.itemMap.set(_,{ref:_,...C}),()=>void O.itemMap.delete(_))),w.jsx(d,{[f]:"",ref:T,children:S})});h.displayName=u;function m(p){const y=a(t+"CollectionConsumer",p);return Ce.useCallback(()=>{const S=y.collectionRef.current;if(!S)return[];const C=Array.from(S.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((O,M)=>C.indexOf(O.ref.current)-C.indexOf(M.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:l,ItemSlot:h},m,r]}var PHe=D.createContext(void 0);function h8(t){const e=D.useContext(PHe);return t||e||"ltr"}const kHe=["top","right","bottom","left"],Zg=Math.min,dl=Math.max,I_=Math.round,Z4=Math.floor,dd=t=>({x:t,y:t}),AHe={left:"right",right:"left",bottom:"top",top:"bottom"},LHe={start:"end",end:"start"};function DN(t,e,n){return dl(t,Zg(e,n))}function fh(t,e){return typeof t=="function"?t(e):t}function dh(t){return t.split("-")[0]}function y2(t){return t.split("-")[1]}function JV(t){return t==="x"?"y":"x"}function e$(t){return t==="y"?"height":"width"}const VHe=new Set(["top","bottom"]);function od(t){return VHe.has(dh(t))?"y":"x"}function t$(t){return JV(od(t))}function $He(t,e,n){n===void 0&&(n=!1);const r=y2(t),i=t$(t),a=e$(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=N_(o)),[o,N_(o)]}function jHe(t){const e=N_(t);return[MN(t),e,MN(e)]}function MN(t){return t.replace(/start|end/g,e=>LHe[e])}const JK=["left","right"],eY=["right","left"],UHe=["top","bottom"],FHe=["bottom","top"];function BHe(t,e,n){switch(t){case"top":case"bottom":return n?e?eY:JK:e?JK:eY;case"left":case"right":return e?UHe:FHe;default:return[]}}function zHe(t,e,n,r){const i=y2(t);let a=BHe(dh(t),n==="start",r);return i&&(a=a.map(o=>o+"-"+i),e&&(a=a.concat(a.map(MN)))),a}function N_(t){return t.replace(/left|right|bottom|top/g,e=>AHe[e])}function GHe(t){return{top:0,right:0,bottom:0,left:0,...t}}function Bde(t){return typeof t!="number"?GHe(t):{top:t,right:t,bottom:t,left:t}}function P_(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 tY(t,e,n){let{reference:r,floating:i}=t;const a=od(e),o=t$(e),s=e$(o),c=dh(e),l=a==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,d=r[s]/2-i[s]/2;let h;switch(c){case"top":h={x:u,y:r.y-i.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-i.width,y:f};break;default:h={x:r.x,y:r.y}}switch(y2(e)){case"start":h[o]-=d*(n&&l?-1:1);break;case"end":h[o]+=d*(n&&l?-1:1);break}return h}const WHe=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let l=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=tY(l,r,c),d=r,h={},m=0;for(let p=0;p<s.length;p++){const{name:y,fn:x}=s[p],{x:S,y:C,data:_,reset:T}=await x({x:u,y:f,initialPlacement:r,placement:d,strategy:i,middlewareData:h,rects:l,platform:o,elements:{reference:t,floating:e}});u=S??u,f=C??f,h={...h,[y]:{...h[y],..._}},T&&m<=50&&(m++,typeof T=="object"&&(T.placement&&(d=T.placement),T.rects&&(l=T.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):T.rects),{x:u,y:f}=tY(l,d,c)),p=-1)}return{x:u,y:f,placement:d,strategy:i,middlewareData:h}};async function Ew(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=t,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=fh(e,t),m=Bde(h),y=s[d?f==="floating"?"reference":"floating":f],x=P_(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(y)))==null||n?y:y.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),S=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),_=await(a.isElement==null?void 0:a.isElement(C))?await(a.getScale==null?void 0:a.getScale(C))||{x:1,y:1}:{x:1,y:1},T=P_(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:S,offsetParent:C,strategy:c}):S);return{top:(x.top-T.top+m.top)/_.y,bottom:(T.bottom-x.bottom+m.bottom)/_.y,left:(x.left-T.left+m.left)/_.x,right:(T.right-x.right+m.right)/_.x}}const HHe=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=e,{element:l,padding:u=0}=fh(t,e)||{};if(l==null)return{};const f=Bde(u),d={x:n,y:r},h=t$(i),m=e$(h),p=await o.getDimensions(l),y=h==="y",x=y?"top":"left",S=y?"bottom":"right",C=y?"clientHeight":"clientWidth",_=a.reference[m]+a.reference[h]-d[h]-a.floating[m],T=d[h]-a.reference[h],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let M=O?O[C]:0;(!M||!await(o.isElement==null?void 0:o.isElement(O)))&&(M=s.floating[C]||a.floating[m]);const I=_/2-T/2,V=M/2-p[m]/2-1,k=Zg(f[x],V),L=Zg(f[S],V),$=k,W=M-p[m]-L,G=M/2-p[m]/2+I,oe=DN($,G,W),U=!c.arrow&&y2(i)!=null&&G!==oe&&a.reference[m]/2-(G<$?k:L)-p[m]/2<0,Y=U?G<$?G-$:G-W:0;return{[h]:d[h]+Y,data:{[h]:oe,centerOffset:G-oe-Y,...U&&{alignmentOffset:Y}},reset:U}}}),qHe=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:p=!0,...y}=fh(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const x=dh(i),S=od(s),C=dh(s)===s,_=await(c.isRTL==null?void 0:c.isRTL(l.floating)),T=d||(C||!p?[N_(s)]:jHe(s)),O=m!=="none";!d&&O&&T.push(...zHe(s,p,m,_));const M=[s,...T],I=await Ew(e,y),V=[];let k=((r=a.flip)==null?void 0:r.overflows)||[];if(u&&V.push(I[x]),f){const G=$He(i,o,_);V.push(I[G[0]],I[G[1]])}if(k=[...k,{placement:i,overflows:V}],!V.every(G=>G<=0)){var L,$;const G=(((L=a.flip)==null?void 0:L.index)||0)+1,oe=M[G];if(oe&&(!(f==="alignment"?S!==od(oe):!1)||k.every(J=>od(J.placement)===S?J.overflows[0]>0:!0)))return{data:{index:G,overflows:k},reset:{placement:oe}};let U=($=k.filter(Y=>Y.overflows[0]<=0).sort((Y,J)=>Y.overflows[1]-J.overflows[1])[0])==null?void 0:$.placement;if(!U)switch(h){case"bestFit":{var W;const Y=(W=k.filter(J=>{if(O){const ne=od(J.placement);return ne===S||ne==="y"}return!0}).map(J=>[J.placement,J.overflows.filter(ne=>ne>0).reduce((ne,F)=>ne+F,0)]).sort((J,ne)=>J[1]-ne[1])[0])==null?void 0:W[0];Y&&(U=Y);break}case"initialPlacement":U=s;break}if(i!==U)return{reset:{placement:U}}}return{}}}};function nY(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function rY(t){return kHe.some(e=>t[e]>=0)}const KHe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=fh(t,e);switch(r){case"referenceHidden":{const a=await Ew(e,{...i,elementContext:"reference"}),o=nY(a,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:rY(o)}}}case"escaped":{const a=await Ew(e,{...i,altBoundary:!0}),o=nY(a,n.floating);return{data:{escapedOffsets:o,escaped:rY(o)}}}default:return{}}}}},zde=new Set(["left","top"]);async function YHe(t,e){const{placement:n,platform:r,elements:i}=t,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=dh(n),s=y2(n),c=od(n)==="y",l=zde.has(o)?-1:1,u=a&&c?-1:1,f=fh(e,t);let{mainAxis:d,crossAxis:h,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof m=="number"&&(h=s==="end"?m*-1:m),c?{x:h*u,y:d*l}:{x:d*l,y:h*u}}const XHe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:a,placement:o,middlewareData:s}=e,c=await YHe(e,t);return o===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:{...c,placement:o}}}}},ZHe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:y=>{let{x,y:S}=y;return{x,y:S}}},...c}=fh(t,e),l={x:n,y:r},u=await Ew(e,c),f=od(dh(i)),d=JV(f);let h=l[d],m=l[f];if(a){const y=d==="y"?"top":"left",x=d==="y"?"bottom":"right",S=h+u[y],C=h-u[x];h=DN(S,h,C)}if(o){const y=f==="y"?"top":"left",x=f==="y"?"bottom":"right",S=m+u[y],C=m-u[x];m=DN(S,m,C)}const p=s.fn({...e,[d]:h,[f]:m});return{...p,data:{x:p.x-n,y:p.y-r,enabled:{[d]:a,[f]:o}}}}}},QHe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:a,middlewareData:o}=e,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=fh(t,e),u={x:n,y:r},f=od(i),d=JV(f);let h=u[d],m=u[f];const p=fh(s,e),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const C=d==="y"?"height":"width",_=a.reference[d]-a.floating[C]+y.mainAxis,T=a.reference[d]+a.reference[C]-y.mainAxis;h<_?h=_:h>T&&(h=T)}if(l){var x,S;const C=d==="y"?"width":"height",_=zde.has(dh(i)),T=a.reference[f]-a.floating[C]+(_&&((x=o.offset)==null?void 0:x[f])||0)+(_?0:y.crossAxis),O=a.reference[f]+a.reference[C]+(_?0:((S=o.offset)==null?void 0:S[f])||0)-(_?y.crossAxis:0);m<T?m=T:m>O&&(m=O)}return{[d]:h,[f]:m}}}},JHe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:a,platform:o,elements:s}=e,{apply:c=()=>{},...l}=fh(t,e),u=await Ew(e,l),f=dh(i),d=y2(i),h=od(i)==="y",{width:m,height:p}=a.floating;let y,x;f==="top"||f==="bottom"?(y=f,x=d===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(x=f,y=d==="end"?"top":"bottom");const S=p-u.top-u.bottom,C=m-u.left-u.right,_=Zg(p-u[y],S),T=Zg(m-u[x],C),O=!e.middlewareData.shift;let M=_,I=T;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(I=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(M=S),O&&!d){const k=dl(u.left,0),L=dl(u.right,0),$=dl(u.top,0),W=dl(u.bottom,0);h?I=m-2*(k!==0||L!==0?k+L:dl(u.left,u.right)):M=p-2*($!==0||W!==0?$+W:dl(u.top,u.bottom))}await c({...e,availableWidth:I,availableHeight:M});const V=await o.getDimensions(s.floating);return m!==V.width||p!==V.height?{reset:{rects:!0}}:{}}}};function g8(){return typeof window<"u"}function x2(t){return Gde(t)?(t.nodeName||"").toLowerCase():"#document"}function xl(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Nd(t){var e;return(e=(Gde(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Gde(t){return g8()?t instanceof Node||t instanceof xl(t).Node:!1}function hf(t){return g8()?t instanceof Element||t instanceof xl(t).Element:!1}function wd(t){return g8()?t instanceof HTMLElement||t instanceof xl(t).HTMLElement:!1}function iY(t){return!g8()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof xl(t).ShadowRoot}const eqe=new Set(["inline","contents"]);function Pb(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=gf(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!eqe.has(i)}const tqe=new Set(["table","td","th"]);function nqe(t){return tqe.has(x2(t))}const rqe=[":popover-open",":modal"];function p8(t){return rqe.some(e=>{try{return t.matches(e)}catch{return!1}})}const iqe=["transform","translate","scale","rotate","perspective"],aqe=["transform","translate","scale","rotate","perspective","filter"],oqe=["paint","layout","strict","content"];function n$(t){const e=r$(),n=hf(t)?gf(t):t;return iqe.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)||aqe.some(r=>(n.willChange||"").includes(r))||oqe.some(r=>(n.contain||"").includes(r))}function sqe(t){let e=Qg(t);for(;wd(e)&&!My(e);){if(n$(e))return e;if(p8(e))return null;e=Qg(e)}return null}function r$(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const cqe=new Set(["html","body","#document"]);function My(t){return cqe.has(x2(t))}function gf(t){return xl(t).getComputedStyle(t)}function m8(t){return hf(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Qg(t){if(x2(t)==="html")return t;const e=t.assignedSlot||t.parentNode||iY(t)&&t.host||Nd(t);return iY(e)?e.host:e}function Wde(t){const e=Qg(t);return My(e)?t.ownerDocument?t.ownerDocument.body:t.body:wd(e)&&Pb(e)?e:Wde(e)}function Ow(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Wde(t),a=i===((r=t.ownerDocument)==null?void 0:r.body),o=xl(i);if(a){const s=RN(o);return e.concat(o,o.visualViewport||[],Pb(i)?i:[],s&&n?Ow(s):[])}return e.concat(i,Ow(i,[],n))}function RN(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Hde(t){const e=gf(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=wd(t),a=i?t.offsetWidth:n,o=i?t.offsetHeight:r,s=I_(n)!==a||I_(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function i$(t){return hf(t)?t:t.contextElement}function sy(t){const e=i$(t);if(!wd(e))return dd(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:a}=Hde(e);let o=(a?I_(n.width):n.width)/r,s=(a?I_(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}const lqe=dd(0);function qde(t){const e=xl(t);return!r$()||!e.visualViewport?lqe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function uqe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==xl(t)?!1:e}function Ym(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),a=i$(t);let o=dd(1);e&&(r?hf(r)&&(o=sy(r)):o=sy(t));const s=uqe(a,n,r)?qde(a):dd(0);let c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,f=i.height/o.y;if(a){const d=xl(a),h=r&&hf(r)?xl(r):r;let m=d,p=RN(m);for(;p&&r&&h!==m;){const y=sy(p),x=p.getBoundingClientRect(),S=gf(p),C=x.left+(p.clientLeft+parseFloat(S.paddingLeft))*y.x,_=x.top+(p.clientTop+parseFloat(S.paddingTop))*y.y;c*=y.x,l*=y.y,u*=y.x,f*=y.y,c+=C,l+=_,m=xl(p),p=RN(m)}}return P_({width:u,height:f,x:c,y:l})}function v8(t,e){const n=m8(t).scrollLeft;return e?e.left+n:Ym(Nd(t)).left+n}function Kde(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-v8(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function fqe(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const a=i==="fixed",o=Nd(r),s=e?p8(e.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=dd(1);const u=dd(0),f=wd(r);if((f||!f&&!a)&&((x2(r)!=="body"||Pb(o))&&(c=m8(r)),wd(r))){const h=Ym(r);l=sy(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const d=o&&!f&&!a?Kde(o,c):dd(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+d.x,y:n.y*l.y-c.scrollTop*l.y+u.y+d.y}}function dqe(t){return Array.from(t.getClientRects())}function hqe(t){const e=Nd(t),n=m8(t),r=t.ownerDocument.body,i=dl(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=dl(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+v8(t);const s=-n.scrollTop;return gf(r).direction==="rtl"&&(o+=dl(e.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}const aY=25;function gqe(t,e){const n=xl(t),r=Nd(t),i=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;const u=r$();(!u||u&&e==="fixed")&&(s=i.offsetLeft,c=i.offsetTop)}const l=v8(r);if(l<=0){const u=r.ownerDocument,f=u.body,d=getComputedStyle(f),h=u.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,m=Math.abs(r.clientWidth-f.clientWidth-h);m<=aY&&(a-=m)}else l<=aY&&(a+=l);return{width:a,height:o,x:s,y:c}}const pqe=new Set(["absolute","fixed"]);function mqe(t,e){const n=Ym(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,a=wd(t)?sy(t):dd(1),o=t.clientWidth*a.x,s=t.clientHeight*a.y,c=i*a.x,l=r*a.y;return{width:o,height:s,x:c,y:l}}function oY(t,e,n){let r;if(e==="viewport")r=gqe(t,n);else if(e==="document")r=hqe(Nd(t));else if(hf(e))r=mqe(e,n);else{const i=qde(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return P_(r)}function Yde(t,e){const n=Qg(t);return n===e||!hf(n)||My(n)?!1:gf(n).position==="fixed"||Yde(n,e)}function vqe(t,e){const n=e.get(t);if(n)return n;let r=Ow(t,[],!1).filter(s=>hf(s)&&x2(s)!=="body"),i=null;const a=gf(t).position==="fixed";let o=a?Qg(t):t;for(;hf(o)&&!My(o);){const s=gf(o),c=n$(o);!c&&s.position==="fixed"&&(i=null),(a?!c&&!i:!c&&s.position==="static"&&!!i&&pqe.has(i.position)||Pb(o)&&!c&&Yde(t,o))?r=r.filter(u=>u!==o):i=s,o=Qg(o)}return e.set(t,r),r}function yqe(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?p8(e)?[]:vqe(e,this._c):[].concat(n),r],s=o[0],c=o.reduce((l,u)=>{const f=oY(e,u,i);return l.top=dl(f.top,l.top),l.right=Zg(f.right,l.right),l.bottom=Zg(f.bottom,l.bottom),l.left=dl(f.left,l.left),l},oY(e,s,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function xqe(t){const{width:e,height:n}=Hde(t);return{width:e,height:n}}function wqe(t,e,n){const r=wd(e),i=Nd(e),a=n==="fixed",o=Ym(t,!0,a,e);let s={scrollLeft:0,scrollTop:0};const c=dd(0);function l(){c.x=v8(i)}if(r||!r&&!a)if((x2(e)!=="body"||Pb(i))&&(s=m8(e)),r){const h=Ym(e,!0,a,e);c.x=h.x+e.clientLeft,c.y=h.y+e.clientTop}else i&&l();a&&!r&&i&&l();const u=i&&!r&&!a?Kde(i,s):dd(0),f=o.left+s.scrollLeft-c.x-u.x,d=o.top+s.scrollTop-c.y-u.y;return{x:f,y:d,width:o.width,height:o.height}}function yD(t){return gf(t).position==="static"}function sY(t,e){if(!wd(t)||gf(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Nd(t)===n&&(n=n.ownerDocument.body),n}function Xde(t,e){const n=xl(t);if(p8(t))return n;if(!wd(t)){let i=Qg(t);for(;i&&!My(i);){if(hf(i)&&!yD(i))return i;i=Qg(i)}return n}let r=sY(t,e);for(;r&&nqe(r)&&yD(r);)r=sY(r,e);return r&&My(r)&&yD(r)&&!n$(r)?n:r||sqe(t)||n}const bqe=async function(t){const e=this.getOffsetParent||Xde,n=this.getDimensions,r=await n(t.floating);return{reference:wqe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Sqe(t){return gf(t).direction==="rtl"}const Cqe={convertOffsetParentRelativeRectToViewportRelativeRect:fqe,getDocumentElement:Nd,getClippingRect:yqe,getOffsetParent:Xde,getElementRects:bqe,getClientRects:dqe,getDimensions:xqe,getScale:sy,isElement:hf,isRTL:Sqe};function Zde(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function _qe(t,e){let n=null,r;const i=Nd(t);function a(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();const l=t.getBoundingClientRect(),{left:u,top:f,width:d,height:h}=l;if(s||e(),!d||!h)return;const m=Z4(f),p=Z4(i.clientWidth-(u+d)),y=Z4(i.clientHeight-(f+h)),x=Z4(u),C={rootMargin:-m+"px "+-p+"px "+-y+"px "+-x+"px",threshold:dl(0,Zg(1,c))||1};let _=!0;function T(O){const M=O[0].intersectionRatio;if(M!==c){if(!_)return o();M?o(!1,M):r=setTimeout(()=>{o(!1,1e-7)},1e3)}M===1&&!Zde(l,t.getBoundingClientRect())&&o(),_=!1}try{n=new IntersectionObserver(T,{...C,root:i.ownerDocument})}catch{n=new IntersectionObserver(T,C)}n.observe(t)}return o(!0),a}function Tqe(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,l=i$(t),u=i||a?[...l?Ow(l):[],...Ow(e)]:[];u.forEach(x=>{i&&x.addEventListener("scroll",n,{passive:!0}),a&&x.addEventListener("resize",n)});const f=l&&s?_qe(l,n):null;let d=-1,h=null;o&&(h=new ResizeObserver(x=>{let[S]=x;S&&S.target===l&&h&&(h.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var C;(C=h)==null||C.observe(e)})),n()}),l&&!c&&h.observe(l),h.observe(e));let m,p=c?Ym(t):null;c&&y();function y(){const x=Ym(t);p&&!Zde(p,x)&&n(),p=x,m=requestAnimationFrame(y)}return n(),()=>{var x;u.forEach(S=>{i&&S.removeEventListener("scroll",n),a&&S.removeEventListener("resize",n)}),f?.(),(x=h)==null||x.disconnect(),h=null,c&&cancelAnimationFrame(m)}}const Eqe=XHe,Oqe=ZHe,Dqe=qHe,Mqe=JHe,Rqe=KHe,cY=HHe,Iqe=QHe,Nqe=(t,e,n)=>{const r=new Map,i={platform:Cqe,...n},a={...i.platform,_c:r};return WHe(t,e,{...i,platform:a})};var Pqe=typeof document<"u",kqe=function(){},fC=Pqe?D.useLayoutEffect:kqe;function k_(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(!k_(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 a=i[r];if(!(a==="_owner"&&t.$$typeof)&&!k_(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function Qde(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function lY(t,e){const n=Qde(t);return Math.round(e*n)/n}function xD(t){const e=D.useRef(t);return fC(()=>{e.current=t}),e}function Aqe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=t,[u,f]=D.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[d,h]=D.useState(r);k_(d,r)||h(r);const[m,p]=D.useState(null),[y,x]=D.useState(null),S=D.useCallback(J=>{J!==O.current&&(O.current=J,p(J))},[]),C=D.useCallback(J=>{J!==M.current&&(M.current=J,x(J))},[]),_=a||m,T=o||y,O=D.useRef(null),M=D.useRef(null),I=D.useRef(u),V=c!=null,k=xD(c),L=xD(i),$=xD(l),W=D.useCallback(()=>{if(!O.current||!M.current)return;const J={placement:e,strategy:n,middleware:d};L.current&&(J.platform=L.current),Nqe(O.current,M.current,J).then(ne=>{const F={...ne,isPositioned:$.current!==!1};G.current&&!k_(I.current,F)&&(I.current=F,x1.flushSync(()=>{f(F)}))})},[d,e,n,L,$]);fC(()=>{l===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,f(J=>({...J,isPositioned:!1})))},[l]);const G=D.useRef(!1);fC(()=>(G.current=!0,()=>{G.current=!1}),[]),fC(()=>{if(_&&(O.current=_),T&&(M.current=T),_&&T){if(k.current)return k.current(_,T,W);W()}},[_,T,W,k,V]);const oe=D.useMemo(()=>({reference:O,floating:M,setReference:S,setFloating:C}),[S,C]),U=D.useMemo(()=>({reference:_,floating:T}),[_,T]),Y=D.useMemo(()=>{const J={position:n,left:0,top:0};if(!U.floating)return J;const ne=lY(U.floating,u.x),F=lY(U.floating,u.y);return s?{...J,transform:"translate("+ne+"px, "+F+"px)",...Qde(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ne,top:F}},[n,s,U.floating,u.x,u.y]);return D.useMemo(()=>({...u,update:W,refs:oe,elements:U,floatingStyles:Y}),[u,W,oe,U,Y])}const Lqe=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?cY({element:r.current,padding:i}).fn(n):{}:r?cY({element:r,padding:i}).fn(n):{}}}},Vqe=(t,e)=>({...Eqe(t),options:[t,e]}),$qe=(t,e)=>({...Oqe(t),options:[t,e]}),jqe=(t,e)=>({...Iqe(t),options:[t,e]}),Uqe=(t,e)=>({...Dqe(t),options:[t,e]}),Fqe=(t,e)=>({...Mqe(t),options:[t,e]}),Bqe=(t,e)=>({...Rqe(t),options:[t,e]}),zqe=(t,e)=>({...Lqe(t),options:[t,e]});var Gqe="Arrow",Jde=D.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...a}=t;return w.jsx(Yt.svg,{...a,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:w.jsx("polygon",{points:"0,0 30,0 15,10"})})});Jde.displayName=Gqe;var Wqe=Jde;function a$(t){const[e,n]=D.useState(void 0);return ko(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const a=i[0];let o,s;if("borderBoxSize"in a){const c=a.borderBoxSize,l=Array.isArray(c)?c[0]:c;o=l.inlineSize,s=l.blockSize}else o=t.offsetWidth,s=t.offsetHeight;n({width:o,height:s})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var o$="Popper",[e0e,vp]=Uc(o$),[Hqe,t0e]=e0e(o$),n0e=t=>{const{__scopePopper:e,children:n}=t,[r,i]=D.useState(null);return w.jsx(Hqe,{scope:e,anchor:r,onAnchorChange:i,children:n})};n0e.displayName=o$;var r0e="PopperAnchor",i0e=D.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,a=t0e(r0e,n),o=D.useRef(null),s=$n(e,o),c=D.useRef(null);return D.useEffect(()=>{const l=c.current;c.current=r?.current||o.current,l!==c.current&&a.onAnchorChange(c.current)}),r?null:w.jsx(Yt.div,{...i,ref:s})});i0e.displayName=r0e;var s$="PopperContent",[qqe,Kqe]=e0e(s$),a0e=D.forwardRef((t,e)=>{const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:a="center",alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:m,...p}=t,y=t0e(s$,n),[x,S]=D.useState(null),C=$n(e,Te=>S(Te)),[_,T]=D.useState(null),O=a$(_),M=O?.width??0,I=O?.height??0,V=r+(a!=="center"?"-"+a:""),k=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},L=Array.isArray(l)?l:[l],$=L.length>0,W={padding:k,boundary:L.filter(Xqe),altBoundary:$},{refs:G,floatingStyles:oe,placement:U,isPositioned:Y,middlewareData:J}=Aqe({strategy:"fixed",placement:V,whileElementsMounted:(...Te)=>Tqe(...Te,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[Vqe({mainAxis:i+I,alignmentAxis:o}),c&&$qe({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?jqe():void 0,...W}),c&&Uqe({...W}),Fqe({...W,apply:({elements:Te,rects:Me,availableWidth:be,availableHeight:Ye})=>{const{width:ft,height:je}=Me.reference,It=Te.floating.style;It.setProperty("--radix-popper-available-width",`${be}px`),It.setProperty("--radix-popper-available-height",`${Ye}px`),It.setProperty("--radix-popper-anchor-width",`${ft}px`),It.setProperty("--radix-popper-anchor-height",`${je}px`)}}),_&&zqe({element:_,padding:s}),Zqe({arrowWidth:M,arrowHeight:I}),d&&Bqe({strategy:"referenceHidden",...W})]}),[ne,F]=c0e(U),ae=es(m);ko(()=>{Y&&ae?.()},[Y,ae]);const re=J.arrow?.x,te=J.arrow?.y,ye=J.arrow?.centerOffset!==0,[we,Oe]=D.useState();return ko(()=>{x&&Oe(window.getComputedStyle(x).zIndex)},[x]),w.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...oe,transform:Y?oe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:we,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:w.jsx(qqe,{scope:n,placedSide:ne,onArrowChange:T,arrowX:re,arrowY:te,shouldHideArrow:ye,children:w.jsx(Yt.div,{"data-side":ne,"data-align":F,...p,ref:C,style:{...p.style,animation:Y?void 0:"none"}})})})});a0e.displayName=s$;var o0e="PopperArrow",Yqe={top:"bottom",right:"left",bottom:"top",left:"right"},s0e=D.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,a=Kqe(o0e,r),o=Yqe[a.placedSide];return w.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:w.jsx(Wqe,{...i,ref:n,style:{...i.style,display:"block"}})})});s0e.displayName=o0e;function Xqe(t){return t!==null}var Zqe=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:i}=e,o=i.arrow?.centerOffset!==0,s=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[l,u]=c0e(n),f={start:"0%",center:"50%",end:"100%"}[u],d=(i.arrow?.x??0)+s/2,h=(i.arrow?.y??0)+c/2;let m="",p="";return l==="bottom"?(m=o?f:`${d}px`,p=`${-c}px`):l==="top"?(m=o?f:`${d}px`,p=`${r.floating.height+c}px`):l==="right"?(m=`${-c}px`,p=o?f:`${h}px`):l==="left"&&(m=`${r.floating.width+c}px`,p=o?f:`${h}px`),{data:{x:m,y:p}}}});function c0e(t){const[e,n="center"]=t.split("-");return[e,n]}var y8=n0e,kb=i0e,x8=a0e,w8=s0e,wD="rovingFocusGroup.onEntryFocus",Qqe={bubbles:!1,cancelable:!0},Ab="RovingFocusGroup",[IN,l0e,Jqe]=QV(Ab),[eKe,u0e]=Uc(Ab,[Jqe]),[tKe,nKe]=eKe(Ab),f0e=D.forwardRef((t,e)=>w.jsx(IN.Provider,{scope:t.__scopeRovingFocusGroup,children:w.jsx(IN.Slot,{scope:t.__scopeRovingFocusGroup,children:w.jsx(rKe,{...t,ref:e})})}));f0e.displayName=Ab;var rKe=D.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...f}=t,d=D.useRef(null),h=$n(e,d),m=h8(a),[p,y]=xd({prop:o,defaultProp:s??null,onChange:c,caller:Ab}),[x,S]=D.useState(!1),C=es(l),_=l0e(n),T=D.useRef(!1),[O,M]=D.useState(0);return D.useEffect(()=>{const I=d.current;if(I)return I.addEventListener(wD,C),()=>I.removeEventListener(wD,C)},[C]),w.jsx(tKe,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:p,onItemFocus:D.useCallback(I=>y(I),[y]),onItemShiftTab:D.useCallback(()=>S(!0),[]),onFocusableItemAdd:D.useCallback(()=>M(I=>I+1),[]),onFocusableItemRemove:D.useCallback(()=>M(I=>I-1),[]),children:w.jsx(Yt.div,{tabIndex:x||O===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...t.style},onMouseDown:Et(t.onMouseDown,()=>{T.current=!0}),onFocus:Et(t.onFocus,I=>{const V=!T.current;if(I.target===I.currentTarget&&V&&!x){const k=new CustomEvent(wD,Qqe);if(I.currentTarget.dispatchEvent(k),!k.defaultPrevented){const L=_().filter(U=>U.focusable),$=L.find(U=>U.active),W=L.find(U=>U.id===p),oe=[$,W,...L].filter(Boolean).map(U=>U.ref.current);g0e(oe,u)}}T.current=!1}),onBlur:Et(t.onBlur,()=>S(!1))})})}),d0e="RovingFocusGroupItem",h0e=D.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=t,c=No(),l=a||c,u=nKe(d0e,n),f=u.currentTabStopId===l,d=l0e(n),{onFocusableItemAdd:h,onFocusableItemRemove:m,currentTabStopId:p}=u;return D.useEffect(()=>{if(r)return h(),()=>m()},[r,h,m]),w.jsx(IN.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:w.jsx(Yt.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...s,ref:e,onMouseDown:Et(t.onMouseDown,y=>{r?u.onItemFocus(l):y.preventDefault()}),onFocus:Et(t.onFocus,()=>u.onItemFocus(l)),onKeyDown:Et(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=oKe(y,u.orientation,u.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let C=d().filter(_=>_.focusable).map(_=>_.ref.current);if(x==="last")C.reverse();else if(x==="prev"||x==="next"){x==="prev"&&C.reverse();const _=C.indexOf(y.currentTarget);C=u.loop?sKe(C,_+1):C.slice(_+1)}setTimeout(()=>g0e(C))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:p!=null}):o})})});h0e.displayName=d0e;var iKe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function aKe(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function oKe(t,e,n){const r=aKe(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return iKe[r]}function g0e(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function sKe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var cKe=f0e,lKe=h0e,NN=["Enter"," "],uKe=["ArrowDown","PageUp","Home"],p0e=["ArrowUp","PageDown","End"],fKe=[...uKe,...p0e],dKe={ltr:[...NN,"ArrowRight"],rtl:[...NN,"ArrowLeft"]},hKe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Lb="Menu",[Dw,gKe,pKe]=QV(Lb),[S1,m0e]=Uc(Lb,[pKe,vp,u0e]),b8=vp(),v0e=u0e(),[mKe,C1]=S1(Lb),[vKe,Vb]=S1(Lb),y0e=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=t,s=b8(e),[c,l]=D.useState(null),u=D.useRef(!1),f=es(a),d=h8(i);return D.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),w.jsx(y8,{...s,children:w.jsx(mKe,{scope:e,open:n,onOpenChange:f,content:c,onContentChange:l,children:w.jsx(vKe,{scope:e,onClose:D.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:d,modal:o,children:r})})})};y0e.displayName=Lb;var yKe="MenuAnchor",c$=D.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=b8(n);return w.jsx(kb,{...i,...r,ref:e})});c$.displayName=yKe;var l$="MenuPortal",[xKe,x0e]=S1(l$,{forceMount:void 0}),w0e=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,a=C1(l$,e);return w.jsx(xKe,{scope:e,forceMount:n,children:w.jsx(Lo,{present:n||a.open,children:w.jsx(f2,{asChild:!0,container:i,children:r})})})};w0e.displayName=l$;var yu="MenuContent",[wKe,u$]=S1(yu),b0e=D.forwardRef((t,e)=>{const n=x0e(yu,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,a=C1(yu,t.__scopeMenu),o=Vb(yu,t.__scopeMenu);return w.jsx(Dw.Provider,{scope:t.__scopeMenu,children:w.jsx(Lo,{present:r||a.open,children:w.jsx(Dw.Slot,{scope:t.__scopeMenu,children:o.modal?w.jsx(bKe,{...i,ref:e}):w.jsx(SKe,{...i,ref:e})})})})}),bKe=D.forwardRef((t,e)=>{const n=C1(yu,t.__scopeMenu),r=D.useRef(null),i=$n(e,r);return D.useEffect(()=>{const a=r.current;if(a)return L6(a)},[]),w.jsx(f$,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Et(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),SKe=D.forwardRef((t,e)=>{const n=C1(yu,t.__scopeMenu);return w.jsx(f$,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),CKe=Hg("MenuContent.ScrollLock"),f$=D.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:d,onDismiss:h,disableOutsideScroll:m,...p}=t,y=C1(yu,n),x=Vb(yu,n),S=b8(n),C=v0e(n),_=gKe(n),[T,O]=D.useState(null),M=D.useRef(null),I=$n(e,M,y.onContentChange),V=D.useRef(0),k=D.useRef(""),L=D.useRef(0),$=D.useRef(null),W=D.useRef("right"),G=D.useRef(0),oe=m?mb:D.Fragment,U=m?{as:CKe,allowPinchZoom:!0}:void 0,Y=ne=>{const F=k.current+ne,ae=_().filter(Te=>!Te.disabled),re=document.activeElement,te=ae.find(Te=>Te.ref.current===re)?.textValue,ye=ae.map(Te=>Te.textValue),we=AKe(ye,F,te),Oe=ae.find(Te=>Te.textValue===we)?.ref.current;(function Te(Me){k.current=Me,window.clearTimeout(V.current),Me!==""&&(V.current=window.setTimeout(()=>Te(""),1e3))})(F),Oe&&setTimeout(()=>Oe.focus())};D.useEffect(()=>()=>window.clearTimeout(V.current),[]),k6();const J=D.useCallback(ne=>W.current===$.current?.side&&VKe(ne,$.current?.area),[]);return w.jsx(wKe,{scope:n,searchRef:k,onItemEnter:D.useCallback(ne=>{J(ne)&&ne.preventDefault()},[J]),onItemLeave:D.useCallback(ne=>{J(ne)||(M.current?.focus(),O(null))},[J]),onTriggerLeave:D.useCallback(ne=>{J(ne)&&ne.preventDefault()},[J]),pointerGraceTimerRef:L,onPointerGraceIntentChange:D.useCallback(ne=>{$.current=ne},[]),children:w.jsx(oe,{...U,children:w.jsx(pb,{asChild:!0,trapped:i,onMountAutoFocus:Et(a,ne=>{ne.preventDefault(),M.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:w.jsx(u2,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:d,onDismiss:h,children:w.jsx(cKe,{asChild:!0,...C,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:T,onCurrentTabStopIdChange:O,onEntryFocus:Et(c,ne=>{x.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:w.jsx(x8,{role:"menu","aria-orientation":"vertical","data-state":V0e(y.open),"data-radix-menu-content":"",dir:x.dir,...S,...p,ref:I,style:{outline:"none",...p.style},onKeyDown:Et(p.onKeyDown,ne=>{const ae=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,re=ne.ctrlKey||ne.altKey||ne.metaKey,te=ne.key.length===1;ae&&(ne.key==="Tab"&&ne.preventDefault(),!re&&te&&Y(ne.key));const ye=M.current;if(ne.target!==ye||!fKe.includes(ne.key))return;ne.preventDefault();const Oe=_().filter(Te=>!Te.disabled).map(Te=>Te.ref.current);p0e.includes(ne.key)&&Oe.reverse(),PKe(Oe)}),onBlur:Et(t.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(V.current),k.current="")}),onPointerMove:Et(t.onPointerMove,Mw(ne=>{const F=ne.target,ae=G.current!==ne.clientX;if(ne.currentTarget.contains(F)&&ae){const re=ne.clientX>G.current?"right":"left";W.current=re,G.current=ne.clientX}}))})})})})})})});b0e.displayName=yu;var _Ke="MenuGroup",d$=D.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return w.jsx(Yt.div,{role:"group",...r,ref:e})});d$.displayName=_Ke;var TKe="MenuLabel",S0e=D.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return w.jsx(Yt.div,{...r,ref:e})});S0e.displayName=TKe;var A_="MenuItem",uY="menu.itemSelect",S8=D.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,a=D.useRef(null),o=Vb(A_,t.__scopeMenu),s=u$(A_,t.__scopeMenu),c=$n(e,a),l=D.useRef(!1),u=()=>{const f=a.current;if(!n&&f){const d=new CustomEvent(uY,{bubbles:!0,cancelable:!0});f.addEventListener(uY,h=>r?.(h),{once:!0}),Goe(f,d),d.defaultPrevented?l.current=!1:o.onClose()}};return w.jsx(C0e,{...i,ref:c,disabled:n,onClick:Et(t.onClick,u),onPointerDown:f=>{t.onPointerDown?.(f),l.current=!0},onPointerUp:Et(t.onPointerUp,f=>{l.current||f.currentTarget?.click()}),onKeyDown:Et(t.onKeyDown,f=>{const d=s.searchRef.current!=="";n||d&&f.key===" "||NN.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});S8.displayName=A_;var C0e=D.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=t,o=u$(A_,n),s=v0e(n),c=D.useRef(null),l=$n(e,c),[u,f]=D.useState(!1),[d,h]=D.useState("");return D.useEffect(()=>{const m=c.current;m&&h((m.textContent??"").trim())},[a.children]),w.jsx(Dw.ItemSlot,{scope:n,disabled:r,textValue:i??d,children:w.jsx(lKe,{asChild:!0,...s,focusable:!r,children:w.jsx(Yt.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:l,onPointerMove:Et(t.onPointerMove,Mw(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Et(t.onPointerLeave,Mw(m=>o.onItemLeave(m))),onFocus:Et(t.onFocus,()=>f(!0)),onBlur:Et(t.onBlur,()=>f(!1))})})})}),EKe="MenuCheckboxItem",_0e=D.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return w.jsx(M0e,{scope:t.__scopeMenu,checked:n,children:w.jsx(S8,{role:"menuitemcheckbox","aria-checked":L_(n)?"mixed":n,...i,ref:e,"data-state":g$(n),onSelect:Et(i.onSelect,()=>r?.(L_(n)?!0:!n),{checkForDefaultPrevented:!1})})})});_0e.displayName=EKe;var T0e="MenuRadioGroup",[OKe,DKe]=S1(T0e,{value:void 0,onValueChange:()=>{}}),E0e=D.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,a=es(r);return w.jsx(OKe,{scope:t.__scopeMenu,value:n,onValueChange:a,children:w.jsx(d$,{...i,ref:e})})});E0e.displayName=T0e;var O0e="MenuRadioItem",D0e=D.forwardRef((t,e)=>{const{value:n,...r}=t,i=DKe(O0e,t.__scopeMenu),a=n===i.value;return w.jsx(M0e,{scope:t.__scopeMenu,checked:a,children:w.jsx(S8,{role:"menuitemradio","aria-checked":a,...r,ref:e,"data-state":g$(a),onSelect:Et(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});D0e.displayName=O0e;var h$="MenuItemIndicator",[M0e,MKe]=S1(h$,{checked:!1}),R0e=D.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,a=MKe(h$,n);return w.jsx(Lo,{present:r||L_(a.checked)||a.checked===!0,children:w.jsx(Yt.span,{...i,ref:e,"data-state":g$(a.checked)})})});R0e.displayName=h$;var RKe="MenuSeparator",I0e=D.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return w.jsx(Yt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});I0e.displayName=RKe;var IKe="MenuArrow",N0e=D.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=b8(n);return w.jsx(w8,{...i,...r,ref:e})});N0e.displayName=IKe;var NKe="MenuSub",[qYt,P0e]=S1(NKe),p5="MenuSubTrigger",k0e=D.forwardRef((t,e)=>{const n=C1(p5,t.__scopeMenu),r=Vb(p5,t.__scopeMenu),i=P0e(p5,t.__scopeMenu),a=u$(p5,t.__scopeMenu),o=D.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:t.__scopeMenu},u=D.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return D.useEffect(()=>u,[u]),D.useEffect(()=>{const f=s.current;return()=>{window.clearTimeout(f),c(null)}},[s,c]),w.jsx(c$,{asChild:!0,...l,children:w.jsx(C0e,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":V0e(n.open),...t,ref:uh(e,i.onTriggerChange),onClick:f=>{t.onClick?.(f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Et(t.onPointerMove,Mw(f=>{a.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Et(t.onPointerLeave,Mw(f=>{u();const d=n.content?.getBoundingClientRect();if(d){const h=n.content?.dataset.side,m=h==="right",p=m?-5:5,y=d[m?"left":"right"],x=d[m?"right":"left"];a.onPointerGraceIntentChange({area:[{x:f.clientX+p,y:f.clientY},{x:y,y:d.top},{x,y:d.top},{x,y:d.bottom},{x:y,y:d.bottom}],side:h}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(f),f.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:Et(t.onKeyDown,f=>{const d=a.searchRef.current!=="";t.disabled||d&&f.key===" "||dKe[r.dir].includes(f.key)&&(n.onOpenChange(!0),n.content?.focus(),f.preventDefault())})})})});k0e.displayName=p5;var A0e="MenuSubContent",L0e=D.forwardRef((t,e)=>{const n=x0e(yu,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,a=C1(yu,t.__scopeMenu),o=Vb(yu,t.__scopeMenu),s=P0e(A0e,t.__scopeMenu),c=D.useRef(null),l=$n(e,c);return w.jsx(Dw.Provider,{scope:t.__scopeMenu,children:w.jsx(Lo,{present:r||a.open,children:w.jsx(Dw.Slot,{scope:t.__scopeMenu,children:w.jsx(f$,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{o.isUsingKeyboardRef.current&&c.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Et(t.onFocusOutside,u=>{u.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Et(t.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Et(t.onKeyDown,u=>{const f=u.currentTarget.contains(u.target),d=hKe[o.dir].includes(u.key);f&&d&&(a.onOpenChange(!1),s.trigger?.focus(),u.preventDefault())})})})})})});L0e.displayName=A0e;function V0e(t){return t?"open":"closed"}function L_(t){return t==="indeterminate"}function g$(t){return L_(t)?"indeterminate":t?"checked":"unchecked"}function PKe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function kKe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function AKe(t,e,n){const i=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let o=kKe(t,Math.max(a,0));i.length===1&&(o=o.filter(l=>l!==n));const c=o.find(l=>l.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function LKe(t,e){const{x:n,y:r}=t;let i=!1;for(let a=0,o=e.length-1;a<e.length;o=a++){const s=e[a],c=e[o],l=s.x,u=s.y,f=c.x,d=c.y;u>r!=d>r&&n<(f-l)*(r-u)/(d-u)+l&&(i=!i)}return i}function VKe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return LKe(n,e)}function Mw(t){return e=>e.pointerType==="mouse"?t(e):void 0}var $Ke=y0e,jKe=c$,UKe=w0e,FKe=b0e,BKe=d$,zKe=S0e,GKe=S8,WKe=_0e,HKe=E0e,qKe=D0e,KKe=R0e,YKe=I0e,XKe=N0e,ZKe=k0e,QKe=L0e,C8="DropdownMenu",[JKe]=Uc(C8,[m0e]),ic=m0e(),[eYe,$0e]=JKe(C8),j0e=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=t,c=ic(e),l=D.useRef(null),[u,f]=xd({prop:i,defaultProp:a??!1,onChange:o,caller:C8});return w.jsx(eYe,{scope:e,triggerId:No(),triggerRef:l,contentId:No(),open:u,onOpenChange:f,onOpenToggle:D.useCallback(()=>f(d=>!d),[f]),modal:s,children:w.jsx($Ke,{...c,open:u,onOpenChange:f,dir:r,modal:s,children:n})})};j0e.displayName=C8;var U0e="DropdownMenuTrigger",F0e=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,a=$0e(U0e,n),o=ic(n);return w.jsx(jKe,{asChild:!0,...o,children:w.jsx(Yt.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:uh(e,a.triggerRef),onPointerDown:Et(t.onPointerDown,s=>{!r&&s.button===0&&s.ctrlKey===!1&&(a.onOpenToggle(),a.open||s.preventDefault())}),onKeyDown:Et(t.onKeyDown,s=>{r||(["Enter"," "].includes(s.key)&&a.onOpenToggle(),s.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});F0e.displayName=U0e;var tYe="DropdownMenuPortal",B0e=t=>{const{__scopeDropdownMenu:e,...n}=t,r=ic(e);return w.jsx(UKe,{...r,...n})};B0e.displayName=tYe;var z0e="DropdownMenuContent",G0e=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=$0e(z0e,n),a=ic(n),o=D.useRef(!1);return w.jsx(FKe,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:e,onCloseAutoFocus:Et(t.onCloseAutoFocus,s=>{o.current||i.triggerRef.current?.focus(),o.current=!1,s.preventDefault()}),onInteractOutside:Et(t.onInteractOutside,s=>{const c=s.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;(!i.modal||u)&&(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)"}})});G0e.displayName=z0e;var nYe="DropdownMenuGroup",rYe=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ic(n);return w.jsx(BKe,{...i,...r,ref:e})});rYe.displayName=nYe;var iYe="DropdownMenuLabel",aYe=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ic(n);return w.jsx(zKe,{...i,...r,ref:e})});aYe.displayName=iYe;var oYe="DropdownMenuItem",W0e=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ic(n);return w.jsx(GKe,{...i,...r,ref:e})});W0e.displayName=oYe;var sYe="DropdownMenuCheckboxItem",cYe=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ic(n);return w.jsx(WKe,{...i,...r,ref:e})});cYe.displayName=sYe;var lYe="DropdownMenuRadioGroup",uYe=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ic(n);return w.jsx(HKe,{...i,...r,ref:e})});uYe.displayName=lYe;var fYe="DropdownMenuRadioItem",dYe=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ic(n);return w.jsx(qKe,{...i,...r,ref:e})});dYe.displayName=fYe;var hYe="DropdownMenuItemIndicator",gYe=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ic(n);return w.jsx(KKe,{...i,...r,ref:e})});gYe.displayName=hYe;var pYe="DropdownMenuSeparator",H0e=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ic(n);return w.jsx(YKe,{...i,...r,ref:e})});H0e.displayName=pYe;var mYe="DropdownMenuArrow",vYe=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ic(n);return w.jsx(XKe,{...i,...r,ref:e})});vYe.displayName=mYe;var yYe="DropdownMenuSubTrigger",xYe=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ic(n);return w.jsx(ZKe,{...i,...r,ref:e})});xYe.displayName=yYe;var wYe="DropdownMenuSubContent",bYe=D.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ic(n);return w.jsx(QKe,{...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)"}})});bYe.displayName=wYe;var SYe=j0e,CYe=F0e,_Ye=B0e,TYe=G0e,EYe=W0e,OYe=H0e;function _8({...t}){return w.jsx(SYe,{"data-slot":"dropdown-menu",...t})}function T8({...t}){return w.jsx(CYe,{"data-slot":"dropdown-menu-trigger",...t})}function E8({className:t,sideOffset:e=4,...n}){return w.jsx(_Ye,{children:w.jsx(TYe,{"data-slot":"dropdown-menu-content",sideOffset:e,className:rt("bg-popover text-popover-foreground 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 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...n})})}function Qu({className:t,inset:e,variant:n="default",...r}){return w.jsx(EYe,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:rt("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r})}function PN({className:t,...e}){return w.jsx(OYe,{"data-slot":"dropdown-menu-separator",className:rt("bg-border -mx-1 my-1 h-px",t),...e})}function q0e(){const{setTheme:t}=Xk();return w.jsxs(_8,{children:[w.jsx(T8,{asChild:!0,children:w.jsxs(bt,{variant:"outline",size:"icon",children:[w.jsx(cL,{className:"h-[1.2rem] w-[1.2rem] scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90"}),w.jsx(Nse,{className:"absolute h-[1.2rem] w-[1.2rem] scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0"}),w.jsx("span",{className:"sr-only",children:"Переключатель темы"})]})}),w.jsxs(E8,{align:"end",children:[w.jsx(Qu,{onClick:()=>t("light"),children:"Светлая"}),w.jsx(Qu,{onClick:()=>t("dark"),children:"Темная"}),w.jsx(Qu,{onClick:()=>t("system"),children:"Системная"})]})]})}function K0e(){const{i18n:t}=Hn("common"),e=[{value:"ru",label:"Русский"},{value:"en",label:"English"},{value:"vi",label:"Tiếng Việt"}];return w.jsxs(_8,{children:[w.jsx(T8,{asChild:!0,children:w.jsx(bt,{variant:"outline",size:"icon",children:w.jsx(Rse,{className:"h-[1.2rem] w-[1.2rem]"})})}),w.jsx(E8,{align:"end",children:e.map(n=>w.jsx(Qu,{onClick:()=>t.changeLanguage(n.value),className:t.language===n.value?"bg-accent":"",children:n.label},n.value))})]})}const DYe=()=>w.jsxs("div",{className:Vq.wrapper,children:[w.jsxs("div",{className:Vq.actions,children:[w.jsx(q0e,{}),w.jsx(K0e,{})]}),w.jsx(cAe,{width:270}),w.jsx(NHe,{})]}),MYe="_page_pwfy7_1",RYe="_errorContainer_pwfy7_10",IYe="_header_pwfy7_17",NYe="_title_pwfy7_24",PYe="_description_pwfy7_31",kYe="_header__actions_pwfy7_37",AYe="_select_pwfy7_42",LYe="_icon_pwfy7_47",VYe="_kpis_pwfy7_52",$Ye="_kpiCard_pwfy7_68",jYe="_kpiHeader_pwfy7_88",UYe="_kpiIcon_pwfy7_94",FYe="_kpiTitle_pwfy7_121",BYe="_kpiDesc_pwfy7_126",zYe="_kpiValue_pwfy7_131",GYe="_valueWrapper_pwfy7_139",WYe="_storageSubtext_pwfy7_148",HYe="_separator_pwfy7_168",qYe="_charts_pwfy7_182",KYe="_chartCard_pwfy7_193",YYe="_chartCard__full_pwfy7_204",XYe="_chartHeader_pwfy7_208",ZYe="_chartHeader__title_pwfy7_213",QYe="_legend_pwfy7_221",JYe="_chartBody_pwfy7_225",eXe="_chartContainer_pwfy7_229",tXe="_chartMetric_pwfy7_243",nXe="_metricIcon_pwfy7_253",rXe="_metricContent_pwfy7_265",iXe="_metricLabel_pwfy7_271",aXe="_metricValue_pwfy7_279",oXe="_metricNumber_pwfy7_285",sXe="_storageWrap_pwfy7_292",cXe="_storageInner_pwfy7_300",nn={page:MYe,errorContainer:RYe,header:IYe,title:NYe,description:PYe,header__actions:kYe,select:AYe,icon:LYe,kpis:VYe,kpiCard:$Ye,kpiHeader:jYe,kpiIcon:UYe,kpiTitle:FYe,kpiDesc:BYe,kpiValue:zYe,valueWrapper:GYe,storageSubtext:WYe,separator:HYe,charts:qYe,chartCard:KYe,chartCard__full:YYe,chartHeader:XYe,chartHeader__title:ZYe,legend:QYe,chartBody:JYe,chartContainer:eXe,chartMetric:tXe,metricIcon:nXe,metricContent:rXe,metricLabel:iXe,metricValue:aXe,metricNumber:oXe,storageWrap:sXe,storageInner:cXe};var lXe=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function p$(t){if(typeof t!="string")return!1;var e=lXe;return e.includes(t)}var uXe=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"];function Y0e(t){if(typeof t!="string")return!1;var e=uXe;return e.includes(t)}function X0e(t){return typeof t=="string"&&t.startsWith("data-")}function bu(t){var e=Object.entries(t).filter(n=>{var[r]=n;return Y0e(r)||X0e(r)});return Object.fromEntries(e)}function $b(t){if(t==null)return null;if(D.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return bu(e)}return typeof t=="object"&&!Array.isArray(t)?bu(t):null}function Lc(t){var e=Object.entries(t).filter(n=>{var[r]=n;return Y0e(r)||X0e(r)||p$(r)});return Object.fromEntries(e)}function fXe(t){return t==null?null:D.isValidElement(t)?Lc(t.props):typeof t=="object"&&!Array.isArray(t)?Lc(t):null}var dXe=["children","width","height","viewBox","className","style","title","desc"];function kN(){return kN=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},kN.apply(null,arguments)}function hXe(t,e){if(t==null)return{};var n,r,i=gXe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function gXe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var m$=D.forwardRef((t,e)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:c,desc:l}=t,u=hXe(t,dXe),f=a||{width:r,height:i,x:0,y:0},d=$r("recharts-surface",o);return D.createElement("svg",kN({},Lc(u),{className:d,width:r,height:i,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:e}),D.createElement("title",null,c),D.createElement("desc",null,l),n)}),pXe=["children","className"];function AN(){return AN=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},AN.apply(null,arguments)}function mXe(t,e){if(t==null)return{};var n,r,i=vXe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function vXe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Vc=D.forwardRef((t,e)=>{var{children:n,className:r}=t,i=mXe(t,pXe),a=$r("recharts-layer",r);return D.createElement("g",AN({className:a},Lc(i),{ref:e}),n)}),Z0e=D.createContext(null),yXe=()=>D.useContext(Z0e);function gi(t){return function(){return t}}const Q0e=Math.cos,V_=Math.sin,Tf=Math.sqrt,$_=Math.PI,O8=2*$_,LN=Math.PI,VN=2*LN,em=1e-6,xXe=VN-em;function J0e(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function wXe(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return J0e;const n=10**e;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class bXe{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?J0e:wXe(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,i){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(e,n,r,i,a,o){this._append`C${+e},${+n},${+r},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(e,n,r,i,a){if(e=+e,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,s=this._y1,c=r-e,l=i-n,u=o-e,f=s-n,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(d>em)if(!(Math.abs(f*c-l*u)>em)||!a)this._append`L${this._x1=e},${this._y1=n}`;else{let h=r-o,m=i-s,p=c*c+l*l,y=h*h+m*m,x=Math.sqrt(p),S=Math.sqrt(d),C=a*Math.tan((LN-Math.acos((p+d-y)/(2*x*S)))/2),_=C/S,T=C/x;Math.abs(_-1)>em&&this._append`L${e+_*u},${n+_*f}`,this._append`A${a},${a},0,0,${+(f*h>u*m)},${this._x1=e+T*c},${this._y1=n+T*l}`}}arc(e,n,r,i,a,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let s=r*Math.cos(i),c=r*Math.sin(i),l=e+s,u=n+c,f=1^o,d=o?i-a:a-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>em||Math.abs(this._y1-u)>em)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%VN+VN),d>xXe?this._append`A${r},${r},0,1,${f},${e-s},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:d>em&&this._append`A${r},${r},0,${+(d>=LN)},${f},${this._x1=e+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function v$(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new bXe(e)}function y$(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function ehe(t){this._context=t}ehe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function D8(t){return new ehe(t)}function the(t){return t[0]}function nhe(t){return t[1]}function rhe(t,e){var n=gi(!0),r=null,i=D8,a=null,o=v$(s);t=typeof t=="function"?t:t===void 0?the:gi(t),e=typeof e=="function"?e:e===void 0?nhe:gi(e);function s(c){var l,u=(c=y$(c)).length,f,d=!1,h;for(r==null&&(a=i(h=o())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+t(f,l,c),+e(f,l,c));if(h)return a=null,h+""||null}return s.x=function(c){return arguments.length?(t=typeof c=="function"?c:gi(+c),s):t},s.y=function(c){return arguments.length?(e=typeof c=="function"?c:gi(+c),s):e},s.defined=function(c){return arguments.length?(n=typeof c=="function"?c:gi(!!c),s):n},s.curve=function(c){return arguments.length?(i=c,r!=null&&(a=i(r)),s):i},s.context=function(c){return arguments.length?(c==null?r=a=null:a=i(r=c),s):r},s}function Q4(t,e,n){var r=null,i=gi(!0),a=null,o=D8,s=null,c=v$(l);t=typeof t=="function"?t:t===void 0?the:gi(+t),e=typeof e=="function"?e:gi(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?nhe:gi(+n);function l(f){var d,h,m,p=(f=y$(f)).length,y,x=!1,S,C=new Array(p),_=new Array(p);for(a==null&&(s=o(S=c())),d=0;d<=p;++d){if(!(d<p&&i(y=f[d],d,f))===x)if(x=!x)h=d,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),m=d-1;m>=h;--m)s.point(C[m],_[m]);s.lineEnd(),s.areaEnd()}x&&(C[d]=+t(y,d,f),_[d]=+e(y,d,f),s.point(r?+r(y,d,f):C[d],n?+n(y,d,f):_[d]))}if(S)return s=null,S+""||null}function u(){return rhe().defined(i).curve(o).context(a)}return l.x=function(f){return arguments.length?(t=typeof f=="function"?f:gi(+f),r=null,l):t},l.x0=function(f){return arguments.length?(t=typeof f=="function"?f:gi(+f),l):t},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:gi(+f),l):r},l.y=function(f){return arguments.length?(e=typeof f=="function"?f:gi(+f),n=null,l):e},l.y0=function(f){return arguments.length?(e=typeof f=="function"?f:gi(+f),l):e},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:gi(+f),l):n},l.lineX0=l.lineY0=function(){return u().x(t).y(e)},l.lineY1=function(){return u().x(t).y(n)},l.lineX1=function(){return u().x(r).y(e)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:gi(!!f),l):i},l.curve=function(f){return arguments.length?(o=f,a!=null&&(s=o(a)),l):o},l.context=function(f){return arguments.length?(f==null?a=s=null:s=o(a=f),l):a},l}class ihe{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function SXe(t){return new ihe(t,!0)}function CXe(t){return new ihe(t,!1)}const x$={draw(t,e){const n=Tf(e/$_);t.moveTo(n,0),t.arc(0,0,n,0,O8)}},_Xe={draw(t,e){const n=Tf(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},ahe=Tf(1/3),TXe=ahe*2,EXe={draw(t,e){const n=Tf(e/TXe),r=n*ahe;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},OXe={draw(t,e){const n=Tf(e),r=-n/2;t.rect(r,r,n,n)}},DXe=.8908130915292852,ohe=V_($_/10)/V_(7*$_/10),MXe=V_(O8/10)*ohe,RXe=-Q0e(O8/10)*ohe,IXe={draw(t,e){const n=Tf(e*DXe),r=MXe*n,i=RXe*n;t.moveTo(0,-n),t.lineTo(r,i);for(let a=1;a<5;++a){const o=O8*a/5,s=Q0e(o),c=V_(o);t.lineTo(c*n,-s*n),t.lineTo(s*r-c*i,c*r+s*i)}t.closePath()}},bD=Tf(3),NXe={draw(t,e){const n=-Tf(e/(bD*3));t.moveTo(0,n*2),t.lineTo(-bD*n,-n),t.lineTo(bD*n,-n),t.closePath()}},Jl=-.5,eu=Tf(3)/2,$N=1/Tf(12),PXe=($N/2+1)*3,kXe={draw(t,e){const n=Tf(e/PXe),r=n/2,i=n*$N,a=r,o=n*$N+n,s=-a,c=o;t.moveTo(r,i),t.lineTo(a,o),t.lineTo(s,c),t.lineTo(Jl*r-eu*i,eu*r+Jl*i),t.lineTo(Jl*a-eu*o,eu*a+Jl*o),t.lineTo(Jl*s-eu*c,eu*s+Jl*c),t.lineTo(Jl*r+eu*i,Jl*i-eu*r),t.lineTo(Jl*a+eu*o,Jl*o-eu*a),t.lineTo(Jl*s+eu*c,Jl*c-eu*s),t.closePath()}};function AXe(t,e){let n=null,r=v$(i);t=typeof t=="function"?t:gi(t||x$),e=typeof e=="function"?e:gi(e===void 0?64:+e);function i(){let a;if(n||(n=a=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(t=typeof a=="function"?a:gi(a),i):t},i.size=function(a){return arguments.length?(e=typeof a=="function"?a:gi(+a),i):e},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function j_(){}function U_(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function she(t){this._context=t}she.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:U_(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:U_(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function LXe(t){return new she(t)}function che(t){this._context=t}che.prototype={areaStart:j_,areaEnd:j_,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:U_(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function VXe(t){return new che(t)}function lhe(t){this._context=t}lhe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:U_(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function $Xe(t){return new lhe(t)}function uhe(t){this._context=t}uhe.prototype={areaStart:j_,areaEnd:j_,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function jXe(t){return new uhe(t)}function fY(t){return t<0?-1:1}function dY(t,e,n){var r=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(fY(a)+fY(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function hY(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function SD(t,e,n){var r=t._x0,i=t._y0,a=t._x1,o=t._y1,s=(a-r)/3;t._context.bezierCurveTo(r+s,i+s*e,a-s,o-s*n,a,o)}function F_(t){this._context=t}F_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:SD(this,this._t0,hY(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,SD(this,hY(this,n=dY(this,t,e)),n);break;default:SD(this,this._t0,n=dY(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function fhe(t){this._context=new dhe(t)}(fhe.prototype=Object.create(F_.prototype)).point=function(t,e){F_.prototype.point.call(this,e,t)};function dhe(t){this._context=t}dhe.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,a){this._context.bezierCurveTo(e,t,r,n,a,i)}};function UXe(t){return new F_(t)}function FXe(t){return new fhe(t)}function hhe(t){this._context=t}hhe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=gY(t),i=gY(e),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],t[o],e[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function gY(t){var e,n=t.length-1,r,i=new Array(n),a=new Array(n),o=new Array(n);for(i[0]=0,a[0]=2,o[0]=t[0]+2*t[1],e=1;e<n-1;++e)i[e]=1,a[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=i[e]/a[e-1],a[e]-=r,o[e]-=r*o[e-1];for(i[n-1]=o[n-1]/a[n-1],e=n-2;e>=0;--e)i[e]=(o[e]-i[e+1])/a[e];for(a[n-1]=(t[n]+i[n-1])/2,e=0;e<n-1;++e)a[e]=2*t[e+1]-i[e+1];return[i,a]}function BXe(t){return new hhe(t)}function M8(t,e){this._context=t,this._t=e}M8.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function zXe(t){return new M8(t,.5)}function GXe(t){return new M8(t,0)}function WXe(t){return new M8(t,1)}function Ry(t,e){if((o=t.length)>1)for(var n=1,r,i,a=t[e[0]],o,s=a.length;n<o;++n)for(i=a,a=t[e[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function jN(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function HXe(t,e){return t[e]}function qXe(t){const e=[];return e.key=t,e}function KXe(){var t=gi([]),e=jN,n=Ry,r=HXe;function i(a){var o=Array.from(t.apply(this,arguments),qXe),s,c=o.length,l=-1,u;for(const f of a)for(s=0,++l;s<c;++s)(o[s][l]=[0,+r(f,o[s].key,l,a)]).data=f;for(s=0,u=y$(e(o));s<c;++s)o[u[s]].index=s;return n(o,u),o}return i.keys=function(a){return arguments.length?(t=typeof a=="function"?a:gi(Array.from(a)),i):t},i.value=function(a){return arguments.length?(r=typeof a=="function"?a:gi(+a),i):r},i.order=function(a){return arguments.length?(e=a==null?jN:typeof a=="function"?a:gi(Array.from(a)),i):e},i.offset=function(a){return arguments.length?(n=a??Ry,i):n},i}function YXe(t,e){if((r=t.length)>0){for(var n,r,i=0,a=t[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=t[n][i][1]||0;if(o)for(n=0;n<r;++n)t[n][i][1]/=o}Ry(t,e)}}function XXe(t,e){if((i=t.length)>0){for(var n=0,r=t[e[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=t[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}Ry(t,e)}}function ZXe(t,e){if(!(!((o=t.length)>0)||!((a=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=t[e[s]],f=u[r][1]||0,d=u[r-1][1]||0,h=(f-d)/2,m=0;m<s;++m){var p=t[e[m]],y=p[r][1]||0,x=p[r-1][1]||0;h+=y-x}c+=f,l+=h*f}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,Ry(t,e)}}var CD={},_D={},pY;function QXe(){return pY||(pY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n==="__proto__"}t.isUnsafeProperty=e})(_D)),_D}var TD={},mY;function ghe(){return mY||(mY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){switch(typeof n){case"number":case"symbol":return!1;case"string":return n.includes(".")||n.includes("[")||n.includes("]")}}t.isDeepKey=e})(TD)),TD}var ED={},vY;function w$(){return vY||(vY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="string"||typeof n=="symbol"?n:Object.is(n?.valueOf?.(),-0)?"-0":String(n)}t.toKey=e})(ED)),ED}var OD={},DD={},yY;function JXe(){return yY||(yY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){if(n==null)return"";if(typeof n=="string")return n;if(Array.isArray(n))return n.map(e).join(",");const r=String(n);return r==="0"&&Object.is(Number(n),-0)?"-0":r}t.toString=e})(DD)),DD}var xY;function b$(){return xY||(xY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=JXe(),n=w$();function r(i){if(Array.isArray(i))return i.map(n.toKey);if(typeof i=="symbol")return[i];i=e.toString(i);const a=[],o=i.length;if(o===0)return a;let s=0,c="",l="",u=!1;for(i.charCodeAt(0)===46&&(a.push(""),s++);s<o;){const f=i[s];l?f==="\\"&&s+1<o?(s++,c+=i[s]):f===l?l="":c+=f:u?f==='"'||f==="'"?l=f:f==="]"?(u=!1,a.push(c),c=""):c+=f:f==="["?(u=!0,c&&(a.push(c),c="")):f==="."?c&&(a.push(c),c=""):c+=f,s++}return c&&a.push(c),a}t.toPath=r})(OD)),OD}var wY;function S$(){return wY||(wY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=QXe(),n=ghe(),r=w$(),i=b$();function a(s,c,l){if(s==null)return l;switch(typeof c){case"string":{if(e.isUnsafeProperty(c))return l;const u=s[c];return u===void 0?n.isDeepKey(c)?a(s,i.toPath(c),l):l:u}case"number":case"symbol":{typeof c=="number"&&(c=r.toKey(c));const u=s[c];return u===void 0?l:u}default:{if(Array.isArray(c))return o(s,c,l);if(Object.is(c?.valueOf(),-0)?c="-0":c=String(c),e.isUnsafeProperty(c))return l;const u=s[c];return u===void 0?l:u}}}function o(s,c,l){if(c.length===0)return l;let u=s;for(let f=0;f<c.length;f++){if(u==null||e.isUnsafeProperty(c[f]))return l;u=u[c[f]]}return u===void 0?l:u}t.get=a})(CD)),CD}var MD,bY;function eZe(){return bY||(bY=1,MD=S$().get),MD}var tZe=eZe();const Iy=ka(tZe);var Rc=t=>t===0?0:t>0?1:-1,El=t=>typeof t=="number"&&t!=+t,hh=t=>typeof t=="string"&&t.indexOf("%")===t.length-1,qt=t=>(typeof t=="number"||t instanceof Number)&&!El(t),bd=t=>qt(t)||typeof t=="string",nZe=0,Rw=t=>{var e=++nZe;return"".concat(t||"").concat(e)},pf=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!qt(e)&&typeof e!="string")return r;var a;if(hh(e)){if(n==null)return r;var o=e.indexOf("%");a=n*parseFloat(e.slice(0,o))/100}else a=+e;return El(a)&&(a=r),i&&n!=null&&a>n&&(a=n),a},phe=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;r<e;r++)if(!n[t[r]])n[t[r]]=!0;else return!0;return!1};function Ia(t,e,n){return qt(t)&&qt(e)?t+n*(e-t):e}function mhe(t,e,n){if(!(!t||!t.length))return t.find(r=>r&&(typeof e=="function"?e(r):Iy(r,e))===n)}var ta=t=>t===null||typeof t>"u",jb=t=>ta(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1)),rZe=["type","size","sizeType"];function UN(){return UN=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},UN.apply(null,arguments)}function SY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function CY(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?SY(Object(n),!0).forEach(function(r){iZe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):SY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iZe(t,e,n){return(e=aZe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aZe(t){var e=oZe(t,"string");return typeof e=="symbol"?e:e+""}function oZe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sZe(t,e){if(t==null)return{};var n,r,i=cZe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function cZe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var vhe={symbolCircle:x$,symbolCross:_Xe,symbolDiamond:EXe,symbolSquare:OXe,symbolStar:IXe,symbolTriangle:NXe,symbolWye:kXe},lZe=Math.PI/180,uZe=t=>{var e="symbol".concat(jb(t));return vhe[e]||x$},fZe=(t,e,n)=>{if(e==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var r=18*lZe;return 1.25*t*t*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},dZe=(t,e)=>{vhe["symbol".concat(jb(t))]=e},C$=t=>{var{type:e="circle",size:n=64,sizeType:r="area"}=t,i=sZe(t,rZe),a=CY(CY({},i),{},{type:e,size:n,sizeType:r}),o="circle";typeof e=="string"&&(o=e);var s=()=>{var d=uZe(o),h=AXe().type(d).size(fZe(n,r,o)),m=h();if(m!==null)return m},{className:c,cx:l,cy:u}=a,f=Lc(a);return l===+l&&u===+u&&n===+n?D.createElement("path",UN({},f,{className:$r("recharts-symbols",c),transform:"translate(".concat(l,", ").concat(u,")"),d:s()})):null};C$.registerSymbol=dZe;var _$=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(D.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{p$(i)&&(r[i]=(a=>n[i](n,a)))}),r},hZe=(t,e,n)=>r=>(t(e,n,r),null),R8=(t,e,n)=>{if(t===null||typeof t!="object"&&typeof t!="function")return null;var r=null;return Object.keys(t).forEach(i=>{var a=t[i];p$(i)&&typeof a=="function"&&(r||(r={}),r[i]=hZe(a,e,n))}),r};function FN(){return FN=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},FN.apply(null,arguments)}function _Y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gZe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_Y(Object(n),!0).forEach(function(r){T$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_Y(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function T$(t,e,n){return(e=pZe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pZe(t){var e=mZe(t,"string");return typeof e=="symbol"?e:e+""}function mZe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var tu=32;class E$ extends D.PureComponent{renderIcon(e,n){var{inactiveColor:r}=this.props,i=tu/2,a=tu/6,o=tu/3,s=e.inactive?r:e.color,c=n??e.type;if(c==="none")return null;if(c==="plainline")return D.createElement("line",{strokeWidth:4,fill:"none",stroke:s,strokeDasharray:e.payload.strokeDasharray,x1:0,y1:i,x2:tu,y2:i,className:"recharts-legend-icon"});if(c==="line")return D.createElement("path",{strokeWidth:4,fill:"none",stroke:s,d:"M0,".concat(i,"h").concat(o,`
            A`).concat(a,",").concat(a,",0,1,1,").concat(2*o,",").concat(i,`
            H`).concat(tu,"M").concat(2*o,",").concat(i,`
            A`).concat(a,",").concat(a,",0,1,1,").concat(o,",").concat(i),className:"recharts-legend-icon"});if(c==="rect")return D.createElement("path",{stroke:"none",fill:s,d:"M0,".concat(tu/8,"h").concat(tu,"v").concat(tu*3/4,"h").concat(-tu,"z"),className:"recharts-legend-icon"});if(D.isValidElement(e.legendIcon)){var l=gZe({},e);return delete l.legendIcon,D.cloneElement(e.legendIcon,l)}return D.createElement(C$,{fill:s,cx:i,cy:i,size:tu,sizeType:"diameter",type:c})}renderItems(){var{payload:e,iconSize:n,layout:r,formatter:i,inactiveColor:a,iconType:o}=this.props,s={x:0,y:0,width:tu,height:tu},c={display:r==="horizontal"?"inline-block":"block",marginRight:10},l={display:"inline-block",verticalAlign:"middle",marginRight:4};return e.map((u,f)=>{var d=u.formatter||i,h=$r({"recharts-legend-item":!0,["legend-item-".concat(f)]:!0,inactive:u.inactive});if(u.type==="none")return null;var m=u.inactive?a:u.color,p=d?d(u.value,u,f):u.value;return D.createElement("li",FN({className:h,style:c,key:"legend-item-".concat(f)},R8(this.props,u,f)),D.createElement(m$,{width:n,height:n,viewBox:s,style:l,"aria-label":"".concat(p," legend icon")},this.renderIcon(u,o)),D.createElement("span",{className:"recharts-legend-item-text",style:{color:m}},p))})}render(){var{payload:e,layout:n,align:r}=this.props;if(!e||!e.length)return null;var i={padding:0,margin:0,textAlign:n==="horizontal"?r:"left"};return D.createElement("ul",{className:"recharts-default-legend",style:i},this.renderItems())}}T$(E$,"displayName","Legend");T$(E$,"defaultProps",{align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle"});var RD={},ID={},TY;function vZe(){return TY||(TY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r){const i=new Map;for(let a=0;a<n.length;a++){const o=n[a],s=r(o);i.has(s)||i.set(s,o)}return Array.from(i.values())}t.uniqBy=e})(ID)),ID}var ND={},EY;function yhe(){return EY||(EY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n}t.identity=e})(ND)),ND}var PD={},kD={},AD={},OY;function yZe(){return OY||(OY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Number.isSafeInteger(n)&&n>=0}t.isLength=e})(AD)),AD}var DY;function O$(){return DY||(DY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=yZe();function n(r){return r!=null&&typeof r!="function"&&e.isLength(r.length)}t.isArrayLike=n})(kD)),kD}var LD={},MY;function xZe(){return MY||(MY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="object"&&n!==null}t.isObjectLike=e})(LD)),LD}var RY;function wZe(){return RY||(RY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=O$(),n=xZe();function r(i){return n.isObjectLike(i)&&e.isArrayLike(i)}t.isArrayLikeObject=r})(PD)),PD}var VD={},$D={},IY;function bZe(){return IY||(IY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=S$();function n(r){return function(i){return e.get(i,r)}}t.property=n})($D)),$D}var jD={},UD={},FD={},BD={},NY;function xhe(){return NY||(NY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n!==null&&(typeof n=="object"||typeof n=="function")}t.isObject=e})(BD)),BD}var zD={},PY;function whe(){return PY||(PY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n==null||typeof n!="object"&&typeof n!="function"}t.isPrimitive=e})(zD)),zD}var GD={},kY;function bhe(){return kY||(kY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}t.eq=e})(GD)),GD}var AY;function SZe(){return AY||(AY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=D$(),n=xhe(),r=whe(),i=bhe();function a(f,d,h){return typeof h!="function"?e.isMatch(f,d):o(f,d,function m(p,y,x,S,C,_){const T=h(p,y,x,S,C,_);return T!==void 0?!!T:o(p,y,m,_)},new Map)}function o(f,d,h,m){if(d===f)return!0;switch(typeof d){case"object":return s(f,d,h,m);case"function":return Object.keys(d).length>0?o(f,{...d},h,m):i.eq(f,d);default:return n.isObject(f)?typeof d=="string"?d==="":!0:i.eq(f,d)}}function s(f,d,h,m){if(d==null)return!0;if(Array.isArray(d))return l(f,d,h,m);if(d instanceof Map)return c(f,d,h,m);if(d instanceof Set)return u(f,d,h,m);const p=Object.keys(d);if(f==null)return p.length===0;if(p.length===0)return!0;if(m&&m.has(d))return m.get(d)===f;m&&m.set(d,f);try{for(let y=0;y<p.length;y++){const x=p[y];if(!r.isPrimitive(f)&&!(x in f)||d[x]===void 0&&f[x]!==void 0||d[x]===null&&f[x]!==null||!h(f[x],d[x],x,f,d,m))return!1}return!0}finally{m&&m.delete(d)}}function c(f,d,h,m){if(d.size===0)return!0;if(!(f instanceof Map))return!1;for(const[p,y]of d.entries()){const x=f.get(p);if(h(x,y,p,f,d,m)===!1)return!1}return!0}function l(f,d,h,m){if(d.length===0)return!0;if(!Array.isArray(f))return!1;const p=new Set;for(let y=0;y<d.length;y++){const x=d[y];let S=!1;for(let C=0;C<f.length;C++){if(p.has(C))continue;const _=f[C];let T=!1;if(h(_,x,y,f,d,m)&&(T=!0),T){p.add(C),S=!0;break}}if(!S)return!1}return!0}function u(f,d,h,m){return d.size===0?!0:f instanceof Set?l([...f],[...d],h,m):!1}t.isMatchWith=a,t.isSetMatch=u})(FD)),FD}var LY;function D$(){return LY||(LY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=SZe();function n(r,i){return e.isMatchWith(r,i,()=>{})}t.isMatch=n})(UD)),UD}var WD={},HD={},qD={},VY;function CZe(){return VY||(VY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}t.getSymbols=e})(qD)),qD}var KD={},$Y;function She(){return $Y||($Y=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}t.getTag=e})(KD)),KD}var YD={},jY;function Che(){return jY||(jY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",s="[object Date]",c="[object Map]",l="[object Set]",u="[object Array]",f="[object Function]",d="[object ArrayBuffer]",h="[object Object]",m="[object Error]",p="[object DataView]",y="[object Uint8Array]",x="[object Uint8ClampedArray]",S="[object Uint16Array]",C="[object Uint32Array]",_="[object BigUint64Array]",T="[object Int8Array]",O="[object Int16Array]",M="[object Int32Array]",I="[object BigInt64Array]",V="[object Float32Array]",k="[object Float64Array]";t.argumentsTag=a,t.arrayBufferTag=d,t.arrayTag=u,t.bigInt64ArrayTag=I,t.bigUint64ArrayTag=_,t.booleanTag=i,t.dataViewTag=p,t.dateTag=s,t.errorTag=m,t.float32ArrayTag=V,t.float64ArrayTag=k,t.functionTag=f,t.int16ArrayTag=O,t.int32ArrayTag=M,t.int8ArrayTag=T,t.mapTag=c,t.numberTag=r,t.objectTag=h,t.regexpTag=e,t.setTag=l,t.stringTag=n,t.symbolTag=o,t.uint16ArrayTag=S,t.uint32ArrayTag=C,t.uint8ArrayTag=y,t.uint8ClampedArrayTag=x})(YD)),YD}var XD={},UY;function _Ze(){return UY||(UY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}t.isTypedArray=e})(XD)),XD}var FY;function _he(){return FY||(FY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=CZe(),n=She(),r=Che(),i=whe(),a=_Ze();function o(u,f){return s(u,void 0,u,new Map,f)}function s(u,f,d,h=new Map,m=void 0){const p=m?.(u,f,d,h);if(p!==void 0)return p;if(i.isPrimitive(u))return u;if(h.has(u))return h.get(u);if(Array.isArray(u)){const y=new Array(u.length);h.set(u,y);for(let x=0;x<u.length;x++)y[x]=s(u[x],x,d,h,m);return Object.hasOwn(u,"index")&&(y.index=u.index),Object.hasOwn(u,"input")&&(y.input=u.input),y}if(u instanceof Date)return new Date(u.getTime());if(u instanceof RegExp){const y=new RegExp(u.source,u.flags);return y.lastIndex=u.lastIndex,y}if(u instanceof Map){const y=new Map;h.set(u,y);for(const[x,S]of u)y.set(x,s(S,x,d,h,m));return y}if(u instanceof Set){const y=new Set;h.set(u,y);for(const x of u)y.add(s(x,void 0,d,h,m));return y}if(typeof Buffer<"u"&&Buffer.isBuffer(u))return u.subarray();if(a.isTypedArray(u)){const y=new(Object.getPrototypeOf(u)).constructor(u.length);h.set(u,y);for(let x=0;x<u.length;x++)y[x]=s(u[x],x,d,h,m);return y}if(u instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&u instanceof SharedArrayBuffer)return u.slice(0);if(u instanceof DataView){const y=new DataView(u.buffer.slice(0),u.byteOffset,u.byteLength);return h.set(u,y),c(y,u,d,h,m),y}if(typeof File<"u"&&u instanceof File){const y=new File([u],u.name,{type:u.type});return h.set(u,y),c(y,u,d,h,m),y}if(typeof Blob<"u"&&u instanceof Blob){const y=new Blob([u],{type:u.type});return h.set(u,y),c(y,u,d,h,m),y}if(u instanceof Error){const y=new u.constructor;return h.set(u,y),y.message=u.message,y.name=u.name,y.stack=u.stack,y.cause=u.cause,c(y,u,d,h,m),y}if(u instanceof Boolean){const y=new Boolean(u.valueOf());return h.set(u,y),c(y,u,d,h,m),y}if(u instanceof Number){const y=new Number(u.valueOf());return h.set(u,y),c(y,u,d,h,m),y}if(u instanceof String){const y=new String(u.valueOf());return h.set(u,y),c(y,u,d,h,m),y}if(typeof u=="object"&&l(u)){const y=Object.create(Object.getPrototypeOf(u));return h.set(u,y),c(y,u,d,h,m),y}return u}function c(u,f,d=u,h,m){const p=[...Object.keys(f),...e.getSymbols(f)];for(let y=0;y<p.length;y++){const x=p[y],S=Object.getOwnPropertyDescriptor(u,x);(S==null||S.writable)&&(u[x]=s(f[x],x,d,h,m))}}function l(u){switch(n.getTag(u)){case r.argumentsTag:case r.arrayTag:case r.arrayBufferTag:case r.dataViewTag:case r.booleanTag:case r.dateTag:case r.float32ArrayTag:case r.float64ArrayTag:case r.int8ArrayTag:case r.int16ArrayTag:case r.int32ArrayTag:case r.mapTag:case r.numberTag:case r.objectTag:case r.regexpTag:case r.setTag:case r.stringTag:case r.symbolTag:case r.uint8ArrayTag:case r.uint8ClampedArrayTag:case r.uint16ArrayTag:case r.uint32ArrayTag:return!0;default:return!1}}t.cloneDeepWith=o,t.cloneDeepWithImpl=s,t.copyProperties=c})(HD)),HD}var BY;function TZe(){return BY||(BY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=_he();function n(r){return e.cloneDeepWithImpl(r,void 0,r,new Map,void 0)}t.cloneDeep=n})(WD)),WD}var zY;function EZe(){return zY||(zY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=D$(),n=TZe();function r(i){return i=n.cloneDeep(i),a=>e.isMatch(a,i)}t.matches=r})(jD)),jD}var ZD={},QD={},JD={},GY;function OZe(){return GY||(GY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=_he(),n=Che();function r(i,a){return e.cloneDeepWith(i,(o,s,c,l)=>{const u=a?.(o,s,c,l);if(u!==void 0)return u;if(typeof i=="object")switch(Object.prototype.toString.call(i)){case n.numberTag:case n.stringTag:case n.booleanTag:{const f=new i.constructor(i?.valueOf());return e.copyProperties(f,i),f}case n.argumentsTag:{const f={};return e.copyProperties(f,i),f.length=i.length,f[Symbol.iterator]=i[Symbol.iterator],f}default:return}})}t.cloneDeepWith=r})(JD)),JD}var WY;function DZe(){return WY||(WY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=OZe();function n(r){return e.cloneDeepWith(r)}t.cloneDeep=n})(QD)),QD}var eM={},tM={},HY;function The(){return HY||(HY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r<i;case"symbol":return!1;case"string":return e.test(r)}}t.isIndex=n})(tM)),tM}var nM={},qY;function MZe(){return qY||(qY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=She();function n(r){return r!==null&&typeof r=="object"&&e.getTag(r)==="[object Arguments]"}t.isArguments=n})(nM)),nM}var KY;function RZe(){return KY||(KY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=ghe(),n=The(),r=MZe(),i=b$();function a(o,s){let c;if(Array.isArray(s)?c=s:typeof s=="string"&&e.isDeepKey(s)&&o?.[s]==null?c=i.toPath(s):c=[s],c.length===0)return!1;let l=o;for(let u=0;u<c.length;u++){const f=c[u];if((l==null||!Object.hasOwn(l,f))&&!((Array.isArray(l)||r.isArguments(l))&&n.isIndex(f)&&f<l.length))return!1;l=l[f]}return!0}t.has=a})(eM)),eM}var YY;function IZe(){return YY||(YY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=D$(),n=w$(),r=DZe(),i=S$(),a=RZe();function o(s,c){switch(typeof s){case"object":{Object.is(s?.valueOf(),-0)&&(s="-0");break}case"number":{s=n.toKey(s);break}}return c=r.cloneDeep(c),function(l){const u=i.get(l,s);return u===void 0?a.has(l,s):c===void 0?u===void 0:e.isMatch(u,c)}}t.matchesProperty=o})(ZD)),ZD}var XY;function NZe(){return XY||(XY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=yhe(),n=bZe(),r=EZe(),i=IZe();function a(o){if(o==null)return e.identity;switch(typeof o){case"function":return o;case"object":return Array.isArray(o)&&o.length===2?i.matchesProperty(o[0],o[1]):r.matches(o);case"string":case"symbol":case"number":return n.property(o)}}t.iteratee=a})(VD)),VD}var ZY;function PZe(){return ZY||(ZY=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=vZe(),n=yhe(),r=wZe(),i=NZe();function a(o,s=n.identity){return r.isArrayLikeObject(o)?e.uniqBy(Array.from(o),i.iteratee(s)):[]}t.uniqBy=a})(RD)),RD}var rM,QY;function kZe(){return QY||(QY=1,rM=PZe().uniqBy),rM}var AZe=kZe();const JY=ka(AZe);function Ehe(t,e,n){return e===!0?JY(t,n):typeof e=="function"?JY(t,e):t}var iM={exports:{}},aM={},oM={exports:{}},sM={};/**
 * @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 eX;function LZe(){if(eX)return sM;eX=1;var t=Jy();function e(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function s(f,d){var h=d(),m=r({inst:{value:h,getSnapshot:d}}),p=m[0].inst,y=m[1];return a(function(){p.value=h,p.getSnapshot=d,c(p)&&y({inst:p})},[f,h,d]),i(function(){return c(p)&&y({inst:p}),f(function(){c(p)&&y({inst:p})})},[f]),o(h),h}function c(f){var d=f.getSnapshot;f=f.value;try{var h=d();return!n(f,h)}catch{return!0}}function l(f,d){return d()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:s;return sM.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,sM}var tX;function VZe(){return tX||(tX=1,oM.exports=LZe()),oM.exports}/**
 * @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 nX;function $Ze(){if(nX)return aM;nX=1;var t=Jy(),e=VZe();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,a=t.useRef,o=t.useEffect,s=t.useMemo,c=t.useDebugValue;return aM.useSyncExternalStoreWithSelector=function(l,u,f,d,h){var m=a(null);if(m.current===null){var p={hasValue:!1,value:null};m.current=p}else p=m.current;m=s(function(){function x(O){if(!S){if(S=!0,C=O,O=d(O),h!==void 0&&p.hasValue){var M=p.value;if(h(M,O))return _=M}return _=O}if(M=_,r(C,O))return M;var I=d(O);return h!==void 0&&h(M,I)?(C=O,M):(C=O,_=I)}var S=!1,C,_,T=f===void 0?null:f;return[function(){return x(u())},T===null?void 0:function(){return x(T())}]},[u,f,d,h]);var y=i(l,m[0],m[1]);return o(function(){p.hasValue=!0,p.value=y},[y]),c(y),y},aM}var rX;function jZe(){return rX||(rX=1,iM.exports=$Ze()),iM.exports}var UZe=jZe(),M$=D.createContext(null),FZe=t=>t,Aa=()=>{var t=D.useContext(M$);return t?t.store.dispatch:FZe},dC=()=>{},BZe=()=>dC,zZe=(t,e)=>t===e;function Jt(t){var e=D.useContext(M$);return UZe.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:BZe,e?e.store.getState:dC,e?e.store.getState:dC,e?t:dC,zZe)}function GZe(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function WZe(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function HZe(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var iX=t=>Array.isArray(t)?t:[t];function qZe(t){const e=Array.isArray(t[0])?t[0]:t;return HZe(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function KZe(t,e){const n=[],{length:r}=t;for(let i=0;i<r;i++)n.push(t[i].apply(null,e));return n}var YZe=class{constructor(t){this.value=t}deref(){return this.value}},XZe=typeof WeakRef<"u"?WeakRef:YZe,ZZe=0,aX=1;function J4(){return{s:ZZe,v:void 0,o:null,p:null}}function Ohe(t,e={}){let n=J4();const{resultEqualityCheck:r}=e;let i,a=0;function o(){let s=n;const{length:c}=arguments;for(let f=0,d=c;f<d;f++){const h=arguments[f];if(typeof h=="function"||typeof h=="object"&&h!==null){let m=s.o;m===null&&(s.o=m=new WeakMap);const p=m.get(h);p===void 0?(s=J4(),m.set(h,s)):s=p}else{let m=s.p;m===null&&(s.p=m=new Map);const p=m.get(h);p===void 0?(s=J4(),m.set(h,s)):s=p}}const l=s;let u;if(s.s===aX)u=s.v;else if(u=t.apply(null,arguments),a++,r){const f=i?.deref?.()??i;f!=null&&r(f,u)&&(u=f,a!==0&&a--),i=typeof u=="object"&&u!==null||typeof u=="function"?new XZe(u):u}return l.s=aX,l.v=u,u}return o.clearCache=()=>{n=J4(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function QZe(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let a=0,o=0,s,c={},l=i.pop();typeof l=="object"&&(c=l,l=i.pop()),GZe(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const u={...n,...c},{memoize:f,memoizeOptions:d=[],argsMemoize:h=Ohe,argsMemoizeOptions:m=[]}=u,p=iX(d),y=iX(m),x=qZe(i),S=f(function(){return a++,l.apply(null,arguments)},...p),C=h(function(){o++;const T=KZe(x,arguments);return s=S.apply(null,T),s},...y);return Object.assign(C,{resultFunc:l,memoizedResultFunc:S,dependencies:x,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>s,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var He=QZe(Ohe),JZe=Object.assign((t,e=He)=>{WZe(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(a=>t[a]);return e(r,(...a)=>a.reduce((o,s,c)=>(o[n[c]]=s,o),{}))},{withTypes:()=>JZe}),cM={},lM={},uM={},oX;function eQe(){return oX||(oX=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,a)=>{if(r!==i){const o=e(r),s=e(i);if(o===s&&o===0){if(r<i)return a==="desc"?1:-1;if(r>i)return a==="desc"?-1:1}return a==="desc"?s-o:o-s}return 0};t.compareValues=n})(uM)),uM}var fM={},dM={},sX;function Dhe(){return sX||(sX=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="symbol"||n instanceof Symbol}t.isSymbol=e})(dM)),dM}var cX;function tQe(){return cX||(cX=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Dhe(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||e.isSymbol(a)?!0:typeof a=="string"&&(r.test(a)||!n.test(a))||o!=null&&Object.hasOwn(o,a)}t.isKey=i})(fM)),fM}var lX;function nQe(){return lX||(lX=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=eQe(),n=tQe(),r=b$();function i(a,o,s,c){if(a==null)return[];s=c?void 0:s,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(s)||(s=s==null?[]:[s]),s=s.map(h=>String(h));const l=(h,m)=>{let p=h;for(let y=0;y<m.length&&p!=null;++y)p=p[m[y]];return p},u=(h,m)=>m==null||h==null?m:typeof h=="object"&&"key"in h?Object.hasOwn(m,h.key)?m[h.key]:l(m,h.path):typeof h=="function"?h(m):Array.isArray(h)?l(m,h):typeof m=="object"?m[h]:m,f=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return a.map(h=>({original:h,criteria:f.map(m=>u(m,h))})).slice().sort((h,m)=>{for(let p=0;p<f.length;p++){const y=e.compareValues(h.criteria[p],m.criteria[p],s[p]);if(y!==0)return y}return 0}).map(h=>h.original)}t.orderBy=i})(lM)),lM}var hM={},uX;function rQe(){return uX||(uX=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r=1){const i=[],a=Math.floor(r),o=(s,c)=>{for(let l=0;l<s.length;l++){const u=s[l];Array.isArray(u)&&c<a?o(u,c+1):i.push(u)}};return o(n,0),i}t.flatten=e})(hM)),hM}var gM={},fX;function Mhe(){return fX||(fX=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=The(),n=O$(),r=xhe(),i=bhe();function a(o,s,c){return r.isObject(c)&&(typeof s=="number"&&n.isArrayLike(c)&&e.isIndex(s)&&s<c.length||typeof s=="string"&&s in c)?i.eq(c[s],o):!1}t.isIterateeCall=a})(gM)),gM}var dX;function iQe(){return dX||(dX=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=nQe(),n=rQe(),r=Mhe();function i(a,...o){const s=o.length;return s>1&&r.isIterateeCall(a,o[0],o[1])?o=[]:s>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),e.orderBy(a,n.flatten(o),["asc"])}t.sortBy=i})(cM)),cM}var pM,hX;function aQe(){return hX||(hX=1,pM=iQe().sortBy),pM}var oQe=aQe();const I8=ka(oQe);var Rhe=t=>t.legend.settings,sQe=t=>t.legend.size,cQe=t=>t.legend.payload,lQe=He([cQe,Rhe],(t,e)=>{var{itemSorter:n}=e,r=t.flat(1);return n?I8(r,n):r});function uQe(){return Jt(lQe)}var eS=1;function Ihe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[e,n]=D.useState({height:0,left:0,top:0,width:0}),r=D.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-e.height)>eS||Math.abs(o.left-e.left)>eS||Math.abs(o.top-e.top)>eS||Math.abs(o.width-e.width)>eS)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[e.width,e.height,e.top,e.left,...t]);return[e,r]}function Yo(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var fQe=typeof Symbol=="function"&&Symbol.observable||"@@observable",gX=fQe,mM=()=>Math.random().toString(36).substring(7).split("").join("."),dQe={INIT:`@@redux/INIT${mM()}`,REPLACE:`@@redux/REPLACE${mM()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${mM()}`},B_=dQe;function R$(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function Nhe(t,e,n){if(typeof t!="function")throw new Error(Yo(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Yo(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Yo(1));return n(Nhe)(t,e)}let r=t,i=e,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((y,x)=>{o.set(x,y)}))}function u(){if(c)throw new Error(Yo(3));return i}function f(y){if(typeof y!="function")throw new Error(Yo(4));if(c)throw new Error(Yo(5));let x=!0;l();const S=s++;return o.set(S,y),function(){if(x){if(c)throw new Error(Yo(6));x=!1,l(),o.delete(S),a=null}}}function d(y){if(!R$(y))throw new Error(Yo(7));if(typeof y.type>"u")throw new Error(Yo(8));if(typeof y.type!="string")throw new Error(Yo(17));if(c)throw new Error(Yo(9));try{c=!0,i=r(i,y)}finally{c=!1}return(a=o).forEach(S=>{S()}),y}function h(y){if(typeof y!="function")throw new Error(Yo(10));r=y,d({type:B_.REPLACE})}function m(){const y=f;return{subscribe(x){if(typeof x!="object"||x===null)throw new Error(Yo(11));function S(){const _=x;_.next&&_.next(u())}return S(),{unsubscribe:y(S)}},[gX](){return this}}}return d({type:B_.INIT}),{dispatch:d,subscribe:f,getState:u,replaceReducer:h,[gX]:m}}function hQe(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:B_.INIT})>"u")throw new Error(Yo(12));if(typeof n(void 0,{type:B_.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Yo(13))})}function Phe(t){const e=Object.keys(t),n={};for(let a=0;a<e.length;a++){const o=e[a];typeof t[o]=="function"&&(n[o]=t[o])}const r=Object.keys(n);let i;try{hQe(n)}catch(a){i=a}return function(o={},s){if(i)throw i;let c=!1;const l={};for(let u=0;u<r.length;u++){const f=r[u],d=n[f],h=o[f],m=d(h,s);if(typeof m>"u")throw s&&s.type,new Error(Yo(14));l[f]=m,c=c||m!==h}return c=c||r.length!==Object.keys(o).length,c?l:o}}function z_(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function gQe(...t){return e=>(n,r)=>{const i=e(n,r);let a=()=>{throw new Error(Yo(15))};const o={getState:i.getState,dispatch:(c,...l)=>a(c,...l)},s=t.map(c=>c(o));return a=z_(...s)(i.dispatch),{...i,dispatch:a}}}function khe(t){return R$(t)&&"type"in t&&typeof t.type=="string"}var Ahe=Symbol.for("immer-nothing"),pX=Symbol.for("immer-draftable"),Ol=Symbol.for("immer-state");function Ju(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Ny=Object.getPrototypeOf;function Xm(t){return!!t&&!!t[Ol]}function gh(t){return t?Lhe(t)||Array.isArray(t)||!!t[pX]||!!t.constructor?.[pX]||Ub(t)||P8(t):!1}var pQe=Object.prototype.constructor.toString();function Lhe(t){if(!t||typeof t!="object")return!1;const e=Ny(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===pQe}function G_(t,e){N8(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,r)=>e(r,n,t))}function N8(t){const e=t[Ol];return e?e.type_:Array.isArray(t)?1:Ub(t)?2:P8(t)?3:0}function BN(t,e){return N8(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Vhe(t,e,n){const r=N8(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function mQe(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Ub(t){return t instanceof Map}function P8(t){return t instanceof Set}function tm(t){return t.copy_||t.base_}function zN(t,e){if(Ub(t))return new Map(t);if(P8(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Lhe(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Ol];let i=Reflect.ownKeys(r);for(let a=0;a<i.length;a++){const o=i[a],s=r[o];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(r[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:t[o]})}return Object.create(Ny(t),r)}else{const r=Ny(t);if(r!==null&&n)return{...t};const i=Object.create(r);return Object.assign(i,t)}}function I$(t,e=!1){return k8(t)||Xm(t)||!gh(t)||(N8(t)>1&&Object.defineProperties(t,{set:{value:tS},add:{value:tS},clear:{value:tS},delete:{value:tS}}),Object.freeze(t),e&&Object.values(t).forEach(n=>I$(n,!0))),t}function tS(){Ju(2)}function k8(t){return Object.isFrozen(t)}var vQe={};function Zm(t){const e=vQe[t];return e||Ju(0,t),e}var Iw;function $he(){return Iw}function yQe(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function mX(t,e){e&&(Zm("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function GN(t){WN(t),t.drafts_.forEach(xQe),t.drafts_=null}function WN(t){t===Iw&&(Iw=t.parent_)}function vX(t){return Iw=yQe(Iw,t)}function xQe(t){const e=t[Ol];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function yX(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Ol].modified_&&(GN(e),Ju(4)),gh(t)&&(t=W_(e,t),e.parent_||H_(e,t)),e.patches_&&Zm("Patches").generateReplacementPatches_(n[Ol].base_,t,e.patches_,e.inversePatches_)):t=W_(e,n,[]),GN(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Ahe?t:void 0}function W_(t,e,n){if(k8(e))return e;const r=e[Ol];if(!r)return G_(e,(i,a)=>xX(t,r,e,i,a,n)),e;if(r.scope_!==t)return e;if(!r.modified_)return H_(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let a=i,o=!1;r.type_===3&&(a=new Set(i),i.clear(),o=!0),G_(a,(s,c)=>xX(t,r,i,s,c,n,o)),H_(t,i,!1),n&&t.patches_&&Zm("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function xX(t,e,n,r,i,a,o){if(Xm(i)){const s=a&&e&&e.type_!==3&&!BN(e.assigned_,r)?a.concat(r):void 0,c=W_(t,i,s);if(Vhe(n,r,c),Xm(c))t.canAutoFreeze_=!1;else return}else o&&n.add(i);if(gh(i)&&!k8(i)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;W_(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(Ub(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&H_(t,i)}}function H_(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&I$(e,n)}function wQe(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:$he(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=N$;n&&(i=[r],a=Nw);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}var N$={get(t,e){if(e===Ol)return t;const n=tm(t);if(!BN(n,e))return bQe(t,n,e);const r=n[e];return t.finalized_||!gh(r)?r:r===vM(t.base_,e)?(yM(t),t.copy_[e]=qN(r,t)):r},has(t,e){return e in tm(t)},ownKeys(t){return Reflect.ownKeys(tm(t))},set(t,e,n){const r=jhe(tm(t),e);if(r?.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=vM(tm(t),e),a=i?.[Ol];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(mQe(n,i)&&(n!==void 0||BN(t.base_,e)))return!0;yM(t),HN(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return vM(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,yM(t),HN(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=tm(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){Ju(11)},getPrototypeOf(t){return Ny(t.base_)},setPrototypeOf(){Ju(12)}},Nw={};G_(N$,(t,e)=>{Nw[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});Nw.deleteProperty=function(t,e){return Nw.set.call(this,t,e,void 0)};Nw.set=function(t,e,n){return N$.set.call(this,t[0],e,n,t[0])};function vM(t,e){const n=t[Ol];return(n?tm(n):t)[e]}function bQe(t,e,n){const r=jhe(e,n);return r?"value"in r?r.value:r.get?.call(t.draft_):void 0}function jhe(t,e){if(!(e in t))return;let n=Ny(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Ny(n)}}function HN(t){t.modified_||(t.modified_=!0,t.parent_&&HN(t.parent_))}function yM(t){t.copy_||(t.copy_=zN(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var SQe=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const a=n;n=e;const o=this;return function(c=a,...l){return o.produce(c,u=>n.call(this,u,...l))}}typeof n!="function"&&Ju(6),r!==void 0&&typeof r!="function"&&Ju(7);let i;if(gh(e)){const a=vX(this),o=qN(e,void 0);let s=!0;try{i=n(o),s=!1}finally{s?GN(a):WN(a)}return mX(a,r),yX(i,a)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===Ahe&&(i=void 0),this.autoFreeze_&&I$(i,!0),r){const a=[],o=[];Zm("Patches").generateReplacementPatches_(e,i,a,o),r(a,o)}return i}else Ju(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(o,...s)=>this.produceWithPatches(o,c=>e(c,...s));let r,i;return[this.produce(e,n,(o,s)=>{r=o,i=s}),r,i]},typeof t?.autoFreeze=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof t?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){gh(t)||Ju(8),Xm(t)&&(t=Y0(t));const e=vX(this),n=qN(t,void 0);return n[Ol].isManual_=!0,WN(e),n}finishDraft(t,e){const n=t&&t[Ol];(!n||!n.isManual_)&&Ju(9);const{scope_:r}=n;return mX(r,e),yX(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=Zm("Patches").applyPatches_;return Xm(t)?r(t,e):this.produce(t,i=>r(i,e))}};function qN(t,e){const n=Ub(t)?Zm("MapSet").proxyMap_(t,e):P8(t)?Zm("MapSet").proxySet_(t,e):wQe(t,e);return(e?e.scope_:$he()).drafts_.push(n),n}function Y0(t){return Xm(t)||Ju(10,t),Uhe(t)}function Uhe(t){if(!gh(t)||k8(t))return t;const e=t[Ol];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=zN(t,e.scope_.immer_.useStrictShallowCopy_)}else n=zN(t,!0);return G_(n,(r,i)=>{Vhe(n,r,Uhe(i))}),e&&(e.finalized_=!1),n}var CQe=new SQe,Fhe=CQe.produce;function Bhe(t){return({dispatch:n,getState:r})=>i=>a=>typeof a=="function"?a(n,r,t):i(a)}var _Qe=Bhe(),TQe=Bhe,EQe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?z_:z_.apply(null,arguments)};function Su(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(wl(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>khe(r)&&r.type===t,n}var zhe=class m5 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,m5.prototype)}static get[Symbol.species](){return m5}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new m5(...e[0].concat(this)):new m5(...e.concat(this))}};function wX(t){return gh(t)?Fhe(t,()=>{}):t}function nS(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function OQe(t){return typeof t=="boolean"}var DQe=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=e??{};let o=new zhe;return n&&(OQe(n)?o.push(_Qe):o.push(TQe(n.extraArgument))),o},Ghe="RTK_autoBatch",Ws=()=>t=>({payload:t,meta:{[Ghe]:!0}}),bX=t=>e=>{setTimeout(e,t)},Whe=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,a=!1,o=!1;const s=new Set,c=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:bX(10):t.type==="callback"?t.queueNotification:bX(t.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(u=>u()))};return Object.assign({},r,{subscribe(u){const f=()=>i&&u(),d=r.subscribe(f);return s.add(u),()=>{d(),s.delete(u)}},dispatch(u){try{return i=!u?.meta?.[Ghe],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(u)}finally{i=!0}}})},MQe=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new zhe(t);return r&&i.push(Whe(typeof r=="object"?r:void 0)),i};function RQe(t){const e=DQe(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=t||{};let s;if(typeof n=="function")s=n;else if(R$(n))s=Phe(n);else throw new Error(wl(1));let c;typeof r=="function"?c=r(e):c=e();let l=z_;i&&(l=EQe({trace:!1,...typeof i=="object"&&i}));const u=gQe(...c),f=MQe(u);let d=typeof o=="function"?o(f):f();const h=l(...d);return Nhe(s,a,h)}function Hhe(t){const e={},n=[];let r;const i={addCase(a,o){const s=typeof a=="string"?a:a.type;if(!s)throw new Error(wl(28));if(s in e)throw new Error(wl(29));return e[s]=o,i},addAsyncThunk(a,o){return o.pending&&(e[a.pending.type]=o.pending),o.rejected&&(e[a.rejected.type]=o.rejected),o.fulfilled&&(e[a.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return n.push({matcher:a,reducer:o}),i},addDefaultCase(a){return r=a,i}};return t(i),[e,n,r]}function IQe(t){return typeof t=="function"}function NQe(t,e){let[n,r,i]=Hhe(e),a;if(IQe(t))a=()=>wX(t());else{const s=wX(t);a=()=>s}function o(s=a(),c){let l=[n[c.type],...r.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return l.filter(u=>!!u).length===0&&(l=[i]),l.reduce((u,f)=>{if(f)if(Xm(u)){const h=f(u,c);return h===void 0?u:h}else{if(gh(u))return Fhe(u,d=>f(d,c));{const d=f(u,c);if(d===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return d}}return u},s)}return o.getInitialState=a,o}var PQe="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",kQe=(t=21)=>{let e="",n=t;for(;n--;)e+=PQe[Math.random()*64|0];return e},AQe=Symbol.for("rtk-slice-createasyncthunk");function LQe(t,e){return`${t}/${e}`}function VQe({creators:t}={}){const e=t?.asyncThunk?.[AQe];return function(r){const{name:i,reducerPath:a=i}=r;if(!i)throw new Error(wl(11));const o=(typeof r.reducers=="function"?r.reducers(jQe()):r.reducers)||{},s=Object.keys(o),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},l={addCase(C,_){const T=typeof C=="string"?C:C.type;if(!T)throw new Error(wl(12));if(T in c.sliceCaseReducersByType)throw new Error(wl(13));return c.sliceCaseReducersByType[T]=_,l},addMatcher(C,_){return c.sliceMatchers.push({matcher:C,reducer:_}),l},exposeAction(C,_){return c.actionCreators[C]=_,l},exposeCaseReducer(C,_){return c.sliceCaseReducersByName[C]=_,l}};s.forEach(C=>{const _=o[C],T={reducerName:C,type:LQe(i,C),createNotation:typeof r.reducers=="function"};FQe(_)?zQe(T,_,l,e):UQe(T,_,l)});function u(){const[C={},_=[],T=void 0]=typeof r.extraReducers=="function"?Hhe(r.extraReducers):[r.extraReducers],O={...C,...c.sliceCaseReducersByType};return NQe(r.initialState,M=>{for(let I in O)M.addCase(I,O[I]);for(let I of c.sliceMatchers)M.addMatcher(I.matcher,I.reducer);for(let I of _)M.addMatcher(I.matcher,I.reducer);T&&M.addDefaultCase(T)})}const f=C=>C,d=new Map,h=new WeakMap;let m;function p(C,_){return m||(m=u()),m(C,_)}function y(){return m||(m=u()),m.getInitialState()}function x(C,_=!1){function T(M){let I=M[C];return typeof I>"u"&&_&&(I=nS(h,T,y)),I}function O(M=f){const I=nS(d,_,()=>new WeakMap);return nS(I,M,()=>{const V={};for(const[k,L]of Object.entries(r.selectors??{}))V[k]=$Qe(L,M,()=>nS(h,M,y),_);return V})}return{reducerPath:C,getSelectors:O,get selectors(){return O(T)},selectSlice:T}}const S={name:i,reducer:p,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:y,...x(a),injectInto(C,{reducerPath:_,...T}={}){const O=_??a;return C.inject({reducerPath:O,reducer:p},T),{...S,...x(O,!0)}}};return S}}function $Qe(t,e,n,r){function i(a,...o){let s=e(a);return typeof s>"u"&&r&&(s=n()),t(s,...o)}return i.unwrapped=t,i}var Nl=VQe();function jQe(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function UQe({type:t,reducerName:e,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!BQe(r))throw new Error(wl(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(t,a).exposeCaseReducer(e,a).exposeAction(e,o?Su(t,o):Su(t))}function FQe(t){return t._reducerDefinitionType==="asyncThunk"}function BQe(t){return t._reducerDefinitionType==="reducerWithPrepare"}function zQe({type:t,reducerName:e},n,r,i){if(!i)throw new Error(wl(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,f=i(t,a,u);r.exposeAction(e,f),o&&r.addCase(f.fulfilled,o),s&&r.addCase(f.pending,s),c&&r.addCase(f.rejected,c),l&&r.addMatcher(f.settled,l),r.exposeCaseReducer(e,{fulfilled:o||rS,pending:s||rS,rejected:c||rS,settled:l||rS})}function rS(){}var GQe="task",qhe="listener",Khe="completed",P$="cancelled",WQe=`task-${P$}`,HQe=`task-${Khe}`,KN=`${qhe}-${P$}`,qQe=`${qhe}-${Khe}`,A8=class{constructor(t){this.code=t,this.message=`${GQe} ${P$} (reason: ${t})`}name="TaskAbortError";message},k$=(t,e)=>{if(typeof t!="function")throw new TypeError(wl(32))},q_=()=>{},Yhe=(t,e=q_)=>(t.catch(e),t),Xhe=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),Im=(t,e)=>{const n=t.signal;n.aborted||("reason"in n||Object.defineProperty(n,"reason",{enumerable:!0,value:e,configurable:!0,writable:!0}),t.abort(e))},Nm=t=>{if(t.aborted){const{reason:e}=t;throw new A8(e)}};function Zhe(t,e){let n=q_;return new Promise((r,i)=>{const a=()=>i(new A8(t.reason));if(t.aborted){a();return}n=Xhe(t,a),e.finally(()=>n()).then(r,i)}).finally(()=>{n=q_})}var KQe=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof A8?"cancelled":"rejected",error:n}}finally{e?.()}},K_=t=>e=>Yhe(Zhe(t,e).then(n=>(Nm(t),n))),Qhe=t=>{const e=K_(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:cy}=Object,SX={},L8="listenerMiddleware",YQe=(t,e)=>{const n=r=>Xhe(t,()=>Im(r,t.reason));return(r,i)=>{k$(r);const a=new AbortController;n(a);const o=KQe(async()=>{Nm(t),Nm(a.signal);const s=await r({pause:K_(a.signal),delay:Qhe(a.signal),signal:a.signal});return Nm(a.signal),s},()=>Im(a,HQe));return i?.autoJoin&&e.push(o.catch(q_)),{result:K_(t)(o),cancel(){Im(a,WQe)}}}},XQe=(t,e)=>{const n=async(r,i)=>{Nm(e);let a=()=>{};const s=[new Promise((c,l)=>{let u=t({predicate:r,effect:(f,d)=>{d.unsubscribe(),c([f,d.getState(),d.getOriginalState()])}});a=()=>{u(),l()}})];i!=null&&s.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await Zhe(e,Promise.race(s));return Nm(e),c}finally{a()}};return(r,i)=>Yhe(n(r,i))},Jhe=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:a}=t;if(e)i=Su(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(wl(21));return k$(a),{predicate:i,type:e,effect:a}},ege=cy(t=>{const{type:e,predicate:n,effect:r}=Jhe(t);return{id:kQe(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(wl(22))}}},{withTypes:()=>ege}),CX=(t,e)=>{const{type:n,effect:r,predicate:i}=Jhe(e);return Array.from(t.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===i)&&a.effect===r)},YN=t=>{t.pending.forEach(e=>{Im(e,KN)})},ZQe=(t,e)=>()=>{for(const n of e.keys())YN(n);t.clear()},_X=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},tge=cy(Su(`${L8}/add`),{withTypes:()=>tge}),QQe=Su(`${L8}/removeAll`),nge=cy(Su(`${L8}/remove`),{withTypes:()=>nge}),JQe=(...t)=>{console.error(`${L8}/error`,...t)},Fb=(t={})=>{const e=new Map,n=new Map,r=h=>{const m=n.get(h)??0;n.set(h,m+1)},i=h=>{const m=n.get(h)??1;m===1?n.delete(h):n.set(h,m-1)},{extra:a,onError:o=JQe}=t;k$(o);const s=h=>(h.unsubscribe=()=>e.delete(h.id),e.set(h.id,h),m=>{h.unsubscribe(),m?.cancelActive&&YN(h)}),c=h=>{const m=CX(e,h)??ege(h);return s(m)};cy(c,{withTypes:()=>c});const l=h=>{const m=CX(e,h);return m&&(m.unsubscribe(),h.cancelActive&&YN(m)),!!m};cy(l,{withTypes:()=>l});const u=async(h,m,p,y)=>{const x=new AbortController,S=XQe(c,x.signal),C=[];try{h.pending.add(x),r(h),await Promise.resolve(h.effect(m,cy({},p,{getOriginalState:y,condition:(_,T)=>S(_,T).then(Boolean),take:S,delay:Qhe(x.signal),pause:K_(x.signal),extra:a,signal:x.signal,fork:YQe(x.signal,C),unsubscribe:h.unsubscribe,subscribe:()=>{e.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((_,T,O)=>{_!==x&&(Im(_,KN),O.delete(_))})},cancel:()=>{Im(x,KN),h.pending.delete(x)},throwIfCancelled:()=>{Nm(x.signal)}})))}catch(_){_ instanceof A8||_X(o,_,{raisedBy:"effect"})}finally{await Promise.all(C),Im(x,qQe),i(h),h.pending.delete(x)}},f=ZQe(e,n);return{middleware:h=>m=>p=>{if(!khe(p))return m(p);if(tge.match(p))return c(p.payload);if(QQe.match(p)){f();return}if(nge.match(p))return l(p.payload);let y=h.getState();const x=()=>{if(y===SX)throw new Error(wl(23));return y};let S;try{if(S=m(p),e.size>0){const C=h.getState(),_=Array.from(e.values());for(const T of _){let O=!1;try{O=T.predicate(p,C,y)}catch(M){O=!1,_X(o,M,{raisedBy:"predicate"})}O&&u(T,p,h,x)}}}finally{y=SX}return S},startListening:c,stopListening:l,clearListeners:f}};function wl(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var eJe={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},rge=Nl({name:"chartLayout",initialState:eJe,reducers:{setLayout(t,e){t.layoutType=e.payload},setChartSize(t,e){t.width=e.payload.width,t.height=e.payload.height},setMargin(t,e){var n,r,i,a;t.margin.top=(n=e.payload.top)!==null&&n!==void 0?n:0,t.margin.right=(r=e.payload.right)!==null&&r!==void 0?r:0,t.margin.bottom=(i=e.payload.bottom)!==null&&i!==void 0?i:0,t.margin.left=(a=e.payload.left)!==null&&a!==void 0?a:0},setScale(t,e){t.scale=e.payload}}}),{setMargin:tJe,setLayout:nJe,setChartSize:rJe,setScale:iJe}=rge.actions,aJe=rge.reducer;function TX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function EX(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?TX(Object(n),!0).forEach(function(r){oJe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):TX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function oJe(t,e,n){return(e=sJe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sJe(t){var e=cJe(t,"string");return typeof e=="symbol"?e:e+""}function cJe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Y_=Math.PI/180,lJe=t=>t*180/Math.PI,ts=(t,e,n,r)=>({x:t+Math.cos(-Y_*r)*n,y:e+Math.sin(-Y_*r)*n}),uJe=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},fJe=(t,e)=>{var{x:n,y:r}=t,{x:i,y:a}=e;return Math.sqrt((n-i)**2+(r-a)**2)},dJe=(t,e)=>{var{x:n,y:r}=t,{cx:i,cy:a}=e,o=fJe({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=(n-i)/o,c=Math.acos(s);return r>a&&(c=2*Math.PI-c),{radius:o,angle:lJe(c),angleInRadian:c}},hJe=t=>{var{startAngle:e,endAngle:n}=t,r=Math.floor(e/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:e-a*360,endAngle:n-a*360}},gJe=(t,e)=>{var{startAngle:n,endAngle:r}=e,i=Math.floor(n/360),a=Math.floor(r/360),o=Math.min(i,a);return t+o*360},pJe=(t,e)=>{var{x:n,y:r}=t,{radius:i,angle:a}=dJe({x:n,y:r},e),{innerRadius:o,outerRadius:s}=e;if(i<o||i>s||i===0)return null;var{startAngle:c,endAngle:l}=hJe(e),u=a,f;if(c<=l){for(;u>l;)u-=360;for(;u<c;)u+=360;f=u>=c&&u<=l}else{for(;u>c;)u-=360;for(;u<l;)u+=360;f=u>=l&&u<=c}return f?EX(EX({},e),{},{radius:i,angle:gJe(u,e)}):null};function ige(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function OX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function fu(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?OX(Object(n),!0).forEach(function(r){mJe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):OX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function mJe(t,e,n){return(e=vJe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vJe(t){var e=yJe(t,"string");return typeof e=="symbol"?e:e+""}function yJe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Po(t,e,n){return ta(t)||ta(e)?n:bd(e)?Iy(t,e,n):typeof e=="function"?e(t):n}var xJe=(t,e,n,r,i)=>{var a,o=-1,s=(a=e?.length)!==null&&a!==void 0?a:0;if(s<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var c=0;c<s;c++){var l=c>0?n[c-1].coordinate:n[s-1].coordinate,u=n[c].coordinate,f=c>=s-1?n[0].coordinate:n[c+1].coordinate,d=void 0;if(Rc(u-l)!==Rc(f-u)){var h=[];if(Rc(f-u)===Rc(i[1]-i[0])){d=f;var m=u+i[1]-i[0];h[0]=Math.min(m,(m+l)/2),h[1]=Math.max(m,(m+l)/2)}else{d=l;var p=f+i[1]-i[0];h[0]=Math.min(u,(p+u)/2),h[1]=Math.max(u,(p+u)/2)}var y=[Math.min(u,(d+u)/2),Math.max(u,(d+u)/2)];if(t>y[0]&&t<=y[1]||t>=h[0]&&t<=h[1]){({index:o}=n[c]);break}}else{var x=Math.min(l,f),S=Math.max(l,f);if(t>(x+u)/2&&t<=(S+u)/2){({index:o}=n[c]);break}}}else if(e){for(var C=0;C<s;C++)if(C===0&&t<=(e[C].coordinate+e[C+1].coordinate)/2||C>0&&C<s-1&&t>(e[C].coordinate+e[C-1].coordinate)/2&&t<=(e[C].coordinate+e[C+1].coordinate)/2||C===s-1&&t>(e[C].coordinate+e[C-1].coordinate)/2){({index:o}=e[C]);break}}return o},wJe=(t,e,n)=>{if(e&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=e;if((s==="vertical"||s==="horizontal"&&o==="middle")&&a!=="center"&&qt(t[a]))return fu(fu({},t),{},{[a]:t[a]+(r||0)});if((s==="horizontal"||s==="vertical"&&a==="center")&&o!=="middle"&&qt(t[o]))return fu(fu({},t),{},{[o]:t[o]+(i||0)})}return t},Th=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",age=(t,e,n,r)=>{if(r)return t.map(s=>s.coordinate);var i,a,o=t.map(s=>(s.coordinate===e&&(i=!0),s.coordinate===n&&(a=!0),s.coordinate));return i||o.push(e),a||o.push(n),o},oge=(t,e,n)=>{if(!t)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:c,categoricalDomain:l,tickCount:u,ticks:f,niceTicks:d,axisType:h}=t;if(!o)return null;var m=s==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,p=i==="category"&&o.bandwidth?o.bandwidth()/m:0;if(p=h==="angleAxis"&&a&&a.length>=2?Rc(a[0]-a[1])*2*p:p,f||d){var y=(f||d||[]).map((x,S)=>{var C=r?r.indexOf(x):x;return{coordinate:o(C)+p,value:x,offset:p,index:S}});return y.filter(x=>!El(x.coordinate))}return c&&l?l.map((x,S)=>({coordinate:o(x)+p,value:x,index:S,offset:p})):o.ticks&&u!=null?o.ticks(u).map((x,S)=>({coordinate:o(x)+p,value:x,offset:p,index:S})):o.domain().map((x,S)=>({coordinate:o(x)+p,value:r?r[x]:x,index:S,offset:p}))},DX=1e-4,bJe=t=>{var e=t.domain();if(!(!e||e.length<=2)){var n=e.length,r=t.range(),i=Math.min(r[0],r[1])-DX,a=Math.max(r[0],r[1])+DX,o=t(e[0]),s=t(e[n-1]);(o<i||o>a||s<i||s>a)&&t.domain([e[0],e[n-1]])}},SJe=(t,e)=>{if(!e||e.length!==2||!qt(e[0])||!qt(e[1]))return t;var n=Math.min(e[0],e[1]),r=Math.max(e[0],e[1]),i=[t[0],t[1]];return(!qt(t[0])||t[0]<n)&&(i[0]=n),(!qt(t[1])||t[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i},CJe=t=>{var e=t.length;if(!(e<=0))for(var n=0,r=t[0].length;n<r;++n)for(var i=0,a=0,o=0;o<e;++o){var s=El(t[o][n][1])?t[o][n][0]:t[o][n][1];s>=0?(t[o][n][0]=i,t[o][n][1]=i+s,i=t[o][n][1]):(t[o][n][0]=a,t[o][n][1]=a+s,a=t[o][n][1])}},_Je=t=>{var e=t.length;if(!(e<=0))for(var n=0,r=t[0].length;n<r;++n)for(var i=0,a=0;a<e;++a){var o=El(t[a][n][1])?t[a][n][0]:t[a][n][1];o>=0?(t[a][n][0]=i,t[a][n][1]=i+o,i=t[a][n][1]):(t[a][n][0]=0,t[a][n][1]=0)}},TJe={sign:CJe,expand:YXe,none:Ry,silhouette:XXe,wiggle:ZXe,positive:_Je},EJe=(t,e,n)=>{var r=TJe[n],i=KXe().keys(e).value((a,o)=>+Po(a,o,0)).order(jN).offset(r);return i(t)};function sge(t){return t==null?void 0:String(t)}function MX(t){var{axis:e,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=t;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!ta(i[e.dataKey])){var s=mhe(n,"value",i[e.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=Po(i,ta(o)?e.dataKey:o);return ta(c)?null:e.scale(c)}var RX=t=>{var{axis:e,ticks:n,offset:r,bandSize:i,entry:a,index:o}=t;if(e.type==="category")return n[o]?n[o].coordinate+r:null;var s=Po(a,e.dataKey,e.scale.domain()[o]);return ta(s)?null:e.scale(s)-i/2+r},OJe=t=>{var{numericAxis:e}=t,n=e.scale.domain();if(e.type==="number"){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},DJe=t=>{var e=t.flat(2).filter(qt);return[Math.min(...e),Math.max(...e)]},MJe=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],RJe=(t,e,n)=>{if(t!=null)return MJe(Object.keys(t).reduce((r,i)=>{var a=t[i],{stackedData:o}=a,s=o.reduce((c,l)=>{var u=ige(l,e,n),f=DJe(u);return[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},IX=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,NX=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Pw=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var r=t.scale.bandwidth();if(!n||r>0)return r}if(t&&e&&e.length>=2){for(var i=I8(e,u=>u.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var c=i[o],l=i[o-1];a=Math.min((c.coordinate||0)-(l.coordinate||0),a)}return a===1/0?0:a}return n?void 0:0};function PX(t){var{tooltipEntrySettings:e,dataKey:n,payload:r,value:i,name:a}=t;return fu(fu({},e),{},{dataKey:n,payload:r,value:i,name:a})}function V8(t,e){if(t)return String(t);if(typeof e=="string")return e}function IJe(t,e,n,r,i){if(n==="horizontal"||n==="vertical"){var a=t>=i.left&&t<=i.left+i.width&&e>=i.top&&e<=i.top+i.height;return a?{x:t,y:e}:null}return r?pJe({x:t,y:e},r):null}var NJe=(t,e,n,r)=>{var i=e.find(l=>l&&l.index===n);if(i){if(t==="horizontal")return{x:i.coordinate,y:r.y};if(t==="vertical")return{x:r.x,y:i.coordinate};if(t==="centric"){var a=i.coordinate,{radius:o}=r;return fu(fu(fu({},r),ts(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:c}=r;return fu(fu(fu({},r),ts(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return{x:0,y:0}},PJe=(t,e)=>e==="horizontal"?t.x:e==="vertical"?t.y:e==="centric"?t.angle:t.radius,Eh=t=>t.layout.width,Oh=t=>t.layout.height,kJe=t=>t.layout.scale,cge=t=>t.layout.margin,$8=He(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),j8=He(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),AJe="data-recharts-item-index",LJe="data-recharts-item-data-key",Bb=60;function kX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function iS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kX(Object(n),!0).forEach(function(r){VJe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function VJe(t,e,n){return(e=$Je(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $Je(t){var e=jJe(t,"string");return typeof e=="symbol"?e:e+""}function jJe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var UJe=t=>t.brush.height;function FJe(t){var e=j8(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Bb;return n+i}return n},0)}function BJe(t){var e=j8(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Bb;return n+i}return n},0)}function zJe(t){var e=$8(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function GJe(t){var e=$8(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Vo=He([Eh,Oh,cge,UJe,FJe,BJe,zJe,GJe,Rhe,sQe],(t,e,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},f={top:(n.top||0)+o,bottom:(n.bottom||0)+s},d=iS(iS({},f),u),h=d.bottom;d.bottom+=r,d=wJe(d,c,l);var m=t-d.left-d.right,p=e-d.top-d.bottom;return iS(iS({brushBottom:h},d),{},{width:Math.max(m,0),height:Math.max(p,0)})}),WJe=He(Vo,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),A$=He(Eh,Oh,(t,e)=>({x:0,y:0,width:t,height:e})),HJe=D.createContext(null),ac=()=>D.useContext(HJe)!=null,U8=t=>t.brush,F8=He([U8,Vo,cge],(t,e,n)=>({height:t.height,x:qt(t.x)?t.x:e.left,y:qt(t.y)?t.y:e.top+e.height+e.brushBottom-(n?.bottom||0),width:qt(t.width)?t.width:e.width})),xM={},wM={},bM={},AX;function qJe(){return AX||(AX=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r,{signal:i,edges:a}={}){let o,s=null;const c=a!=null&&a.includes("leading"),l=a==null||a.includes("trailing"),u=()=>{s!==null&&(n.apply(o,s),o=void 0,s=null)},f=()=>{l&&u(),p()};let d=null;const h=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,f()},r)},m=()=>{d!==null&&(clearTimeout(d),d=null)},p=()=>{m(),o=void 0,s=null},y=()=>{u()},x=function(...S){if(i?.aborted)return;o=this,s=S;const C=d==null;h(),c&&C&&u()};return x.schedule=h,x.cancel=p,x.flush=y,i?.addEventListener("abort",p,{once:!0}),x}t.debounce=e})(bM)),bM}var LX;function KJe(){return LX||(LX=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=qJe();function n(r,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:s=!0,maxWait:c}=a,l=Array(2);o&&(l[0]="leading"),s&&(l[1]="trailing");let u,f=null;const d=e.debounce(function(...p){u=r.apply(this,p),f=null},i,{edges:l}),h=function(...p){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(u=r.apply(this,p),f=Date.now(),d.cancel(),d.schedule(),u):(d.apply(this,p),u)},m=()=>(d.flush(),u);return h.cancel=d.cancel,h.flush=m,h}t.debounce=n})(wM)),wM}var VX;function YJe(){return VX||(VX=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=KJe();function n(r,i=0,a={}){const{leading:o=!0,trailing:s=!0}=a;return e.debounce(r,i,{leading:o,maxWait:i,trailing:s})}t.throttle=n})(xM)),xM}var SM,$X;function XJe(){return $X||($X=1,SM=YJe().throttle),SM}var ZJe=XJe();const QJe=ka(ZJe);var X_=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a]},lge=(t,e,n)=>{var{width:r="100%",height:i="100%",aspect:a,maxHeight:o}=n,s=hh(r)?t:Number(r),c=hh(i)?e:Number(i);return a&&a>0&&(s?c=s/a:c&&(s=c*a),o&&c>o&&(c=o)),{calculatedWidth:s,calculatedHeight:c}},JJe={width:0,height:0,overflow:"visible"},eet={width:0,overflowX:"visible"},tet={height:0,overflowY:"visible"},net={},ret=t=>{var{width:e,height:n}=t,r=hh(e),i=hh(n);return r&&i?JJe:r?eet:i?tet:net};function iet(t){var{width:e,height:n,aspect:r}=t,i=e,a=n;return i===void 0&&a===void 0?(i="100%",a="100%"):i===void 0?i=r&&r>0?void 0:"100%":a===void 0&&(a=r&&r>0?void 0:"100%"),{width:i,height:a}}function Za(t){return Number.isFinite(t)}function Py(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function XN(){return XN=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},XN.apply(null,arguments)}function jX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function UX(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jX(Object(n),!0).forEach(function(r){aet(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function aet(t,e,n){return(e=oet(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oet(t){var e=set(t,"string");return typeof e=="symbol"?e:e+""}function set(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var uge=D.createContext({width:-1,height:-1});function fge(t){var{children:e,width:n,height:r}=t,i=D.useMemo(()=>({width:n,height:r}),[n,r]);return n<=0||r<=0?null:D.createElement(uge.Provider,{value:i},e)}var L$=()=>D.useContext(uge),cet=D.forwardRef((t,e)=>{var{aspect:n,initialDimension:r={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:s,maxHeight:c,children:l,debounce:u=0,id:f,className:d,onResize:h,style:m={}}=t,p=D.useRef(null),y=D.useRef();y.current=h,D.useImperativeHandle(e,()=>p.current);var[x,S]=D.useState({containerWidth:r.width,containerHeight:r.height}),C=D.useCallback((I,V)=>{S(k=>{var L=Math.round(I),$=Math.round(V);return k.containerWidth===L&&k.containerHeight===$?k:{containerWidth:L,containerHeight:$}})},[]);D.useEffect(()=>{var I=$=>{var W,{width:G,height:oe}=$[0].contentRect;C(G,oe),(W=y.current)===null||W===void 0||W.call(y,G,oe)};u>0&&(I=QJe(I,u,{trailing:!0,leading:!1}));var V=new ResizeObserver(I),{width:k,height:L}=p.current.getBoundingClientRect();return C(k,L),V.observe(p.current),()=>{V.disconnect()}},[C,u]);var{containerWidth:_,containerHeight:T}=x;X_(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:O,calculatedHeight:M}=lge(_,T,{width:i,height:a,aspect:n,maxHeight:c});return X_(O>0||M>0,`The width(%s) and height(%s) of chart should be greater than 0,
       please check the style of container, or the props width(%s) and height(%s),
       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
       height and width.`,O,M,i,a,o,s,n),D.createElement("div",{id:f?"".concat(f):void 0,className:$r("recharts-responsive-container",d),style:UX(UX({},m),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:c}),ref:p},D.createElement("div",{style:ret({width:i,height:a})},D.createElement(fge,{width:O,height:M},l)))}),hC=D.forwardRef((t,e)=>{var n=L$();if(Py(n.width)&&Py(n.height))return t.children;var{width:r,height:i}=iet({width:t.width,height:t.height,aspect:t.aspect}),{calculatedWidth:a,calculatedHeight:o}=lge(void 0,void 0,{width:r,height:i,aspect:t.aspect,maxHeight:t.maxHeight});return qt(a)&&qt(o)?D.createElement(fge,{width:a,height:o},t.children):D.createElement(cet,XN({},t,{width:r,height:i,ref:e}))}),B8=()=>{var t,e=ac(),n=Jt(WJe),r=Jt(F8),i=(t=Jt(U8))===null||t===void 0?void 0:t.padding;return!e||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},uet={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},dge=()=>{var t;return(t=Jt(Vo))!==null&&t!==void 0?t:uet},V$=()=>Jt(Eh),$$=()=>Jt(Oh),fet=()=>Jt(t=>t.layout.margin),Nr=t=>t.layout.layoutType,z8=()=>Jt(Nr),G8=t=>{var e=Aa(),n=ac(),{width:r,height:i}=t,a=L$(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),D.useEffect(()=>{!n&&Py(o)&&Py(s)&&e(rJe({width:o,height:s}))},[e,n,o,s]),null},det={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},hge=Nl({name:"legend",initialState:det,reducers:{setLegendSize(t,e){t.size.width=e.payload.width,t.size.height=e.payload.height},setLegendSettings(t,e){t.settings.align=e.payload.align,t.settings.layout=e.payload.layout,t.settings.verticalAlign=e.payload.verticalAlign,t.settings.itemSorter=e.payload.itemSorter},addLegendPayload:{reducer(t,e){t.payload.push(e.payload)},prepare:Ws()},removeLegendPayload:{reducer(t,e){var n=Y0(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:Ws()}}}),{setLegendSize:FX,setLegendSettings:het,addLegendPayload:get,removeLegendPayload:pet}=hge.actions,met=hge.reducer,vet=["contextPayload"];function ZN(){return ZN=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},ZN.apply(null,arguments)}function BX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ky(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?BX(Object(n),!0).forEach(function(r){j$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):BX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function j$(t,e,n){return(e=yet(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yet(t){var e=xet(t,"string");return typeof e=="symbol"?e:e+""}function xet(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function wet(t,e){if(t==null)return{};var n,r,i=bet(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function bet(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Cet(t){return t.value}function _et(t){var{contextPayload:e}=t,n=wet(t,vet),r=Ehe(e,t.payloadUniqBy,Cet),i=ky(ky({},n),{},{payload:r});return D.isValidElement(t.content)?D.cloneElement(t.content,i):typeof t.content=="function"?D.createElement(t.content,i):D.createElement(E$,i)}function Tet(t,e,n,r,i,a){var{layout:o,align:s,verticalAlign:c}=e,l,u;return(!t||(t.left===void 0||t.left===null)&&(t.right===void 0||t.right===null))&&(s==="center"&&o==="vertical"?l={left:((r||0)-a.width)/2}:l=s==="right"?{right:n&&n.right||0}:{left:n&&n.left||0}),(!t||(t.top===void 0||t.top===null)&&(t.bottom===void 0||t.bottom===null))&&(c==="middle"?u={top:((i||0)-a.height)/2}:u=c==="bottom"?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),ky(ky({},l),u)}function Eet(t){var e=Aa();return D.useEffect(()=>{e(het(t))},[e,t]),null}function Oet(t){var e=Aa();return D.useEffect(()=>(e(FX(t)),()=>{e(FX({width:0,height:0}))}),[e,t]),null}function Det(t){var e=uQe(),n=yXe(),r=fet(),{width:i,height:a,wrapperStyle:o,portal:s}=t,[c,l]=Ihe([e]),u=V$(),f=$$();if(u==null||f==null)return null;var d=u-(r.left||0)-(r.right||0),h=W8.getWidthOrHeight(t.layout,a,i,d),m=s?o:ky(ky({position:"absolute",width:h?.width||i||"auto",height:h?.height||a||"auto"},Tet(o,t,r,u,f,c)),o),p=s??n;if(p==null)return null;var y=D.createElement("div",{className:"recharts-legend-wrapper",style:m,ref:l},D.createElement(Eet,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),D.createElement(Oet,{width:c.width,height:c.height}),D.createElement(_et,ZN({},t,h,{margin:r,chartWidth:u,chartHeight:f,contextPayload:e})));return x1.createPortal(y,p)}class W8 extends D.PureComponent{static getWidthOrHeight(e,n,r,i){return e==="vertical"&&qt(n)?{height:n}:e==="horizontal"?{width:r||i}:null}render(){return D.createElement(Det,this.props)}}j$(W8,"displayName","Legend");j$(W8,"defaultProps",{align:"center",iconSize:14,itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"});function QN(){return QN=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},QN.apply(null,arguments)}function zX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function CM(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zX(Object(n),!0).forEach(function(r){Met(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Met(t,e,n){return(e=Ret(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ret(t){var e=Iet(t,"string");return typeof e=="symbol"?e:e+""}function Iet(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Net(t){return Array.isArray(t)&&bd(t[0])&&bd(t[1])?t.join(" ~ "):t}var Pet=t=>{var{separator:e=" : ",contentStyle:n={},itemStyle:r={},labelStyle:i={},payload:a,formatter:o,itemSorter:s,wrapperClassName:c,labelClassName:l,label:u,labelFormatter:f,accessibilityLayer:d=!1}=t,h=()=>{if(a&&a.length){var T={padding:0,margin:0},O=(s?I8(a,s):a).map((M,I)=>{if(M.type==="none")return null;var V=M.formatter||o||Net,{value:k,name:L}=M,$=k,W=L;if(V){var G=V(k,L,M,I,a);if(Array.isArray(G))[$,W]=G;else if(G!=null)$=G;else return null}var oe=CM({display:"block",paddingTop:4,paddingBottom:4,color:M.color||"#000"},r);return D.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(I),style:oe},bd(W)?D.createElement("span",{className:"recharts-tooltip-item-name"},W):null,bd(W)?D.createElement("span",{className:"recharts-tooltip-item-separator"},e):null,D.createElement("span",{className:"recharts-tooltip-item-value"},$),D.createElement("span",{className:"recharts-tooltip-item-unit"},M.unit||""))});return D.createElement("ul",{className:"recharts-tooltip-item-list",style:T},O)}return null},m=CM({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),p=CM({margin:0},i),y=!ta(u),x=y?u:"",S=$r("recharts-default-tooltip",c),C=$r("recharts-tooltip-label",l);y&&f&&a!==void 0&&a!==null&&(x=f(u,a));var _=d?{role:"status","aria-live":"assertive"}:{};return D.createElement("div",QN({className:S,style:m},_),D.createElement("p",{className:C,style:p},D.isValidElement(x)?x:"".concat(x)),h())},jx="recharts-tooltip-wrapper",ket={visibility:"hidden"};function Aet(t){var{coordinate:e,translateX:n,translateY:r}=t;return $r(jx,{["".concat(jx,"-right")]:qt(n)&&e&&qt(e.x)&&n>=e.x,["".concat(jx,"-left")]:qt(n)&&e&&qt(e.x)&&n<e.x,["".concat(jx,"-bottom")]:qt(r)&&e&&qt(e.y)&&r>=e.y,["".concat(jx,"-top")]:qt(r)&&e&&qt(e.y)&&r<e.y})}function GX(t){var{allowEscapeViewBox:e,coordinate:n,key:r,offsetTopLeft:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:c,viewBoxDimension:l}=t;if(a&&qt(a[r]))return a[r];var u=n[r]-s-(i>0?i:0),f=n[r]+i;if(e[r])return o[r]?u:f;var d=c[r];if(d==null)return 0;if(o[r]){var h=u,m=d;return h<m?Math.max(f,d):Math.max(u,d)}if(l==null)return 0;var p=f+s,y=d+l;return p>y?Math.max(u,d):Math.max(f,d)}function Let(t){var{translateX:e,translateY:n,useTranslate3d:r}=t;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function Vet(t){var{allowEscapeViewBox:e,coordinate:n,offsetTopLeft:r,position:i,reverseDirection:a,tooltipBox:o,useTranslate3d:s,viewBox:c}=t,l,u,f;return o.height>0&&o.width>0&&n?(u=GX({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=GX({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),l=Let({translateX:u,translateY:f,useTranslate3d:s})):l=ket,{cssProperties:l,cssClasses:Aet({translateX:u,translateY:f,coordinate:n})}}function WX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function aS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?WX(Object(n),!0).forEach(function(r){JN(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):WX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function JN(t,e,n){return(e=$et(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $et(t){var e=jet(t,"string");return typeof e=="symbol"?e:e+""}function jet(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Uet extends D.PureComponent{constructor(){super(...arguments),JN(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),JN(this,"handleKeyDown",e=>{if(e.key==="Escape"){var n,r,i,a;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,n;this.state.dismissed&&(((e=this.props.coordinate)===null||e===void 0?void 0:e.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:a,coordinate:o,hasPayload:s,isAnimationActive:c,offset:l,position:u,reverseDirection:f,useTranslate3d:d,viewBox:h,wrapperStyle:m,lastBoundingBox:p,innerRef:y,hasPortalFromProps:x}=this.props,{cssClasses:S,cssProperties:C}=Vet({allowEscapeViewBox:n,coordinate:o,offsetTopLeft:l,position:u,reverseDirection:f,tooltipBox:{height:p.height,width:p.width},useTranslate3d:d,viewBox:h}),_=x?{}:aS(aS({transition:c&&e?"transform ".concat(r,"ms ").concat(i):void 0},C),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&s?"visible":"hidden",position:"absolute",top:0,left:0}),T=aS(aS({},_),{},{visibility:!this.state.dismissed&&e&&s?"visible":"hidden"},m);return D.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:S,style:T,ref:y},a)}}var Fet=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),_1={devToolsEnabled:!1,isSsr:Fet()},gge=()=>Jt(t=>t.rootProps.accessibilityLayer);function eP(){return eP=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},eP.apply(null,arguments)}function HX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function qX(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?HX(Object(n),!0).forEach(function(r){Bet(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):HX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Bet(t,e,n){return(e=zet(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zet(t){var e=Get(t,"string");return typeof e=="symbol"?e:e+""}function Get(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var KX={curveBasisClosed:VXe,curveBasisOpen:$Xe,curveBasis:LXe,curveBumpX:SXe,curveBumpY:CXe,curveLinearClosed:jXe,curveLinear:D8,curveMonotoneX:UXe,curveMonotoneY:FXe,curveNatural:BXe,curveStep:zXe,curveStepAfter:WXe,curveStepBefore:GXe},oS=t=>Za(t.x)&&Za(t.y),Ux=t=>t.x,Fx=t=>t.y,Wet=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(jb(t));return(n==="curveMonotone"||n==="curveBump")&&e?KX["".concat(n).concat(e==="vertical"?"Y":"X")]:KX[n]||D8},Het=t=>{var{type:e="linear",points:n=[],baseLine:r,layout:i,connectNulls:a=!1}=t,o=Wet(e,i),s=a?n.filter(oS):n,c;if(Array.isArray(r)){var l=a?r.filter(f=>oS(f)):r,u=s.map((f,d)=>qX(qX({},f),{},{base:l[d]}));return i==="vertical"?c=Q4().y(Fx).x1(Ux).x0(f=>f.base.x):c=Q4().x(Ux).y1(Fx).y0(f=>f.base.y),c.defined(oS).curve(o),c(u)}return i==="vertical"&&qt(r)?c=Q4().y(Fx).x1(Ux).x0(r):qt(r)?c=Q4().x(Ux).y1(Fx).y0(r):c=rhe().x(Ux).y(Fx),c.defined(oS).curve(o),c(s)},gC=t=>{var{className:e,points:n,path:r,pathRef:i}=t;if((!n||!n.length)&&!r)return null;var a=n&&n.length?Het(t):r;return D.createElement("path",eP({},bu(t),_$(t),{className:$r("recharts-curve",e),d:a===null?void 0:a,ref:i}))},qet=["x","y","top","left","width","height","className"];function tP(){return tP=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},tP.apply(null,arguments)}function YX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ket(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?YX(Object(n),!0).forEach(function(r){Yet(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):YX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Yet(t,e,n){return(e=Xet(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xet(t){var e=Zet(t,"string");return typeof e=="symbol"?e:e+""}function Zet(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qet(t,e){if(t==null)return{};var n,r,i=Jet(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Jet(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var ett=(t,e,n,r,i,a)=>"M".concat(t,",").concat(i,"v").concat(r,"M").concat(a,",").concat(e,"h").concat(n),ttt=t=>{var{x:e=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=t,c=Qet(t,qet),l=Ket({x:e,y:n,top:r,left:i,width:a,height:o},c);return!qt(e)||!qt(n)||!qt(a)||!qt(o)||!qt(r)||!qt(i)?null:D.createElement("path",tP({},Lc(l),{className:$r("recharts-cross",s),d:ett(e,n,a,o,r,i)}))};function ntt(t,e,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-i,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}function XX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rtt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?XX(Object(n),!0).forEach(function(r){itt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):XX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function itt(t,e,n){return(e=att(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function att(t){var e=ott(t,"string");return typeof e=="symbol"?e:e+""}function ott(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fc(t,e){var n=rtt({},t),r=e,i=Object.keys(e),a=i.reduce((o,s)=>(o[s]===void 0&&r[s]!==void 0&&(o[s]=r[s]),o),n);return a}function stt(){}function ctt(t){return t!=null}function ZX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function QX(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ZX(Object(n),!0).forEach(function(r){ltt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ZX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ltt(t,e,n){return(e=utt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function utt(t){var e=ftt(t,"string");return typeof e=="symbol"?e:e+""}function ftt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var dtt=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),pge=(t,e,n)=>t.map(r=>"".concat(dtt(r)," ").concat(e,"ms ").concat(n)).join(","),htt=(t,e)=>[Object.keys(t),Object.keys(e)].reduce((n,r)=>n.filter(i=>r.includes(i))),kw=(t,e)=>Object.keys(e).reduce((n,r)=>QX(QX({},n),{},{[r]:t(r,e[r])}),{});function JX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Zo(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?JX(Object(n),!0).forEach(function(r){gtt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):JX(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gtt(t,e,n){return(e=ptt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ptt(t){var e=mtt(t,"string");return typeof e=="symbol"?e:e+""}function mtt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Z_=(t,e,n)=>t+(e-t)*n,nP=t=>{var{from:e,to:n}=t;return e!==n},mge=(t,e,n)=>{var r=kw((i,a)=>{if(nP(a)){var[o,s]=t(a.from,a.to,a.velocity);return Zo(Zo({},a),{},{from:o,velocity:s})}return a},e);return n<1?kw((i,a)=>nP(a)?Zo(Zo({},a),{},{velocity:Z_(a.velocity,r[i].velocity,n),from:Z_(a.from,r[i].from,n)}):a,e):mge(t,r,n-1)};function vtt(t,e,n,r,i,a){var o,s=r.reduce((d,h)=>Zo(Zo({},d),{},{[h]:{from:t[h],velocity:0,to:e[h]}}),{}),c=()=>kw((d,h)=>h.from,s),l=()=>!Object.values(s).filter(nP).length,u=null,f=d=>{o||(o=d);var h=d-o,m=h/n.dt;s=mge(n,s,m),i(Zo(Zo(Zo({},t),e),c())),o=d,l()||(u=a.setTimeout(f))};return()=>(u=a.setTimeout(f),()=>{u()})}function ytt(t,e,n,r,i,a,o){var s=null,c=i.reduce((f,d)=>Zo(Zo({},f),{},{[d]:[t[d],e[d]]}),{}),l,u=f=>{l||(l=f);var d=(f-l)/r,h=kw((p,y)=>Z_(...y,n(d)),c);if(a(Zo(Zo(Zo({},t),e),h)),d<1)s=o.setTimeout(u);else{var m=kw((p,y)=>Z_(...y,n(1)),c);a(Zo(Zo(Zo({},t),e),m))}};return()=>(s=o.setTimeout(u),()=>{s()})}const xtt=(t,e,n,r,i,a)=>{var o=htt(t,e);return n.isStepper===!0?vtt(t,e,n,o,i,a):ytt(t,e,n,r,o,i,a)};var Q_=1e-4,vge=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],yge=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),eZ=(t,e)=>n=>{var r=vge(t,e);return yge(r,n)},wtt=(t,e)=>n=>{var r=vge(t,e),i=[...r.map((a,o)=>a*o).slice(1),0];return yge(i,n)},tZ=function(){for(var e,n,r,i,a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];if(o.length===1)switch(o[0]){case"linear":[e,r,n,i]=[0,0,1,1];break;case"ease":[e,r,n,i]=[.25,.1,.25,1];break;case"ease-in":[e,r,n,i]=[.42,0,1,1];break;case"ease-out":[e,r,n,i]=[.42,0,.58,1];break;case"ease-in-out":[e,r,n,i]=[0,0,.58,1];break;default:{var c=o[0].split("(");c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4&&([e,r,n,i]=c[1].split(")")[0].split(",").map(m=>parseFloat(m)))}}else o.length===4&&([e,r,n,i]=o);var l=eZ(e,n),u=eZ(r,i),f=wtt(e,n),d=m=>m>1?1:m<0?0:m,h=m=>{for(var p=m>1?1:m,y=p,x=0;x<8;++x){var S=l(y)-p,C=f(y);if(Math.abs(S-p)<Q_||C<Q_)return u(y);y=d(y-S/C)}return u(y)};return h.isStepper=!1,h},btt=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=e,a=(o,s,c)=>{var l=-(o-s)*n,u=c*r,f=c+(l-u)*i/1e3,d=c*i/1e3+o;return Math.abs(d-s)<Q_&&Math.abs(f)<Q_?[s,0]:[d,f]};return a.isStepper=!0,a.dt=i,a},Stt=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return tZ(t);case"spring":return btt();default:if(t.split("(")[0]==="cubic-bezier")return tZ(t)}return typeof t=="function"?t:null};function Ctt(t){var e,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var s=o,[c,...l]=s;if(typeof c=="number"){i=t.setTimeout(a.bind(null,l),c);return}a(c),i=t.setTimeout(a.bind(null,l));return}typeof o=="string"&&(e=o,n(e)),typeof o=="object"&&(e=o,n(e)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),a(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>t}}class _tt{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,a=o=>{o-r>=n?e(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(a))};return i=requestAnimationFrame(a),()=>{cancelAnimationFrame(i)}}}function Ttt(){return Ctt(new _tt)}var Ett=D.createContext(Ttt);function Ott(t,e){var n=D.useContext(Ett);return D.useMemo(()=>e??n(t),[t,e,n])}var Dtt={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},nZ={t:0},_M={t:1};function H8(t){var e=Fc(t,Dtt),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:s,onAnimationStart:c,children:l}=e,u=Ott(e.animationId,e.animationManager),[f,d]=D.useState(n?nZ:_M),h=D.useRef(null);return D.useEffect(()=>{n||d(_M)},[n]),D.useEffect(()=>{if(!n||!r)return stt;var m=xtt(nZ,_M,Stt(a),i,d,u.getTimeoutController()),p=()=>{h.current=m()};return u.start([c,o,p,i,s]),()=>{u.stop(),h.current&&h.current(),s()}},[n,r,i,a,o,c,s,u]),l(f.t)}function q8(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=D.useRef(Rw(e)),r=D.useRef(t);return r.current!==t&&(n.current=Rw(e),r.current=t),n.current}var Mtt=["radius"],Rtt=["radius"];function rZ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function iZ(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rZ(Object(n),!0).forEach(function(r){Itt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rZ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Itt(t,e,n){return(e=Ntt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ntt(t){var e=Ptt(t,"string");return typeof e=="symbol"?e:e+""}function Ptt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function J_(){return J_=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},J_.apply(null,arguments)}function aZ(t,e){if(t==null)return{};var n,r,i=ktt(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function ktt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var oZ=(t,e,n,r,i)=>{var a=Math.min(Math.abs(n)/2,Math.abs(r)/2),o=r>=0?1:-1,s=n>=0?1:-1,c=r>=0&&n>=0||r<0&&n<0?1:0,l;if(a>0&&i instanceof Array){for(var u=[0,0,0,0],f=0,d=4;f<d;f++)u[f]=i[f]>a?a:i[f];l="M".concat(t,",").concat(e+o*u[0]),u[0]>0&&(l+="A ".concat(u[0],",").concat(u[0],",0,0,").concat(c,",").concat(t+s*u[0],",").concat(e)),l+="L ".concat(t+n-s*u[1],",").concat(e),u[1]>0&&(l+="A ".concat(u[1],",").concat(u[1],",0,0,").concat(c,`,
        `).concat(t+n,",").concat(e+o*u[1])),l+="L ".concat(t+n,",").concat(e+r-o*u[2]),u[2]>0&&(l+="A ".concat(u[2],",").concat(u[2],",0,0,").concat(c,`,
        `).concat(t+n-s*u[2],",").concat(e+r)),l+="L ".concat(t+s*u[3],",").concat(e+r),u[3]>0&&(l+="A ".concat(u[3],",").concat(u[3],",0,0,").concat(c,`,
        `).concat(t,",").concat(e+r-o*u[3])),l+="Z"}else if(a>0&&i===+i&&i>0){var h=Math.min(a,i);l="M ".concat(t,",").concat(e+o*h,`
            A `).concat(h,",").concat(h,",0,0,").concat(c,",").concat(t+s*h,",").concat(e,`
            L `).concat(t+n-s*h,",").concat(e,`
            A `).concat(h,",").concat(h,",0,0,").concat(c,",").concat(t+n,",").concat(e+o*h,`
            L `).concat(t+n,",").concat(e+r-o*h,`
            A `).concat(h,",").concat(h,",0,0,").concat(c,",").concat(t+n-s*h,",").concat(e+r,`
            L `).concat(t+s*h,",").concat(e+r,`
            A `).concat(h,",").concat(h,",0,0,").concat(c,",").concat(t,",").concat(e+r-o*h," Z")}else l="M ".concat(t,",").concat(e," h ").concat(n," v ").concat(r," h ").concat(-n," Z");return l},Att={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},xge=t=>{var e=Fc(t,Att),n=D.useRef(null),[r,i]=D.useState(-1);D.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var Y=n.current.getTotalLength();Y&&i(Y)}catch{}},[]);var{x:a,y:o,width:s,height:c,radius:l,className:u}=e,{animationEasing:f,animationDuration:d,animationBegin:h,isAnimationActive:m,isUpdateAnimationActive:p}=e,y=D.useRef(s),x=D.useRef(c),S=D.useRef(a),C=D.useRef(o),_=D.useMemo(()=>({x:a,y:o,width:s,height:c,radius:l}),[a,o,s,c,l]),T=q8(_,"rectangle-");if(a!==+a||o!==+o||s!==+s||c!==+c||s===0||c===0)return null;var O=$r("recharts-rectangle",u);if(!p){var M=Lc(e),{radius:I}=M,V=aZ(M,Mtt);return D.createElement("path",J_({},V,{radius:typeof l=="number"?l:void 0,className:O,d:oZ(a,o,s,c,l)}))}var k=y.current,L=x.current,$=S.current,W=C.current,G="0px ".concat(r===-1?1:r,"px"),oe="".concat(r,"px 0px"),U=pge(["strokeDasharray"],d,typeof f=="string"?f:void 0);return D.createElement(H8,{animationId:T,key:T,canBegin:r>0,duration:d,easing:f,isActive:p,begin:h},Y=>{var J=Ia(k,s,Y),ne=Ia(L,c,Y),F=Ia($,a,Y),ae=Ia(W,o,Y);n.current&&(y.current=J,x.current=ne,S.current=F,C.current=ae);var re;m?Y>0?re={transition:U,strokeDasharray:oe}:re={strokeDasharray:G}:re={strokeDasharray:oe};var te=Lc(e),{radius:ye}=te,we=aZ(te,Rtt);return D.createElement("path",J_({},we,{radius:typeof l=="number"?l:void 0,className:O,d:oZ(F,ae,J,ne,l),ref:n,style:iZ(iZ({},re),e.style)}))})};function wge(t){var{cx:e,cy:n,radius:r,startAngle:i,endAngle:a}=t,o=ts(e,n,r,i),s=ts(e,n,r,a);return{points:[o,s],cx:e,cy:n,radius:r,startAngle:i,endAngle:a}}function rP(){return rP=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},rP.apply(null,arguments)}var Ltt=(t,e)=>{var n=Rc(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},sS=t=>{var{cx:e,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:s,cornerIsExternal:c}=t,l=s*(o?1:-1)+r,u=Math.asin(s/l)/Y_,f=c?i:i+a*u,d=ts(e,n,l,f),h=ts(e,n,r,f),m=c?i-a*u:i,p=ts(e,n,l*Math.cos(u*Y_),m);return{center:d,circleTangency:h,lineTangency:p,theta:u}},bge=t=>{var{cx:e,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=t,s=Ltt(a,o),c=a+s,l=ts(e,n,i,a),u=ts(e,n,i,c),f="M ".concat(l.x,",").concat(l.y,`
    A `).concat(i,",").concat(i,`,0,
    `).concat(+(Math.abs(s)>180),",").concat(+(a>c),`,
    `).concat(u.x,",").concat(u.y,`
  `);if(r>0){var d=ts(e,n,r,a),h=ts(e,n,r,c);f+="L ".concat(h.x,",").concat(h.y,`
            A `).concat(r,",").concat(r,`,0,
            `).concat(+(Math.abs(s)>180),",").concat(+(a<=c),`,
            `).concat(d.x,",").concat(d.y," Z")}else f+="L ".concat(e,",").concat(n," Z");return f},Vtt=t=>{var{cx:e,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:s,startAngle:c,endAngle:l}=t,u=Rc(l-c),{circleTangency:f,lineTangency:d,theta:h}=sS({cx:e,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:m,lineTangency:p,theta:y}=sS({cx:e,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),x=s?Math.abs(c-l):Math.abs(c-l)-h-y;if(x<0)return o?"M ".concat(d.x,",").concat(d.y,`
        a`).concat(a,",").concat(a,",0,0,1,").concat(a*2,`,0
        a`).concat(a,",").concat(a,",0,0,1,").concat(-a*2,`,0
      `):bge({cx:e,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var S="M ".concat(d.x,",").concat(d.y,`
    A`).concat(a,",").concat(a,",0,0,").concat(+(u<0),",").concat(f.x,",").concat(f.y,`
    A`).concat(i,",").concat(i,",0,").concat(+(x>180),",").concat(+(u<0),",").concat(m.x,",").concat(m.y,`
    A`).concat(a,",").concat(a,",0,0,").concat(+(u<0),",").concat(p.x,",").concat(p.y,`
  `);if(r>0){var{circleTangency:C,lineTangency:_,theta:T}=sS({cx:e,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:O,lineTangency:M,theta:I}=sS({cx:e,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),V=s?Math.abs(c-l):Math.abs(c-l)-T-I;if(V<0&&a===0)return"".concat(S,"L").concat(e,",").concat(n,"Z");S+="L".concat(M.x,",").concat(M.y,`
      A`).concat(a,",").concat(a,",0,0,").concat(+(u<0),",").concat(O.x,",").concat(O.y,`
      A`).concat(r,",").concat(r,",0,").concat(+(V>180),",").concat(+(u>0),",").concat(C.x,",").concat(C.y,`
      A`).concat(a,",").concat(a,",0,0,").concat(+(u<0),",").concat(_.x,",").concat(_.y,"Z")}else S+="L".concat(e,",").concat(n,"Z");return S},$tt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Sge=t=>{var e=Fc(t,$tt),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u,className:f}=e;if(a<i||l===u)return null;var d=$r("recharts-sector",f),h=a-i,m=pf(o,h,0,!0),p;return m>0&&Math.abs(l-u)<360?p=Vtt({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,h/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):p=bge({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u}),D.createElement("path",rP({},Lc(e),{className:d,d:p}))};function jtt(t,e,n){var r,i,a,o;if(t==="horizontal")r=e.x,a=r,i=n.top,o=n.top+n.height;else if(t==="vertical")i=e.y,o=i,r=n.left,a=n.left+n.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var{cx:s,cy:c,innerRadius:l,outerRadius:u,angle:f}=e,d=ts(s,c,l,f),h=ts(s,c,u,f);r=d.x,i=d.y,a=h.x,o=h.y}else return wge(e);return[{x:r,y:i},{x:a,y:o}]}var TM={},EM={},OM={},sZ;function Utt(){return sZ||(sZ=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Dhe();function n(r){return e.isSymbol(r)?NaN:Number(r)}t.toNumber=n})(OM)),OM}var cZ;function Ftt(){return cZ||(cZ=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Utt();function n(r){return r?(r=e.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}t.toFinite=n})(EM)),EM}var lZ;function Btt(){return lZ||(lZ=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Mhe(),n=Ftt();function r(i,a,o){o&&typeof o!="number"&&e.isIterateeCall(i,a,o)&&(a=o=void 0),i=n.toFinite(i),a===void 0?(a=i,i=0):a=n.toFinite(a),o=o===void 0?i<a?1:-1:n.toFinite(o);const s=Math.max(Math.ceil((a-i)/(o||1)),0),c=new Array(s);for(let l=0;l<s;l++)c[l]=i,i+=o;return c}t.range=r})(TM)),TM}var DM,uZ;function ztt(){return uZ||(uZ=1,DM=Btt().range),DM}var Gtt=ztt();const Cge=ka(Gtt);function Vg(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Wtt(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function U$(t){let e,n,r;t.length!==2?(e=Vg,n=(s,c)=>Vg(t(s),c),r=(s,c)=>t(s)-c):(e=t===Vg||t===Wtt?t:Htt,n=t,r=t);function i(s,c,l=0,u=s.length){if(l<u){if(e(c,c)!==0)return u;do{const f=l+u>>>1;n(s[f],c)<0?l=f+1:u=f}while(l<u)}return l}function a(s,c,l=0,u=s.length){if(l<u){if(e(c,c)!==0)return u;do{const f=l+u>>>1;n(s[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function o(s,c,l=0,u=s.length){const f=i(s,c,l,u-1);return f>l&&r(s[f-1],c)>-r(s[f],c)?f-1:f}return{left:i,center:o,right:a}}function Htt(){return 0}function _ge(t){return t===null?NaN:+t}function*qtt(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const Ktt=U$(Vg),zb=Ktt.right;U$(_ge).center;class fZ extends Map{constructor(e,n=Ztt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(dZ(this,e))}has(e){return super.has(dZ(this,e))}set(e,n){return super.set(Ytt(this,e),n)}delete(e){return super.delete(Xtt(this,e))}}function dZ({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function Ytt({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function Xtt({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function Ztt(t){return t!==null&&typeof t=="object"?t.valueOf():t}function Qtt(t=Vg){if(t===Vg)return Tge;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function Tge(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const Jtt=Math.sqrt(50),ent=Math.sqrt(10),tnt=Math.sqrt(2);function eT(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=Jtt?10:a>=ent?5:a>=tnt?2:1;let s,c,l;return i<0?(l=Math.pow(10,-i)/o,s=Math.round(t*l),c=Math.round(e*l),s/l<t&&++s,c/l>e&&--c,l=-l):(l=Math.pow(10,i)*o,s=Math.round(t/l),c=Math.round(e/l),s*l<t&&++s,c*l>e&&--c),c<s&&.5<=n&&n<2?eT(t,e,n*2):[s,c,l]}function iP(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[i,a,o]=r?eT(e,t,n):eT(t,e,n);if(!(a>=i))return[];const s=a-i+1,c=new Array(s);if(r)if(o<0)for(let l=0;l<s;++l)c[l]=(a-l)/-o;else for(let l=0;l<s;++l)c[l]=(a-l)*o;else if(o<0)for(let l=0;l<s;++l)c[l]=(i+l)/-o;else for(let l=0;l<s;++l)c[l]=(i+l)*o;return c}function aP(t,e,n){return e=+e,t=+t,n=+n,eT(t,e,n)[2]}function oP(t,e,n){e=+e,t=+t,n=+n;const r=e<t,i=r?aP(e,t,n):aP(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function hZ(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function sP(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function Ege(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?Tge:Qtt(i);r>n;){if(r-n>600){const c=r-n+1,l=e-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(n,Math.floor(e-l*f/c+d)),m=Math.min(r,Math.floor(e+(c-l)*f/c+d));Ege(t,e,h,m,i)}const a=t[e];let o=n,s=r;for(Bx(t,n,e),i(t[r],a)>0&&Bx(t,n,r);o<s;){for(Bx(t,o,s),++o,--s;i(t[o],a)<0;)++o;for(;i(t[s],a)>0;)--s}i(t[n],a)===0?Bx(t,n,s):(++s,Bx(t,s,r)),s<=e&&(n=s+1),e<=s&&(r=s-1)}return t}function Bx(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function nnt(t,e,n){if(t=Float64Array.from(qtt(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return sP(t);if(e>=1)return hZ(t);var r,i=(r-1)*e,a=Math.floor(i),o=hZ(Ege(t,a).subarray(0,a+1)),s=sP(t.subarray(a+1));return o+(s-o)*(i-a)}}function rnt(t,e,n=_ge){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,a=Math.floor(i),o=+n(t[a],a,t),s=+n(t[a+1],a+1,t);return o+(s-o)*(i-a)}}function int(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,a=new Array(i);++r<i;)a[r]=t+r*n;return a}function ant(t){if(!(a=t.length))return[];for(var e=-1,n=sP(t,ont),r=new Array(n);++e<n;)for(var i=-1,a,o=r[e]=new Array(a);++i<a;)o[i]=t[i][e];return r}function ont(t){return t.length}function gZ(){return ant(arguments)}function Ou(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Dh(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const cP=Symbol("implicit");function F$(){var t=new fZ,e=[],n=[],r=cP;function i(a){let o=t.get(a);if(o===void 0){if(r!==cP)return r;t.set(a,o=e.push(a)-1)}return n[o%n.length]}return i.domain=function(a){if(!arguments.length)return e.slice();e=[],t=new fZ;for(const o of a)t.has(o)||t.set(o,e.push(o)-1);return i},i.range=function(a){return arguments.length?(n=Array.from(a),i):n.slice()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return F$(e,n).unknown(r)},Ou.apply(i,arguments),i}function B$(){var t=F$().unknown(void 0),e=t.domain,n=t.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete t.unknown;function f(){var d=e().length,h=i<r,m=h?i:r,p=h?r:i;a=(p-m)/Math.max(1,d-c+l*2),s&&(a=Math.floor(a)),m+=(p-m-a*(d-c))*u,o=a*(1-c),s&&(m=Math.round(m),o=Math.round(o));var y=int(d).map(function(x){return m+a*x});return n(h?y.reverse():y)}return t.domain=function(d){return arguments.length?(e(d),f()):e()},t.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},t.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,s=!0,f()},t.bandwidth=function(){return o},t.step=function(){return a},t.round=function(d){return arguments.length?(s=!!d,f()):s},t.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},t.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},t.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},t.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},t.copy=function(){return B$(e(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},Ou.apply(f(),arguments)}function Oge(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return Oge(e())},t}function snt(){return Oge(B$.apply(null,arguments).paddingInner(1))}function z$(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Dge(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Gb(){}var Aw=.7,tT=1/Aw,ly="\\s*([+-]?\\d+)\\s*",Lw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",hd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",cnt=/^#([0-9a-f]{3,8})$/,lnt=new RegExp(`^rgb\\(${ly},${ly},${ly}\\)$`),unt=new RegExp(`^rgb\\(${hd},${hd},${hd}\\)$`),fnt=new RegExp(`^rgba\\(${ly},${ly},${ly},${Lw}\\)$`),dnt=new RegExp(`^rgba\\(${hd},${hd},${hd},${Lw}\\)$`),hnt=new RegExp(`^hsl\\(${Lw},${hd},${hd}\\)$`),gnt=new RegExp(`^hsla\\(${Lw},${hd},${hd},${Lw}\\)$`),pZ={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};z$(Gb,Vw,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:mZ,formatHex:mZ,formatHex8:pnt,formatHsl:mnt,formatRgb:vZ,toString:vZ});function mZ(){return this.rgb().formatHex()}function pnt(){return this.rgb().formatHex8()}function mnt(){return Mge(this).formatHsl()}function vZ(){return this.rgb().formatRgb()}function Vw(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=cnt.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?yZ(e):n===3?new Ic(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?cS(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?cS(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=lnt.exec(t))?new Ic(e[1],e[2],e[3],1):(e=unt.exec(t))?new Ic(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=fnt.exec(t))?cS(e[1],e[2],e[3],e[4]):(e=dnt.exec(t))?cS(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=hnt.exec(t))?bZ(e[1],e[2]/100,e[3]/100,1):(e=gnt.exec(t))?bZ(e[1],e[2]/100,e[3]/100,e[4]):pZ.hasOwnProperty(t)?yZ(pZ[t]):t==="transparent"?new Ic(NaN,NaN,NaN,0):null}function yZ(t){return new Ic(t>>16&255,t>>8&255,t&255,1)}function cS(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ic(t,e,n,r)}function vnt(t){return t instanceof Gb||(t=Vw(t)),t?(t=t.rgb(),new Ic(t.r,t.g,t.b,t.opacity)):new Ic}function lP(t,e,n,r){return arguments.length===1?vnt(t):new Ic(t,e,n,r??1)}function Ic(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}z$(Ic,lP,Dge(Gb,{brighter(t){return t=t==null?tT:Math.pow(tT,t),new Ic(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Aw:Math.pow(Aw,t),new Ic(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ic(Pm(this.r),Pm(this.g),Pm(this.b),nT(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:xZ,formatHex:xZ,formatHex8:ynt,formatRgb:wZ,toString:wZ}));function xZ(){return`#${wm(this.r)}${wm(this.g)}${wm(this.b)}`}function ynt(){return`#${wm(this.r)}${wm(this.g)}${wm(this.b)}${wm((isNaN(this.opacity)?1:this.opacity)*255)}`}function wZ(){const t=nT(this.opacity);return`${t===1?"rgb(":"rgba("}${Pm(this.r)}, ${Pm(this.g)}, ${Pm(this.b)}${t===1?")":`, ${t})`}`}function nT(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Pm(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function wm(t){return t=Pm(t),(t<16?"0":"")+t.toString(16)}function bZ(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ef(t,e,n,r)}function Mge(t){if(t instanceof ef)return new ef(t.h,t.s,t.l,t.opacity);if(t instanceof Gb||(t=Vw(t)),!t)return new ef;if(t instanceof ef)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(e===a?o=(n-r)/s+(n<r)*6:n===a?o=(r-e)/s+2:o=(e-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new ef(o,s,c,t.opacity)}function xnt(t,e,n,r){return arguments.length===1?Mge(t):new ef(t,e,n,r??1)}function ef(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}z$(ef,xnt,Dge(Gb,{brighter(t){return t=t==null?tT:Math.pow(tT,t),new ef(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Aw:Math.pow(Aw,t),new ef(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Ic(MM(t>=240?t-240:t+120,i,r),MM(t,i,r),MM(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new ef(SZ(this.h),lS(this.s),lS(this.l),nT(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=nT(this.opacity);return`${t===1?"hsl(":"hsla("}${SZ(this.h)}, ${lS(this.s)*100}%, ${lS(this.l)*100}%${t===1?")":`, ${t})`}`}}));function SZ(t){return t=(t||0)%360,t<0?t+360:t}function lS(t){return Math.max(0,Math.min(1,t||0))}function MM(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}function wnt(t,e,n,r,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*e+(4-6*a+3*o)*n+(1+3*t+3*a-3*o)*r+o*i)/6}function RM(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],o=r>0?t[r-1]:2*i-a,s=r<e-1?t[r+2]:2*a-i;return wnt((n-r/e)*e,o,i,a,s)}}const G$=t=>()=>t;function bnt(t,e){return function(n){return t+n*e}}function Snt(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Cnt(t){return(t=+t)==1?Rge:function(e,n){return n-e?Snt(e,n,t):G$(isNaN(e)?n:e)}}function Rge(t,e){var n=e-t;return n?bnt(t,n):G$(isNaN(t)?e:t)}const CZ=(function t(e){var n=Cnt(e);function r(i,a){var o=n((i=lP(i)).r,(a=lP(a)).r),s=n(i.g,a.g),c=n(i.b,a.b),l=Rge(i.opacity,a.opacity);return function(u){return i.r=o(u),i.g=s(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=t,r})(1);function _nt(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=t[i]*(1-a)+e[i]*a;return r}}function Tnt(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Ent(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),a=new Array(n),o;for(o=0;o<r;++o)i[o]=w2(t[o],e[o]);for(;o<n;++o)a[o]=e[o];return function(s){for(o=0;o<r;++o)a[o]=i[o](s);return a}}function Ont(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function rT(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Dnt(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=w2(t[i],e[i]):r[i]=e[i];return function(a){for(i in n)r[i]=n[i](a);return r}}var uP=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,IM=new RegExp(uP.source,"g");function Mnt(t){return function(){return t}}function Rnt(t){return function(e){return t(e)+""}}function Int(t,e){var n=uP.lastIndex=IM.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(t=t+"",e=e+"";(r=uP.exec(t))&&(i=IM.exec(e));)(a=i.index)>n&&(a=e.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:rT(r,i)})),n=IM.lastIndex;return n<e.length&&(a=e.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?Rnt(c[0].x):Mnt(e):(e=c.length,function(l){for(var u=0,f;u<e;++u)s[(f=c[u]).i]=f.x(l);return s.join("")})}function w2(t,e){var n=typeof e,r;return e==null||n==="boolean"?G$(e):(n==="number"?rT:n==="string"?(r=Vw(e))?(e=r,CZ):Int:e instanceof Vw?CZ:e instanceof Date?Ont:Tnt(e)?_nt:Array.isArray(e)?Ent:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Dnt:rT)(t,e)}function W$(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Nnt(t,e){e===void 0&&(e=t,t=w2);for(var n=0,r=e.length-1,i=e[0],a=new Array(r<0?0:r);n<r;)a[n]=t(i,i=e[++n]);return function(o){var s=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return a[s](o-s)}}function zx(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}function Pnt(t){return function(){return t}}function iT(t){return+t}var _Z=[0,1];function Qs(t){return t}function fP(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:Pnt(isNaN(e)?NaN:.5)}function knt(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function Ant(t,e,n){var r=t[0],i=t[1],a=e[0],o=e[1];return i<r?(r=fP(i,r),a=n(o,a)):(r=fP(r,i),a=n(a,o)),function(s){return a(r(s))}}function Lnt(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),a=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)i[o]=fP(t[o],t[o+1]),a[o]=n(e[o],e[o+1]);return function(s){var c=zb(t,s,1,r)-1;return a[c](i[c](s))}}function Wb(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function K8(){var t=_Z,e=_Z,n=w2,r,i,a,o=Qs,s,c,l;function u(){var d=Math.min(t.length,e.length);return o!==Qs&&(o=knt(t[0],t[d-1])),s=d>2?Lnt:Ant,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?a:(c||(c=s(t.map(r),e,n)))(r(o(d)))}return f.invert=function(d){return o(i((l||(l=s(e,t.map(r),rT)))(d)))},f.domain=function(d){return arguments.length?(t=Array.from(d,iT),u()):t.slice()},f.range=function(d){return arguments.length?(e=Array.from(d),u()):e.slice()},f.rangeRound=function(d){return e=Array.from(d),n=W$,u()},f.clamp=function(d){return arguments.length?(o=d?!0:Qs,u()):o!==Qs},f.interpolate=function(d){return arguments.length?(n=d,u()):n},f.unknown=function(d){return arguments.length?(a=d,f):a},function(d,h){return r=d,i=h,u()}}function H$(){return K8()(Qs,Qs)}function Vnt(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function aT(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Ay(t){return t=aT(Math.abs(t)),t?t[1]:NaN}function $nt(t,e){return function(n,r){for(var i=n.length,a=[],o=0,s=t[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=t[o=(o+1)%t.length];return a.reverse().join(e)}}function jnt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Unt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $w(t){if(!(e=Unt.exec(t)))throw new Error("invalid format: "+t);var e;return new q$({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}$w.prototype=q$.prototype;function q$(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}q$.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Fnt(t){e:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Ige;function Bnt(t,e){var n=aT(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-(Ige=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+aT(t,Math.max(0,e+a-1))[0]}function TZ(t,e){var n=aT(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const EZ={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Vnt,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>TZ(t*100,e),r:TZ,s:Bnt,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function OZ(t){return t}var DZ=Array.prototype.map,MZ=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function znt(t){var e=t.grouping===void 0||t.thousands===void 0?OZ:$nt(DZ.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?OZ:jnt(DZ.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",s=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function l(f){f=$w(f);var d=f.fill,h=f.align,m=f.sign,p=f.symbol,y=f.zero,x=f.width,S=f.comma,C=f.precision,_=f.trim,T=f.type;T==="n"?(S=!0,T="g"):EZ[T]||(C===void 0&&(C=12),_=!0,T="g"),(y||d==="0"&&h==="=")&&(y=!0,d="0",h="=");var O=p==="$"?n:p==="#"&&/[boxX]/.test(T)?"0"+T.toLowerCase():"",M=p==="$"?r:/[%p]/.test(T)?o:"",I=EZ[T],V=/[defgprs%]/.test(T);C=C===void 0?6:/[gprs]/.test(T)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function k(L){var $=O,W=M,G,oe,U;if(T==="c")W=I(L)+W,L="";else{L=+L;var Y=L<0||1/L<0;if(L=isNaN(L)?c:I(Math.abs(L),C),_&&(L=Fnt(L)),Y&&+L==0&&m!=="+"&&(Y=!1),$=(Y?m==="("?m:s:m==="-"||m==="("?"":m)+$,W=(T==="s"?MZ[8+Ige/3]:"")+W+(Y&&m==="("?")":""),V){for(G=-1,oe=L.length;++G<oe;)if(U=L.charCodeAt(G),48>U||U>57){W=(U===46?i+L.slice(G+1):L.slice(G))+W,L=L.slice(0,G);break}}}S&&!y&&(L=e(L,1/0));var J=$.length+L.length+W.length,ne=J<x?new Array(x-J+1).join(d):"";switch(S&&y&&(L=e(ne+L,ne.length?x-W.length:1/0),ne=""),h){case"<":L=$+L+W+ne;break;case"=":L=$+ne+L+W;break;case"^":L=ne.slice(0,J=ne.length>>1)+$+L+W+ne.slice(J);break;default:L=ne+$+L+W;break}return a(L)}return k.toString=function(){return f+""},k}function u(f,d){var h=l((f=$w(f),f.type="f",f)),m=Math.max(-8,Math.min(8,Math.floor(Ay(d)/3)))*3,p=Math.pow(10,-m),y=MZ[8+m/3];return function(x){return h(p*x)+y}}return{format:l,formatPrefix:u}}var uS,K$,Nge;Gnt({thousands:",",grouping:[3],currency:["$",""]});function Gnt(t){return uS=znt(t),K$=uS.format,Nge=uS.formatPrefix,uS}function Wnt(t){return Math.max(0,-Ay(Math.abs(t)))}function Hnt(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ay(e)/3)))*3-Ay(Math.abs(t)))}function qnt(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ay(e)-Ay(t))+1}function Pge(t,e,n,r){var i=oP(t,e,n),a;switch(r=$w(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(a=Hnt(i,o))&&(r.precision=a),Nge(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=qnt(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=Wnt(i))&&(r.precision=a-(r.type==="%")*2);break}}return K$(r)}function yp(t){var e=t.domain;return t.ticks=function(n){var r=e();return iP(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return Pge(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-- >0;){if(l=aP(o,s,n),l===c)return r[i]=o,r[a]=s,e(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return t},t}function kge(){var t=H$();return t.copy=function(){return Wb(t,kge())},Ou.apply(t,arguments),yp(t)}function Age(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,iT),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return Age(t).unknown(e)},t=arguments.length?Array.from(t,iT):[0,1],yp(n)}function Lge(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],a=t[r],o;return a<i&&(o=n,n=r,r=o,o=i,i=a,a=o),t[n]=e.floor(i),t[r]=e.ceil(a),t}function RZ(t){return Math.log(t)}function IZ(t){return Math.exp(t)}function Knt(t){return-Math.log(-t)}function Ynt(t){return-Math.exp(-t)}function Xnt(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Znt(t){return t===10?Xnt:t===Math.E?Math.exp:e=>Math.pow(t,e)}function Qnt(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function NZ(t){return(e,n)=>-t(-e,n)}function Y$(t){const e=t(RZ,IZ),n=e.domain;let r=10,i,a;function o(){return i=Qnt(r),a=Znt(r),n()[0]<0?(i=NZ(i),a=NZ(a),t(Knt,Ynt)):t(RZ,IZ),e}return e.base=function(s){return arguments.length?(r=+s,o()):r},e.domain=function(s){return arguments.length?(n(s),o()):n()},e.ticks=s=>{const c=n();let l=c[0],u=c[c.length-1];const f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),m,p;const y=s==null?10:+s;let x=[];if(!(r%1)&&h-d<y){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(m=1;m<r;++m)if(p=d<0?m/a(-d):m*a(d),!(p<l)){if(p>u)break;x.push(p)}}else for(;d<=h;++d)for(m=r-1;m>=1;--m)if(p=d>0?m/a(-d):m*a(d),!(p<l)){if(p>u)break;x.push(p)}x.length*2<y&&(x=iP(l,u,y))}else x=iP(d,h,Math.min(h-d,y)).map(a);return f?x.reverse():x},e.tickFormat=(s,c)=>{if(s==null&&(s=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=$w(c)).precision==null&&(c.trim=!0),c=K$(c)),s===1/0)return c;const l=Math.max(1,r*s/e.ticks().length);return u=>{let f=u/a(Math.round(i(u)));return f*r<r-.5&&(f*=r),f<=l?c(u):""}},e.nice=()=>n(Lge(n(),{floor:s=>a(Math.floor(i(s))),ceil:s=>a(Math.ceil(i(s)))})),e}function Vge(){const t=Y$(K8()).domain([1,10]);return t.copy=()=>Wb(t,Vge()).base(t.base()),Ou.apply(t,arguments),t}function PZ(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function kZ(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function X$(t){var e=1,n=t(PZ(e),kZ(e));return n.constant=function(r){return arguments.length?t(PZ(e=+r),kZ(e)):e},yp(n)}function $ge(){var t=X$(K8());return t.copy=function(){return Wb(t,$ge()).constant(t.constant())},Ou.apply(t,arguments)}function AZ(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Jnt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function ert(t){return t<0?-t*t:t*t}function Z$(t){var e=t(Qs,Qs),n=1;function r(){return n===1?t(Qs,Qs):n===.5?t(Jnt,ert):t(AZ(n),AZ(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},yp(e)}function Q$(){var t=Z$(K8());return t.copy=function(){return Wb(t,Q$()).exponent(t.exponent())},Ou.apply(t,arguments),t}function trt(){return Q$.apply(null,arguments).exponent(.5)}function LZ(t){return Math.sign(t)*t*t}function nrt(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function jge(){var t=H$(),e=[0,1],n=!1,r;function i(a){var o=nrt(t(a));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(a){return t.invert(LZ(a))},i.domain=function(a){return arguments.length?(t.domain(a),i):t.domain()},i.range=function(a){return arguments.length?(t.range((e=Array.from(a,iT)).map(LZ)),i):e.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(n=!!a,i):n},i.clamp=function(a){return arguments.length?(t.clamp(a),i):t.clamp()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return jge(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Ou.apply(i,arguments),yp(i)}function Uge(){var t=[],e=[],n=[],r;function i(){var o=0,s=Math.max(1,e.length);for(n=new Array(s-1);++o<s;)n[o-1]=rnt(t,o/s);return a}function a(o){return o==null||isNaN(o=+o)?r:e[zb(n,o)]}return a.invertExtent=function(o){var s=e.indexOf(o);return s<0?[NaN,NaN]:[s>0?n[s-1]:t[0],s<n.length?n[s]:t[t.length-1]]},a.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let s of o)s!=null&&!isNaN(s=+s)&&t.push(s);return t.sort(Vg),i()},a.range=function(o){return arguments.length?(e=Array.from(o),i()):e.slice()},a.unknown=function(o){return arguments.length?(r=o,a):r},a.quantiles=function(){return n.slice()},a.copy=function(){return Uge().domain(t).range(e).unknown(r)},Ou.apply(a,arguments)}function Fge(){var t=0,e=1,n=1,r=[.5],i=[0,1],a;function o(c){return c!=null&&c<=c?i[zb(r,c,0,n)]:a}function s(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*e-(c-n)*t)/(n+1);return o}return o.domain=function(c){return arguments.length?([t,e]=c,t=+t,e=+e,s()):[t,e]},o.range=function(c){return arguments.length?(n=(i=Array.from(c)).length-1,s()):i.slice()},o.invertExtent=function(c){var l=i.indexOf(c);return l<0?[NaN,NaN]:l<1?[t,r[0]]:l>=n?[r[n-1],e]:[r[l-1],r[l]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Fge().domain([t,e]).range(i).unknown(a)},Ou.apply(yp(o),arguments)}function Bge(){var t=[.5],e=[0,1],n,r=1;function i(a){return a!=null&&a<=a?e[zb(t,a,0,r)]:n}return i.domain=function(a){return arguments.length?(t=Array.from(a),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(a){return arguments.length?(e=Array.from(a),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(a){var o=e.indexOf(a);return[t[o-1],t[o]]},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return Bge().domain(t).range(e).unknown(n)},Ou.apply(i,arguments)}const NM=new Date,PM=new Date;function po(t,e,n,r){function i(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(t(a=new Date(+a)),a),i.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),i.round=a=>{const o=i(a),s=i.ceil(a);return a-o<s-a?o:s},i.offset=(a,o)=>(e(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,s)=>{const c=[];if(a=i.ceil(a),s=s==null?1:Math.floor(s),!(a<o)||!(s>0))return c;let l;do c.push(l=new Date(+a)),e(a,s),t(a);while(l<a&&a<o);return c},i.filter=a=>po(o=>{if(o>=o)for(;t(o),!a(o);)o.setTime(o-1)},(o,s)=>{if(o>=o)if(s<0)for(;++s<=0;)for(;e(o,-1),!a(o););else for(;--s>=0;)for(;e(o,1),!a(o););}),n&&(i.count=(a,o)=>(NM.setTime(+a),PM.setTime(+o),t(NM),t(PM),Math.floor(n(NM,PM))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(r?o=>r(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const oT=po(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);oT.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?po(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):oT);oT.range;const $0=1e3,pu=$0*60,j0=pu*60,ph=j0*24,J$=ph*7,VZ=ph*30,kM=ph*365,bm=po(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*$0)},(t,e)=>(e-t)/$0,t=>t.getUTCSeconds());bm.range;const ej=po(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*$0)},(t,e)=>{t.setTime(+t+e*pu)},(t,e)=>(e-t)/pu,t=>t.getMinutes());ej.range;const tj=po(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*pu)},(t,e)=>(e-t)/pu,t=>t.getUTCMinutes());tj.range;const nj=po(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*$0-t.getMinutes()*pu)},(t,e)=>{t.setTime(+t+e*j0)},(t,e)=>(e-t)/j0,t=>t.getHours());nj.range;const rj=po(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*j0)},(t,e)=>(e-t)/j0,t=>t.getUTCHours());rj.range;const Hb=po(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*pu)/ph,t=>t.getDate()-1);Hb.range;const Y8=po(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/ph,t=>t.getUTCDate()-1);Y8.range;const zge=po(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/ph,t=>Math.floor(t/ph));zge.range;function T1(t){return po(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*pu)/J$)}const X8=T1(0),sT=T1(1),rrt=T1(2),irt=T1(3),Ly=T1(4),art=T1(5),ort=T1(6);X8.range;sT.range;rrt.range;irt.range;Ly.range;art.range;ort.range;function E1(t){return po(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/J$)}const Z8=E1(0),cT=E1(1),srt=E1(2),crt=E1(3),Vy=E1(4),lrt=E1(5),urt=E1(6);Z8.range;cT.range;srt.range;crt.range;Vy.range;lrt.range;urt.range;const ij=po(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());ij.range;const aj=po(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());aj.range;const mh=po(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());mh.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:po(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});mh.range;const vh=po(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());vh.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:po(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});vh.range;function Gge(t,e,n,r,i,a){const o=[[bm,1,$0],[bm,5,5*$0],[bm,15,15*$0],[bm,30,30*$0],[a,1,pu],[a,5,5*pu],[a,15,15*pu],[a,30,30*pu],[i,1,j0],[i,3,3*j0],[i,6,6*j0],[i,12,12*j0],[r,1,ph],[r,2,2*ph],[n,1,J$],[e,1,VZ],[e,3,3*VZ],[t,1,kM]];function s(l,u,f){const d=u<l;d&&([l,u]=[u,l]);const h=f&&typeof f.range=="function"?f:c(l,u,f),m=h?h.range(l,+u+1):[];return d?m.reverse():m}function c(l,u,f){const d=Math.abs(u-l)/f,h=U$(([,,y])=>y).right(o,d);if(h===o.length)return t.every(oP(l/kM,u/kM,f));if(h===0)return oT.every(Math.max(oP(l,u,f),1));const[m,p]=o[d/o[h-1][2]<o[h][2]/d?h-1:h];return m.every(p)}return[s,c]}const[frt,drt]=Gge(vh,aj,Z8,zge,rj,tj),[hrt,grt]=Gge(mh,ij,X8,Hb,nj,ej);function AM(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function LM(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Gx(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function prt(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,a=t.days,o=t.shortDays,s=t.months,c=t.shortMonths,l=Wx(i),u=Hx(i),f=Wx(a),d=Hx(a),h=Wx(o),m=Hx(o),p=Wx(s),y=Hx(s),x=Wx(c),S=Hx(c),C={a:Y,A:J,b:ne,B:F,c:null,d:zZ,e:zZ,f:$rt,g:Krt,G:Xrt,H:Art,I:Lrt,j:Vrt,L:Wge,m:jrt,M:Urt,p:ae,q:re,Q:HZ,s:qZ,S:Frt,u:Brt,U:zrt,V:Grt,w:Wrt,W:Hrt,x:null,X:null,y:qrt,Y:Yrt,Z:Zrt,"%":WZ},_={a:te,A:ye,b:we,B:Oe,c:null,d:GZ,e:GZ,f:tit,g:fit,G:hit,H:Qrt,I:Jrt,j:eit,L:qge,m:nit,M:rit,p:Te,q:Me,Q:HZ,s:qZ,S:iit,u:ait,U:oit,V:sit,w:cit,W:lit,x:null,X:null,y:uit,Y:dit,Z:git,"%":WZ},T={a:k,A:L,b:$,B:W,c:G,d:FZ,e:FZ,f:Irt,g:UZ,G:jZ,H:BZ,I:BZ,j:Ort,L:Rrt,m:Ert,M:Drt,p:V,q:Trt,Q:Prt,s:krt,S:Mrt,u:wrt,U:brt,V:Srt,w:xrt,W:Crt,x:oe,X:U,y:UZ,Y:jZ,Z:_rt,"%":Nrt};C.x=O(n,C),C.X=O(r,C),C.c=O(e,C),_.x=O(n,_),_.X=O(r,_),_.c=O(e,_);function O(be,Ye){return function(ft){var je=[],It=-1,Rt=0,cn=be.length,ln,en,tr;for(ft instanceof Date||(ft=new Date(+ft));++It<cn;)be.charCodeAt(It)===37&&(je.push(be.slice(Rt,It)),(en=$Z[ln=be.charAt(++It)])!=null?ln=be.charAt(++It):en=ln==="e"?" ":"0",(tr=Ye[ln])&&(ln=tr(ft,en)),je.push(ln),Rt=It+1);return je.push(be.slice(Rt,It)),je.join("")}}function M(be,Ye){return function(ft){var je=Gx(1900,void 0,1),It=I(je,be,ft+="",0),Rt,cn;if(It!=ft.length)return null;if("Q"in je)return new Date(je.Q);if("s"in je)return new Date(je.s*1e3+("L"in je?je.L:0));if(Ye&&!("Z"in je)&&(je.Z=0),"p"in je&&(je.H=je.H%12+je.p*12),je.m===void 0&&(je.m="q"in je?je.q:0),"V"in je){if(je.V<1||je.V>53)return null;"w"in je||(je.w=1),"Z"in je?(Rt=LM(Gx(je.y,0,1)),cn=Rt.getUTCDay(),Rt=cn>4||cn===0?cT.ceil(Rt):cT(Rt),Rt=Y8.offset(Rt,(je.V-1)*7),je.y=Rt.getUTCFullYear(),je.m=Rt.getUTCMonth(),je.d=Rt.getUTCDate()+(je.w+6)%7):(Rt=AM(Gx(je.y,0,1)),cn=Rt.getDay(),Rt=cn>4||cn===0?sT.ceil(Rt):sT(Rt),Rt=Hb.offset(Rt,(je.V-1)*7),je.y=Rt.getFullYear(),je.m=Rt.getMonth(),je.d=Rt.getDate()+(je.w+6)%7)}else("W"in je||"U"in je)&&("w"in je||(je.w="u"in je?je.u%7:"W"in je?1:0),cn="Z"in je?LM(Gx(je.y,0,1)).getUTCDay():AM(Gx(je.y,0,1)).getDay(),je.m=0,je.d="W"in je?(je.w+6)%7+je.W*7-(cn+5)%7:je.w+je.U*7-(cn+6)%7);return"Z"in je?(je.H+=je.Z/100|0,je.M+=je.Z%100,LM(je)):AM(je)}}function I(be,Ye,ft,je){for(var It=0,Rt=Ye.length,cn=ft.length,ln,en;It<Rt;){if(je>=cn)return-1;if(ln=Ye.charCodeAt(It++),ln===37){if(ln=Ye.charAt(It++),en=T[ln in $Z?Ye.charAt(It++):ln],!en||(je=en(be,ft,je))<0)return-1}else if(ln!=ft.charCodeAt(je++))return-1}return je}function V(be,Ye,ft){var je=l.exec(Ye.slice(ft));return je?(be.p=u.get(je[0].toLowerCase()),ft+je[0].length):-1}function k(be,Ye,ft){var je=h.exec(Ye.slice(ft));return je?(be.w=m.get(je[0].toLowerCase()),ft+je[0].length):-1}function L(be,Ye,ft){var je=f.exec(Ye.slice(ft));return je?(be.w=d.get(je[0].toLowerCase()),ft+je[0].length):-1}function $(be,Ye,ft){var je=x.exec(Ye.slice(ft));return je?(be.m=S.get(je[0].toLowerCase()),ft+je[0].length):-1}function W(be,Ye,ft){var je=p.exec(Ye.slice(ft));return je?(be.m=y.get(je[0].toLowerCase()),ft+je[0].length):-1}function G(be,Ye,ft){return I(be,e,Ye,ft)}function oe(be,Ye,ft){return I(be,n,Ye,ft)}function U(be,Ye,ft){return I(be,r,Ye,ft)}function Y(be){return o[be.getDay()]}function J(be){return a[be.getDay()]}function ne(be){return c[be.getMonth()]}function F(be){return s[be.getMonth()]}function ae(be){return i[+(be.getHours()>=12)]}function re(be){return 1+~~(be.getMonth()/3)}function te(be){return o[be.getUTCDay()]}function ye(be){return a[be.getUTCDay()]}function we(be){return c[be.getUTCMonth()]}function Oe(be){return s[be.getUTCMonth()]}function Te(be){return i[+(be.getUTCHours()>=12)]}function Me(be){return 1+~~(be.getUTCMonth()/3)}return{format:function(be){var Ye=O(be+="",C);return Ye.toString=function(){return be},Ye},parse:function(be){var Ye=M(be+="",!1);return Ye.toString=function(){return be},Ye},utcFormat:function(be){var Ye=O(be+="",_);return Ye.toString=function(){return be},Ye},utcParse:function(be){var Ye=M(be+="",!0);return Ye.toString=function(){return be},Ye}}}var $Z={"-":"",_:" ",0:"0"},$o=/^\s*\d+/,mrt=/^%/,vrt=/[\\^$*+?|[\]().{}]/g;function Ir(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(e)+i:i)}function yrt(t){return t.replace(vrt,"\\$&")}function Wx(t){return new RegExp("^(?:"+t.map(yrt).join("|")+")","i")}function Hx(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function xrt(t,e,n){var r=$o.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function wrt(t,e,n){var r=$o.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function brt(t,e,n){var r=$o.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Srt(t,e,n){var r=$o.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Crt(t,e,n){var r=$o.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function jZ(t,e,n){var r=$o.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function UZ(t,e,n){var r=$o.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function _rt(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Trt(t,e,n){var r=$o.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Ert(t,e,n){var r=$o.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function FZ(t,e,n){var r=$o.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Ort(t,e,n){var r=$o.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function BZ(t,e,n){var r=$o.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Drt(t,e,n){var r=$o.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Mrt(t,e,n){var r=$o.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Rrt(t,e,n){var r=$o.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Irt(t,e,n){var r=$o.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Nrt(t,e,n){var r=mrt.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Prt(t,e,n){var r=$o.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function krt(t,e,n){var r=$o.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function zZ(t,e){return Ir(t.getDate(),e,2)}function Art(t,e){return Ir(t.getHours(),e,2)}function Lrt(t,e){return Ir(t.getHours()%12||12,e,2)}function Vrt(t,e){return Ir(1+Hb.count(mh(t),t),e,3)}function Wge(t,e){return Ir(t.getMilliseconds(),e,3)}function $rt(t,e){return Wge(t,e)+"000"}function jrt(t,e){return Ir(t.getMonth()+1,e,2)}function Urt(t,e){return Ir(t.getMinutes(),e,2)}function Frt(t,e){return Ir(t.getSeconds(),e,2)}function Brt(t){var e=t.getDay();return e===0?7:e}function zrt(t,e){return Ir(X8.count(mh(t)-1,t),e,2)}function Hge(t){var e=t.getDay();return e>=4||e===0?Ly(t):Ly.ceil(t)}function Grt(t,e){return t=Hge(t),Ir(Ly.count(mh(t),t)+(mh(t).getDay()===4),e,2)}function Wrt(t){return t.getDay()}function Hrt(t,e){return Ir(sT.count(mh(t)-1,t),e,2)}function qrt(t,e){return Ir(t.getFullYear()%100,e,2)}function Krt(t,e){return t=Hge(t),Ir(t.getFullYear()%100,e,2)}function Yrt(t,e){return Ir(t.getFullYear()%1e4,e,4)}function Xrt(t,e){var n=t.getDay();return t=n>=4||n===0?Ly(t):Ly.ceil(t),Ir(t.getFullYear()%1e4,e,4)}function Zrt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ir(e/60|0,"0",2)+Ir(e%60,"0",2)}function GZ(t,e){return Ir(t.getUTCDate(),e,2)}function Qrt(t,e){return Ir(t.getUTCHours(),e,2)}function Jrt(t,e){return Ir(t.getUTCHours()%12||12,e,2)}function eit(t,e){return Ir(1+Y8.count(vh(t),t),e,3)}function qge(t,e){return Ir(t.getUTCMilliseconds(),e,3)}function tit(t,e){return qge(t,e)+"000"}function nit(t,e){return Ir(t.getUTCMonth()+1,e,2)}function rit(t,e){return Ir(t.getUTCMinutes(),e,2)}function iit(t,e){return Ir(t.getUTCSeconds(),e,2)}function ait(t){var e=t.getUTCDay();return e===0?7:e}function oit(t,e){return Ir(Z8.count(vh(t)-1,t),e,2)}function Kge(t){var e=t.getUTCDay();return e>=4||e===0?Vy(t):Vy.ceil(t)}function sit(t,e){return t=Kge(t),Ir(Vy.count(vh(t),t)+(vh(t).getUTCDay()===4),e,2)}function cit(t){return t.getUTCDay()}function lit(t,e){return Ir(cT.count(vh(t)-1,t),e,2)}function uit(t,e){return Ir(t.getUTCFullYear()%100,e,2)}function fit(t,e){return t=Kge(t),Ir(t.getUTCFullYear()%100,e,2)}function dit(t,e){return Ir(t.getUTCFullYear()%1e4,e,4)}function hit(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Vy(t):Vy.ceil(t),Ir(t.getUTCFullYear()%1e4,e,4)}function git(){return"+0000"}function WZ(){return"%"}function HZ(t){return+t}function qZ(t){return Math.floor(+t/1e3)}var hv,Yge,Xge;pit({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function pit(t){return hv=prt(t),Yge=hv.format,hv.parse,Xge=hv.utcFormat,hv.utcParse,hv}function mit(t){return new Date(t)}function vit(t){return t instanceof Date?+t:+new Date(+t)}function oj(t,e,n,r,i,a,o,s,c,l){var u=H$(),f=u.invert,d=u.domain,h=l(".%L"),m=l(":%S"),p=l("%I:%M"),y=l("%I %p"),x=l("%a %d"),S=l("%b %d"),C=l("%B"),_=l("%Y");function T(O){return(c(O)<O?h:s(O)<O?m:o(O)<O?p:a(O)<O?y:r(O)<O?i(O)<O?x:S:n(O)<O?C:_)(O)}return u.invert=function(O){return new Date(f(O))},u.domain=function(O){return arguments.length?d(Array.from(O,vit)):d().map(mit)},u.ticks=function(O){var M=d();return t(M[0],M[M.length-1],O??10)},u.tickFormat=function(O,M){return M==null?T:l(M)},u.nice=function(O){var M=d();return(!O||typeof O.range!="function")&&(O=e(M[0],M[M.length-1],O??10)),O?d(Lge(M,O)):u},u.copy=function(){return Wb(u,oj(t,e,n,r,i,a,o,s,c,l))},u}function yit(){return Ou.apply(oj(hrt,grt,mh,ij,X8,Hb,nj,ej,bm,Yge).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function xit(){return Ou.apply(oj(frt,drt,vh,aj,Z8,Y8,rj,tj,bm,Xge).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Q8(){var t=0,e=1,n,r,i,a,o=Qs,s=!1,c;function l(f){return f==null||isNaN(f=+f)?c:o(i===0?.5:(f=(a(f)-n)*i,s?Math.max(0,Math.min(1,f)):f))}l.domain=function(f){return arguments.length?([t,e]=f,n=a(t=+t),r=a(e=+e),i=n===r?0:1/(r-n),l):[t,e]},l.clamp=function(f){return arguments.length?(s=!!f,l):s},l.interpolator=function(f){return arguments.length?(o=f,l):o};function u(f){return function(d){var h,m;return arguments.length?([h,m]=d,o=f(h,m),l):[o(0),o(1)]}}return l.range=u(w2),l.rangeRound=u(W$),l.unknown=function(f){return arguments.length?(c=f,l):c},function(f){return a=f,n=f(t),r=f(e),i=n===r?0:1/(r-n),l}}function xp(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Zge(){var t=yp(Q8()(Qs));return t.copy=function(){return xp(t,Zge())},Dh.apply(t,arguments)}function Qge(){var t=Y$(Q8()).domain([1,10]);return t.copy=function(){return xp(t,Qge()).base(t.base())},Dh.apply(t,arguments)}function Jge(){var t=X$(Q8());return t.copy=function(){return xp(t,Jge()).constant(t.constant())},Dh.apply(t,arguments)}function sj(){var t=Z$(Q8());return t.copy=function(){return xp(t,sj()).exponent(t.exponent())},Dh.apply(t,arguments)}function wit(){return sj.apply(null,arguments).exponent(.5)}function epe(){var t=[],e=Qs;function n(r){if(r!=null&&!isNaN(r=+r))return e((zb(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let i of r)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(Vg),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,i)=>e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,a)=>nnt(t,a/r))},n.copy=function(){return epe(e).domain(t)},Dh.apply(n,arguments)}function J8(){var t=0,e=.5,n=1,r=1,i,a,o,s,c,l=Qs,u,f=!1,d;function h(p){return isNaN(p=+p)?d:(p=.5+((p=+u(p))-a)*(r*p<r*a?s:c),l(f?Math.max(0,Math.min(1,p)):p))}h.domain=function(p){return arguments.length?([t,e,n]=p,i=u(t=+t),a=u(e=+e),o=u(n=+n),s=i===a?0:.5/(a-i),c=a===o?0:.5/(o-a),r=a<i?-1:1,h):[t,e,n]},h.clamp=function(p){return arguments.length?(f=!!p,h):f},h.interpolator=function(p){return arguments.length?(l=p,h):l};function m(p){return function(y){var x,S,C;return arguments.length?([x,S,C]=y,l=Nnt(p,[x,S,C]),h):[l(0),l(.5),l(1)]}}return h.range=m(w2),h.rangeRound=m(W$),h.unknown=function(p){return arguments.length?(d=p,h):d},function(p){return u=p,i=p(t),a=p(e),o=p(n),s=i===a?0:.5/(a-i),c=a===o?0:.5/(o-a),r=a<i?-1:1,h}}function tpe(){var t=yp(J8()(Qs));return t.copy=function(){return xp(t,tpe())},Dh.apply(t,arguments)}function npe(){var t=Y$(J8()).domain([.1,1,10]);return t.copy=function(){return xp(t,npe()).base(t.base())},Dh.apply(t,arguments)}function rpe(){var t=X$(J8());return t.copy=function(){return xp(t,rpe()).constant(t.constant())},Dh.apply(t,arguments)}function cj(){var t=Z$(J8());return t.copy=function(){return xp(t,cj()).exponent(t.exponent())},Dh.apply(t,arguments)}function bit(){return cj.apply(null,arguments).exponent(.5)}const v5=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:B$,scaleDiverging:tpe,scaleDivergingLog:npe,scaleDivergingPow:cj,scaleDivergingSqrt:bit,scaleDivergingSymlog:rpe,scaleIdentity:Age,scaleImplicit:cP,scaleLinear:kge,scaleLog:Vge,scaleOrdinal:F$,scalePoint:snt,scalePow:Q$,scaleQuantile:Uge,scaleQuantize:Fge,scaleRadial:jge,scaleSequential:Zge,scaleSequentialLog:Qge,scaleSequentialPow:sj,scaleSequentialQuantile:epe,scaleSequentialSqrt:wit,scaleSequentialSymlog:Jge,scaleSqrt:trt,scaleSymlog:$ge,scaleThreshold:Bge,scaleTime:yit,scaleUtc:xit,tickFormat:Pge},Symbol.toStringTag,{value:"Module"}));var wp=t=>t.chartData,Sit=He([wp],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),eE=(t,e,n,r)=>r?Sit(t):wp(t);function Qm(t){if(Array.isArray(t)&&t.length===2){var[e,n]=t;if(Za(e)&&Za(n))return!0}return!1}function KZ(t,e,n){return n?t:[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}function ipe(t,e){if(e&&typeof t!="function"&&Array.isArray(t)&&t.length===2){var[n,r]=t,i,a;if(Za(n))i=n;else if(typeof n=="function")return;if(Za(r))a=r;else if(typeof r=="function")return;var o=[i,a];if(Qm(o))return o}}function Cit(t,e,n){if(!(!n&&e==null)){if(typeof t=="function"&&e!=null)try{var r=t(e,n);if(Qm(r))return KZ(r,e,n)}catch{}if(Array.isArray(t)&&t.length===2){var[i,a]=t,o,s;if(i==="auto")e!=null&&(o=Math.min(...e));else if(qt(i))o=i;else if(typeof i=="function")try{e!=null&&(o=i(e?.[0]))}catch{}else if(typeof i=="string"&&IX.test(i)){var c=IX.exec(i);if(c==null||e==null)o=void 0;else{var l=+c[1];o=e[0]-l}}else o=e?.[0];if(a==="auto")e!=null&&(s=Math.max(...e));else if(qt(a))s=a;else if(typeof a=="function")try{e!=null&&(s=a(e?.[1]))}catch{}else if(typeof a=="string"&&NX.test(a)){var u=NX.exec(a);if(u==null||e==null)s=void 0;else{var f=+u[1];s=e[1]+f}}else s=e?.[1];var d=[o,s];if(Qm(d))return e==null?d:KZ(d,e,n)}}}var b2=1e9,_it={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},uj,Vi=!0,Cu="[DecimalError] ",km=Cu+"Invalid argument: ",lj=Cu+"Exponent out of range: ",S2=Math.floor,nm=Math.pow,Tit=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ml,Mo=1e7,Mi=7,ape=9007199254740991,lT=S2(ape/Mi),$t={};$t.absoluteValue=$t.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};$t.comparedTo=$t.cmp=function(t){var e,n,r,i,a=this;if(t=new a.constructor(t),a.s!==t.s)return a.s||-t.s;if(a.e!==t.e)return a.e>t.e^a.s<0?1:-1;for(r=a.d.length,i=t.d.length,e=0,n=r<i?r:i;e<n;++e)if(a.d[e]!==t.d[e])return a.d[e]>t.d[e]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1};$t.decimalPlaces=$t.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*Mi;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};$t.dividedBy=$t.div=function(t){return X0(this,new this.constructor(t))};$t.dividedToIntegerBy=$t.idiv=function(t){var e=this,n=e.constructor;return li(X0(e,new n(t),0,1),n.precision)};$t.equals=$t.eq=function(t){return!this.cmp(t)};$t.exponent=function(){return Xa(this)};$t.greaterThan=$t.gt=function(t){return this.cmp(t)>0};$t.greaterThanOrEqualTo=$t.gte=function(t){return this.cmp(t)>=0};$t.isInteger=$t.isint=function(){return this.e>this.d.length-2};$t.isNegative=$t.isneg=function(){return this.s<0};$t.isPositive=$t.ispos=function(){return this.s>0};$t.isZero=function(){return this.s===0};$t.lessThan=$t.lt=function(t){return this.cmp(t)<0};$t.lessThanOrEqualTo=$t.lte=function(t){return this.cmp(t)<1};$t.logarithm=$t.log=function(t){var e,n=this,r=n.constructor,i=r.precision,a=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(ml))throw Error(Cu+"NaN");if(n.s<1)throw Error(Cu+(n.s?"NaN":"-Infinity"));return n.eq(ml)?new r(0):(Vi=!1,e=X0(jw(n,a),jw(t,a),a),Vi=!0,li(e,i))};$t.minus=$t.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?cpe(e,t):ope(e,(t.s=-t.s,t))};$t.modulo=$t.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(Cu+"NaN");return n.s?(Vi=!1,e=X0(n,t,0,1).times(t),Vi=!0,n.minus(e)):li(new r(n),i)};$t.naturalExponential=$t.exp=function(){return spe(this)};$t.naturalLogarithm=$t.ln=function(){return jw(this)};$t.negated=$t.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};$t.plus=$t.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?ope(e,t):cpe(e,(t.s=-t.s,t))};$t.precision=$t.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(km+t);if(e=Xa(i)+1,r=i.d.length-1,n=r*Mi+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};$t.squareRoot=$t.sqrt=function(){var t,e,n,r,i,a,o,s=this,c=s.constructor;if(s.s<1){if(!s.s)return new c(0);throw Error(Cu+"NaN")}for(t=Xa(s),Vi=!1,i=Math.sqrt(+s),i==0||i==1/0?(e=sd(s.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=S2((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new c(e)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(a=r,r=a.plus(X0(s,a,o+2)).times(.5),sd(a.d).slice(0,o)===(e=sd(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(li(a,n+1,0),a.times(a).eq(s)){r=a;break}}else if(e!="9999")break;o+=4}return Vi=!0,li(r,n)};$t.times=$t.mul=function(t){var e,n,r,i,a,o,s,c,l,u=this,f=u.constructor,d=u.d,h=(t=new f(t)).d;if(!u.s||!t.s)return new f(0);for(t.s*=u.s,n=u.e+t.e,c=d.length,l=h.length,c<l&&(a=d,d=h,h=a,o=c,c=l,l=o),a=[],o=c+l,r=o;r--;)a.push(0);for(r=l;--r>=0;){for(e=0,i=c+r;i>r;)s=a[i]+h[r]*d[i-r-1]+e,a[i--]=s%Mo|0,e=s/Mo|0;a[i]=(a[i]+e)%Mo|0}for(;!a[--o];)a.pop();return e?++n:a.shift(),t.d=a,t.e=n,Vi?li(t,f.precision):t};$t.toDecimalPlaces=$t.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Sd(t,0,b2),e===void 0?e=r.rounding:Sd(e,0,8),li(n,t+Xa(n)+1,e))};$t.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Jm(r,!0):(Sd(t,0,b2),e===void 0?e=i.rounding:Sd(e,0,8),r=li(new i(r),t+1,e),n=Jm(r,!0,t+1)),n};$t.toFixed=function(t,e){var n,r,i=this,a=i.constructor;return t===void 0?Jm(i):(Sd(t,0,b2),e===void 0?e=a.rounding:Sd(e,0,8),r=li(new a(i),t+Xa(i)+1,e),n=Jm(r.abs(),!1,t+Xa(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};$t.toInteger=$t.toint=function(){var t=this,e=t.constructor;return li(new e(t),Xa(t)+1,e.rounding)};$t.toNumber=function(){return+this};$t.toPower=$t.pow=function(t){var e,n,r,i,a,o,s=this,c=s.constructor,l=12,u=+(t=new c(t));if(!t.s)return new c(ml);if(s=new c(s),!s.s){if(t.s<1)throw Error(Cu+"Infinity");return s}if(s.eq(ml))return s;if(r=c.precision,t.eq(ml))return li(s,r);if(e=t.e,n=t.d.length-1,o=e>=n,a=s.s,o){if((n=u<0?-u:u)<=ape){for(i=new c(ml),e=Math.ceil(r/Mi+4),Vi=!1;n%2&&(i=i.times(s),XZ(i.d,e)),n=S2(n/2),n!==0;)s=s.times(s),XZ(s.d,e);return Vi=!0,t.s<0?new c(ml).div(i):li(i,r)}}else if(a<0)throw Error(Cu+"NaN");return a=a<0&&t.d[Math.max(e,n)]&1?-1:1,s.s=1,Vi=!1,i=t.times(jw(s,r+l)),Vi=!0,i=spe(i),i.s=a,i};$t.toPrecision=function(t,e){var n,r,i=this,a=i.constructor;return t===void 0?(n=Xa(i),r=Jm(i,n<=a.toExpNeg||n>=a.toExpPos)):(Sd(t,1,b2),e===void 0?e=a.rounding:Sd(e,0,8),i=li(new a(i),t,e),n=Xa(i),r=Jm(i,t<=n||n<=a.toExpNeg,t)),r};$t.toSignificantDigits=$t.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(Sd(t,1,b2),e===void 0?e=r.rounding:Sd(e,0,8)),li(new r(n),t,e)};$t.toString=$t.valueOf=$t.val=$t.toJSON=$t[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Xa(t),n=t.constructor;return Jm(t,e<=n.toExpNeg||e>=n.toExpPos)};function ope(t,e){var n,r,i,a,o,s,c,l,u=t.constructor,f=u.precision;if(!t.s||!e.s)return e.s||(e=new u(t)),Vi?li(e,f):e;if(c=t.d,l=e.d,o=t.e,i=e.e,c=c.slice(),a=o-i,a){for(a<0?(r=c,a=-a,s=l.length):(r=l,i=o,s=c.length),o=Math.ceil(f/Mi),s=o>s?o+1:s+1,a>s&&(a=s,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for(s=c.length,a=l.length,s-a<0&&(a=s,r=l,l=c,c=r),n=0;a;)n=(c[--a]=c[a]+l[a]+n)/Mo|0,c[a]%=Mo;for(n&&(c.unshift(n),++i),s=c.length;c[--s]==0;)c.pop();return e.d=c,e.e=i,Vi?li(e,f):e}function Sd(t,e,n){if(t!==~~t||t<e||t>n)throw Error(km+t)}function sd(t){var e,n,r,i=t.length-1,a="",o=t[0];if(i>0){for(a+=o,e=1;e<i;e++)r=t[e]+"",n=Mi-r.length,n&&(a+=mg(n)),a+=r;o=t[e],r=o+"",n=Mi-r.length,n&&(a+=mg(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}var X0=(function(){function t(r,i){var a,o=0,s=r.length;for(r=r.slice();s--;)a=r[s]*i+o,r[s]=a%Mo|0,o=a/Mo|0;return o&&r.unshift(o),r}function e(r,i,a,o){var s,c;if(a!=o)c=a>o?1:-1;else for(s=c=0;s<a;s++)if(r[s]!=i[s]){c=r[s]>i[s]?1:-1;break}return c}function n(r,i,a){for(var o=0;a--;)r[a]-=o,o=r[a]<i[a]?1:0,r[a]=o*Mo+r[a]-i[a];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,a,o){var s,c,l,u,f,d,h,m,p,y,x,S,C,_,T,O,M,I,V=r.constructor,k=r.s==i.s?1:-1,L=r.d,$=i.d;if(!r.s)return new V(r);if(!i.s)throw Error(Cu+"Division by zero");for(c=r.e-i.e,M=$.length,T=L.length,h=new V(k),m=h.d=[],l=0;$[l]==(L[l]||0);)++l;if($[l]>(L[l]||0)&&--c,a==null?S=a=V.precision:o?S=a+(Xa(r)-Xa(i))+1:S=a,S<0)return new V(0);if(S=S/Mi+2|0,l=0,M==1)for(u=0,$=$[0],S++;(l<T||u)&&S--;l++)C=u*Mo+(L[l]||0),m[l]=C/$|0,u=C%$|0;else{for(u=Mo/($[0]+1)|0,u>1&&($=t($,u),L=t(L,u),M=$.length,T=L.length),_=M,p=L.slice(0,M),y=p.length;y<M;)p[y++]=0;I=$.slice(),I.unshift(0),O=$[0],$[1]>=Mo/2&&++O;do u=0,s=e($,p,M,y),s<0?(x=p[0],M!=y&&(x=x*Mo+(p[1]||0)),u=x/O|0,u>1?(u>=Mo&&(u=Mo-1),f=t($,u),d=f.length,y=p.length,s=e(f,p,d,y),s==1&&(u--,n(f,M<d?I:$,d))):(u==0&&(s=u=1),f=$.slice()),d=f.length,d<y&&f.unshift(0),n(p,f,y),s==-1&&(y=p.length,s=e($,p,M,y),s<1&&(u++,n(p,M<y?I:$,y))),y=p.length):s===0&&(u++,p=[0]),m[l++]=u,s&&p[0]?p[y++]=L[_]||0:(p=[L[_]],y=1);while((_++<T||p[0]!==void 0)&&S--)}return m[0]||m.shift(),h.e=c,li(h,o?a+Xa(h)+1:a)}})();function spe(t,e){var n,r,i,a,o,s,c=0,l=0,u=t.constructor,f=u.precision;if(Xa(t)>16)throw Error(lj+Xa(t));if(!t.s)return new u(ml);for(Vi=!1,s=f,o=new u(.03125);t.abs().gte(.1);)t=t.times(o),l+=5;for(r=Math.log(nm(2,l))/Math.LN10*2+5|0,s+=r,n=i=a=new u(ml),u.precision=s;;){if(i=li(i.times(t),s),n=n.times(++c),o=a.plus(X0(i,n,s)),sd(o.d).slice(0,s)===sd(a.d).slice(0,s)){for(;l--;)a=li(a.times(a),s);return u.precision=f,e==null?(Vi=!0,li(a,f)):a}a=o}}function Xa(t){for(var e=t.e*Mi,n=t.d[0];n>=10;n/=10)e++;return e}function VM(t,e,n){if(e>t.LN10.sd())throw Vi=!0,n&&(t.precision=n),Error(Cu+"LN10 precision limit exceeded");return li(new t(t.LN10),e)}function mg(t){for(var e="";t--;)e+="0";return e}function jw(t,e){var n,r,i,a,o,s,c,l,u,f=1,d=10,h=t,m=h.d,p=h.constructor,y=p.precision;if(h.s<1)throw Error(Cu+(h.s?"NaN":"-Infinity"));if(h.eq(ml))return new p(0);if(e==null?(Vi=!1,l=y):l=e,h.eq(10))return e==null&&(Vi=!0),VM(p,l);if(l+=d,p.precision=l,n=sd(m),r=n.charAt(0),a=Xa(h),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(t),n=sd(h.d),r=n.charAt(0),f++;a=Xa(h),r>1?(h=new p("0."+n),a++):h=new p(r+"."+n.slice(1))}else return c=VM(p,l+2,y).times(a+""),h=jw(new p(r+"."+n.slice(1)),l-d).plus(c),p.precision=y,e==null?(Vi=!0,li(h,y)):h;for(s=o=h=X0(h.minus(ml),h.plus(ml),l),u=li(h.times(h),l),i=3;;){if(o=li(o.times(u),l),c=s.plus(X0(o,new p(i),l)),sd(c.d).slice(0,l)===sd(s.d).slice(0,l))return s=s.times(2),a!==0&&(s=s.plus(VM(p,l+2,y).times(a+""))),s=X0(s,new p(f),l),p.precision=y,e==null?(Vi=!0,li(s,y)):s;s=c,i+=2}}function YZ(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=S2(n/Mi),t.d=[],r=(n+1)%Mi,n<0&&(r+=Mi),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=Mi;r<i;)t.d.push(+e.slice(r,r+=Mi));e=e.slice(r),r=Mi-e.length}else r-=i;for(;r--;)e+="0";if(t.d.push(+e),Vi&&(t.e>lT||t.e<-lT))throw Error(lj+n)}else t.s=0,t.e=0,t.d=[0];return t}function li(t,e,n){var r,i,a,o,s,c,l,u,f=t.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(r=e-o,r<0)r+=Mi,i=e,l=f[u=0];else{if(u=Math.ceil((r+1)/Mi),a=f.length,u>=a)return t;for(l=a=f[u],o=1;a>=10;a/=10)o++;r%=Mi,i=r-Mi+o}if(n!==void 0&&(a=nm(10,o-i-1),s=l/a%10|0,c=e<0||f[u+1]!==void 0||l%a,c=n<4?(s||c)&&(n==0||n==(t.s<0?3:2)):s>5||s==5&&(n==4||c||n==6&&(r>0?i>0?l/nm(10,o-i):0:f[u-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return c?(a=Xa(t),f.length=1,e=e-a-1,f[0]=nm(10,(Mi-e%Mi)%Mi),t.e=S2(-e/Mi)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=u,a=1,u--):(f.length=u+1,a=nm(10,Mi-r),f[u]=i>0?(l/nm(10,o-i)%nm(10,i)|0)*a:0),c)for(;;)if(u==0){(f[0]+=a)==Mo&&(f[0]=1,++t.e);break}else{if(f[u]+=a,f[u]!=Mo)break;f[u--]=0,a=1}for(r=f.length;f[--r]===0;)f.pop();if(Vi&&(t.e>lT||t.e<-lT))throw Error(lj+Xa(t));return t}function cpe(t,e){var n,r,i,a,o,s,c,l,u,f,d=t.constructor,h=d.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new d(t),Vi?li(e,h):e;if(c=t.d,f=e.d,r=e.e,l=t.e,c=c.slice(),o=l-r,o){for(u=o<0,u?(n=c,o=-o,s=f.length):(n=f,r=l,s=c.length),i=Math.max(Math.ceil(h/Mi),s)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,s=f.length,u=i<s,u&&(s=i),i=0;i<s;i++)if(c[i]!=f[i]){u=c[i]<f[i];break}o=0}for(u&&(n=c,c=f,f=n,e.s=-e.s),s=c.length,i=f.length-s;i>0;--i)c[s++]=0;for(i=f.length;i>o;){if(c[--i]<f[i]){for(a=i;a&&c[--a]===0;)c[a]=Mo-1;--c[a],c[i]+=Mo}c[i]-=f[i]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(e.d=c,e.e=r,Vi?li(e,h):e):new d(0)}function Jm(t,e,n){var r,i=Xa(t),a=sd(t.d),o=a.length;return e?(n&&(r=n-o)>0?a=a.charAt(0)+"."+a.slice(1)+mg(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+mg(-i-1)+a,n&&(r=n-o)>0&&(a+=mg(r))):i>=o?(a+=mg(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+mg(r))):((r=i+1)<o&&(a=a.slice(0,r)+"."+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+="."),a+=mg(r))),t.s<0?"-"+a:a}function XZ(t,e){if(t.length>e)return t.length=e,!0}function lpe(t){var e,n,r;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(km+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return YZ(o,a.toString())}else if(typeof a!="string")throw Error(km+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,Tit.test(a))YZ(o,a);else throw Error(km+a)}if(i.prototype=$t,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=lpe,i.config=i.set=Eit,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return i.config(t),i}function Eit(t){if(!t||typeof t!="object")throw Error(Cu+"Object expected");var e,n,r,i=["precision",1,b2,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<i.length;e+=3)if((r=t[n=i[e]])!==void 0)if(S2(r)===r&&r>=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(km+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(km+n+": "+r);return this}var uj=lpe(_it);ml=new uj(1);const Xr=uj;var Oit=t=>t,upe={},fpe=t=>t===upe,ZZ=t=>function e(){return arguments.length===0||arguments.length===1&&fpe(arguments.length<=0?void 0:arguments[0])?e:t(...arguments)},dpe=(t,e)=>t===1?e:ZZ(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=r.filter(o=>o!==upe).length;return a>=t?e(...r):dpe(t-a,ZZ(function(){for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];var l=r.map(u=>fpe(u)?s.shift():u);return e(...l,...s)}))}),tE=t=>dpe(t.length,t),dP=(t,e)=>{for(var n=[],r=t;r<e;++r)n[r-t]=r;return n},Dit=tE((t,e)=>Array.isArray(e)?e.map(t):Object.keys(e).map(n=>e[n]).map(t)),Mit=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(!n.length)return Oit;var i=n.reverse(),a=i[0],o=i.slice(1);return function(){return o.reduce((s,c)=>c(s),a(...arguments))}},hP=t=>Array.isArray(t)?t.reverse():t.split("").reverse().join(""),hpe=t=>{var e=null,n=null;return function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return e&&i.every((o,s)=>{var c;return o===((c=e)===null||c===void 0?void 0:c[s])})||(e=i,n=t(...i)),n}};function gpe(t){var e;return t===0?e=1:e=Math.floor(new Xr(t).abs().log(10).toNumber())+1,e}function ppe(t,e,n){for(var r=new Xr(t),i=0,a=[];r.lt(e)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}tE((t,e,n)=>{var r=+t,i=+e;return r+n*(i-r)});tE((t,e,n)=>{var r=e-+t;return r=r||1/0,(n-t)/r});tE((t,e,n)=>{var r=e-+t;return r=r||1/0,Math.max(0,Math.min(1,(n-t)/r))});var mpe=t=>{var[e,n]=t,[r,i]=[e,n];return e>n&&([r,i]=[n,e]),[r,i]},vpe=(t,e,n)=>{if(t.lte(0))return new Xr(0);var r=gpe(t.toNumber()),i=new Xr(10).pow(r),a=t.div(i),o=r!==1?.05:.1,s=new Xr(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=s.mul(i);return e?new Xr(c.toNumber()):new Xr(Math.ceil(c.toNumber()))},Rit=(t,e,n)=>{var r=new Xr(1),i=new Xr(t);if(!i.isint()&&n){var a=Math.abs(t);a<1?(r=new Xr(10).pow(gpe(t)-1),i=new Xr(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new Xr(Math.floor(t)))}else t===0?i=new Xr(Math.floor((e-1)/2)):n||(i=new Xr(Math.floor(t)));var o=Math.floor((e-1)/2),s=Mit(Dit(c=>i.add(new Xr(c-o).mul(r)).toNumber()),dP);return s(0,e)},ype=function(e,n,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-e)/(r-1)))return{step:new Xr(0),tickMin:new Xr(0),tickMax:new Xr(0)};var o=vpe(new Xr(n).sub(e).div(r-1),i,a),s;e<=0&&n>=0?s=new Xr(0):(s=new Xr(e).add(n).div(2),s=s.sub(new Xr(s).mod(o)));var c=Math.ceil(s.sub(e).div(o).toNumber()),l=Math.ceil(new Xr(n).sub(s).div(o).toNumber()),u=c+l+1;return u>r?ype(e,n,r,i,a+1):(u<r&&(l=n>0?l+(r-u):l,c=n>0?c:c+(r-u)),{step:o,tickMin:s.sub(new Xr(c).mul(o)),tickMax:s.add(new Xr(l).mul(o))})};function Iit(t){var[e,n]=t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=Math.max(r,2),[o,s]=mpe([e,n]);if(o===-1/0||s===1/0){var c=s===1/0?[o,...dP(0,r-1).map(()=>1/0)]:[...dP(0,r-1).map(()=>-1/0),s];return e>n?hP(c):c}if(o===s)return Rit(o,r,i);var{step:l,tickMin:u,tickMax:f}=ype(o,s,a,i,0),d=ppe(u,f.add(new Xr(.1).mul(l)),l);return e>n?hP(d):d}function Nit(t,e){var[n,r]=t,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[a,o]=mpe([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var s=Math.max(e,2),c=vpe(new Xr(o).sub(a).div(s-1),i,0),l=[...ppe(new Xr(a),new Xr(o),c),o];return i===!1&&(l=l.map(u=>Math.round(u))),n>r?hP(l):l}var Pit=hpe(Iit),kit=hpe(Nit),xpe=t=>t.rootProps.maxBarSize,Ait=t=>t.rootProps.barGap,wpe=t=>t.rootProps.barCategoryGap,Lit=t=>t.rootProps.barSize,nE=t=>t.rootProps.stackOffset,fj=t=>t.options.chartName,dj=t=>t.rootProps.syncId,bpe=t=>t.rootProps.syncMethod,hj=t=>t.options.eventEmitter,E0={allowDuplicatedCategory:!0,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"category"},fl={allowDataOverflow:!1,allowDuplicatedCategory:!0,radiusAxisId:0,scale:"auto",tick:!0,tickCount:5,type:"number"},rE=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e},Vit={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:E0.angleAxisId,includeHidden:!1,name:void 0,reversed:E0.reversed,scale:E0.scale,tick:E0.tick,tickCount:void 0,ticks:void 0,type:E0.type,unit:void 0},$it={allowDataOverflow:fl.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:fl.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:fl.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:fl.scale,tick:fl.tick,tickCount:fl.tickCount,ticks:void 0,type:fl.type,unit:void 0},jit={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:E0.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:E0.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:E0.scale,tick:E0.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},Uit={allowDataOverflow:fl.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:fl.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:fl.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:fl.scale,tick:fl.tick,tickCount:fl.tickCount,ticks:void 0,type:"category",unit:void 0},gj=(t,e)=>t.polarAxis.angleAxis[e]!=null?t.polarAxis.angleAxis[e]:t.layout.layoutType==="radial"?jit:Vit,pj=(t,e)=>t.polarAxis.radiusAxis[e]!=null?t.polarAxis.radiusAxis[e]:t.layout.layoutType==="radial"?Uit:$it,iE=t=>t.polarOptions,mj=He([Eh,Oh,Vo],uJe),Spe=He([iE,mj],(t,e)=>{if(t!=null)return pf(t.innerRadius,e,0)}),Cpe=He([iE,mj],(t,e)=>{if(t!=null)return pf(t.outerRadius,e,e*.8)}),Fit=t=>{if(t==null)return[0,0];var{startAngle:e,endAngle:n}=t;return[e,n]},_pe=He([iE],Fit);He([gj,_pe],rE);var Tpe=He([mj,Spe,Cpe],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});He([pj,Tpe],rE);var Epe=He([Nr,iE,Spe,Cpe,Eh,Oh],(t,e,n,r,i,a)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var{cx:o,cy:s,startAngle:c,endAngle:l}=e;return{cx:pf(o,i,i/2),cy:pf(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:l,clockWise:!1}}}),mo=(t,e)=>e,aE=(t,e,n)=>n;function oE(t){return t?.id}var vo=t=>{var e=Nr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},C2=t=>t.tooltip.settings.axisId,yo=t=>{var e=vo(t),n=C2(t);return qb(t,e,n)},Ope=He([yo],t=>t?.dataKey);function Dpe(t,e,n){var{chartData:r=[]}=e,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return t.forEach(s=>{var c,l=(c=s.data)!==null&&c!==void 0?c:r;if(!(l==null||l.length===0)){var u=oE(s);l.forEach((f,d)=>{var h=a==null||i?d:String(Po(f,a,null)),m=Po(f,s.dataKey,0),p;o.has(h)?p=o.get(h):p={},Object.assign(p,{[u]:m}),o.set(h,p)})}}),Array.from(o.values())}function sE(t){return t.stackId!=null&&t.dataKey!=null}var cE=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function lE(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function QZ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function uT(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?QZ(Object(n),!0).forEach(function(r){Bit(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):QZ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Bit(t,e,n){return(e=zit(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zit(t){var e=Git(t,"string");return typeof e=="symbol"?e:e+""}function Git(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var gP=[0,"auto"],al={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0},Mpe=(t,e)=>t.cartesianAxis.xAxis[e],Mh=(t,e)=>{var n=Mpe(t,e);return n??al},ol={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:gP,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:Bb},Rpe=(t,e)=>t.cartesianAxis.yAxis[e],Rh=(t,e)=>{var n=Rpe(t,e);return n??ol},Wit={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},vj=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Wit},oc=(t,e,n)=>{switch(e){case"xAxis":return Mh(t,n);case"yAxis":return Rh(t,n);case"zAxis":return vj(t,n);case"angleAxis":return gj(t,n);case"radiusAxis":return pj(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Hit=(t,e,n)=>{switch(e){case"xAxis":return Mh(t,n);case"yAxis":return Rh(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},qb=(t,e,n)=>{switch(e){case"xAxis":return Mh(t,n);case"yAxis":return Rh(t,n);case"angleAxis":return gj(t,n);case"radiusAxis":return pj(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Ipe=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function Npe(t,e){return n=>{switch(t){case"xAxis":return"xAxisId"in n&&n.xAxisId===e;case"yAxis":return"yAxisId"in n&&n.yAxisId===e;case"zAxis":return"zAxisId"in n&&n.zAxisId===e;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===e;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===e;default:return!1}}}var uE=t=>t.graphicalItems.cartesianItems,qit=He([mo,aE],Npe),Ppe=(t,e,n)=>t.filter(n).filter(r=>e?.includeHidden===!0?!0:!r.hide),Kb=He([uE,oc,qit],Ppe,{memoizeOptions:{resultEqualityCheck:lE}}),kpe=He([Kb],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(sE)),Ape=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),Kit=He([Kb],Ape),Lpe=t=>t.map(e=>e.data).filter(Boolean).flat(1),Yit=He([Kb],Lpe,{memoizeOptions:{resultEqualityCheck:lE}}),Vpe=(t,e)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=e;return t.length>0?t:n.slice(r,i+1)},yj=He([Yit,eE],Vpe),$pe=(t,e,n)=>e?.dataKey!=null?t.map(r=>({value:Po(r,e.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>t.map(i=>({value:Po(i,r)}))):t.map(r=>({value:r})),fE=He([yj,oc,Kb],$pe);function jpe(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function pC(t){if(bd(t)||t instanceof Date){var e=Number(t);if(Za(e))return e}}function JZ(t){if(Array.isArray(t)){var e=[pC(t[0]),pC(t[1])];return Qm(e)?e:void 0}var n=pC(t);if(n!=null)return[n,n]}function _2(t){return t.map(pC).filter(ctt)}function Xit(t,e,n){return!n||typeof e!="number"||El(e)?[]:n.length?_2(n.flatMap(r=>{var i=Po(t,r.dataKey),a,o;if(Array.isArray(i)?[a,o]=i:a=o=i,!(!Za(a)||!Za(o)))return[e-a,e+o]})):[]}var Zit=He([kpe,eE,yo],Dpe),Upe=(t,e,n)=>{var r={},i=e.reduce((a,o)=>(o.stackId==null||(a[o.stackId]==null&&(a[o.stackId]=[]),a[o.stackId].push(o)),a),r);return Object.fromEntries(Object.entries(i).map(a=>{var[o,s]=a,c=s.map(oE);return[o,{stackedData:EJe(t,c,n),graphicalItems:s}]}))},Uw=He([Zit,kpe,nE],Upe),Fpe=(t,e,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=e;if(r==null&&n!=="zAxis"){var o=RJe(t,i,a);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},Qit=He([oc],t=>t.allowDataOverflow),xj=t=>{var e;if(t==null||!("domain"in t))return gP;if(t.domain!=null)return t.domain;if(t.ticks!=null){if(t.type==="number"){var n=_2(t.ticks);return[Math.min(...n),Math.max(...n)]}if(t.type==="category")return t.ticks.map(String)}return(e=t?.domain)!==null&&e!==void 0?e:gP},Bpe=He([oc],xj),zpe=He([Bpe,Qit],ipe),Jit=He([Uw,wp,mo,zpe],Fpe,{memoizeOptions:{resultEqualityCheck:cE}}),wj=t=>t.errorBars,eat=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>jpe(n,r)),fT=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.filter(Boolean);if(i.length!==0){var a=i.flat(),o=Math.min(...a),s=Math.max(...a);return[o,s]}},Gpe=(t,e,n,r,i)=>{var a,o;if(n.length>0&&t.forEach(s=>{n.forEach(c=>{var l,u,f=(l=r[c.id])===null||l===void 0?void 0:l.filter(x=>jpe(i,x)),d=Po(s,(u=e.dataKey)!==null&&u!==void 0?u:c.dataKey),h=Xit(s,d,f);if(h.length>=2){var m=Math.min(...h),p=Math.max(...h);(a==null||m<a)&&(a=m),(o==null||p>o)&&(o=p)}var y=JZ(d);y!=null&&(a=a==null?y[0]:Math.min(a,y[0]),o=o==null?y[1]:Math.max(o,y[1]))})}),e?.dataKey!=null&&t.forEach(s=>{var c=JZ(Po(s,e.dataKey));c!=null&&(a=a==null?c[0]:Math.min(a,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),Za(a)&&Za(o))return[a,o]},tat=He([yj,oc,Kit,wj,mo],Gpe,{memoizeOptions:{resultEqualityCheck:cE}});function nat(t){var{value:e}=t;if(bd(e)||e instanceof Date)return e}var rat=(t,e,n)=>{var r=t.map(nat).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&phe(r))?Cge(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},Wpe=t=>t.referenceElements.dots,T2=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),iat=He([Wpe,mo,aE],T2),Hpe=t=>t.referenceElements.areas,aat=He([Hpe,mo,aE],T2),qpe=t=>t.referenceElements.lines,oat=He([qpe,mo,aE],T2),Kpe=(t,e)=>{var n=_2(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},sat=He(iat,mo,Kpe),Ype=(t,e)=>{var n=_2(t.flatMap(r=>[e==="xAxis"?r.x1:r.y1,e==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},cat=He([aat,mo],Ype),Xpe=(t,e)=>{var n=_2(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},lat=He(oat,mo,Xpe),uat=He(sat,lat,cat,(t,e,n)=>fT(t,n,e)),Zpe=(t,e,n,r,i,a,o,s)=>{if(n!=null)return n;var c=o==="vertical"&&s==="xAxis"||o==="horizontal"&&s==="yAxis",l=c?fT(r,a,i):fT(a,i);return Cit(e,l,t.allowDataOverflow)},fat=He([oc,Bpe,zpe,Jit,tat,uat,Nr,mo],Zpe,{memoizeOptions:{resultEqualityCheck:cE}}),dat=[0,1],Qpe=(t,e,n,r,i,a,o)=>{if(!((t==null||n==null||n.length===0)&&o===void 0)){var{dataKey:s,type:c}=t,l=Th(e,a);return l&&s==null?Cge(0,n.length):c==="category"?rat(r,t,l):i==="expand"?dat:o}},bj=He([oc,Nr,yj,fE,nE,mo,fat],Qpe),Jpe=(t,e,n,r,i)=>{if(t!=null){var{scale:a,type:o}=t;if(a==="auto")return e==="radial"&&i==="radiusAxis"?"band":e==="radial"&&i==="angleAxis"?"linear":o==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?"point":o==="category"?"band":"linear";if(typeof a=="string"){var s="scale".concat(jb(a));return s in v5?s:"point"}}},Yb=He([oc,Nr,Ipe,fj,mo],Jpe);function hat(t){if(t!=null){if(t in v5)return v5[t]();var e="scale".concat(jb(t));if(e in v5)return v5[e]()}}function Sj(t,e,n,r){if(!(n==null||r==null)){if(typeof t.scale=="function")return t.scale.copy().domain(n).range(r);var i=hat(e);if(i!=null){var a=i.domain(n).range(r);return bJe(a),a}}}var eme=(t,e,n)=>{var r=xj(e);if(!(n!=="auto"&&n!=="linear")){if(e!=null&&e.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&Qm(t))return Pit(t,e.tickCount,e.allowDecimals);if(e!=null&&e.tickCount&&e.type==="number"&&Qm(t))return kit(t,e.tickCount,e.allowDecimals)}},Cj=He([bj,qb,Yb],eme),tme=(t,e,n,r)=>{if(r!=="angleAxis"&&t?.type==="number"&&Qm(e)&&Array.isArray(n)&&n.length>0){var i=e[0],a=n[0],o=e[1],s=n[n.length-1];return[Math.min(i,a),Math.max(o,s)]}return e},gat=He([oc,bj,Cj,mo],tme),pat=He(fE,oc,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(_2(t.map(s=>s.value))).sort((s,c)=>s-c);if(r.length<2)return 1/0;var i=r[r.length-1]-r[0];if(i===0)return 1/0;for(var a=0;a<r.length-1;a++){var o=r[a+1]-r[a];n=Math.min(n,o)}return n/i}}),nme=He(pat,Nr,wpe,Vo,(t,e,n,r)=>r,(t,e,n,r,i)=>{if(!Za(t))return 0;var a=e==="vertical"?r.height:r.width;if(i==="gap")return t*a/2;if(i==="no-gap"){var o=pf(n,t*a),s=t*a/2;return s-o-(s-o)/a*o}return 0}),mat=(t,e)=>{var n=Mh(t,e);return n==null||typeof n.padding!="string"?0:nme(t,"xAxis",e,n.padding)},vat=(t,e)=>{var n=Rh(t,e);return n==null||typeof n.padding!="string"?0:nme(t,"yAxis",e,n.padding)},yat=He(Mh,mat,(t,e)=>{var n,r;if(t==null)return{left:0,right:0};var{padding:i}=t;return typeof i=="string"?{left:e,right:e}:{left:((n=i.left)!==null&&n!==void 0?n:0)+e,right:((r=i.right)!==null&&r!==void 0?r:0)+e}}),xat=He(Rh,vat,(t,e)=>{var n,r;if(t==null)return{top:0,bottom:0};var{padding:i}=t;return typeof i=="string"?{top:e,bottom:e}:{top:((n=i.top)!==null&&n!==void 0?n:0)+e,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+e}}),wat=He([Vo,yat,F8,U8,(t,e,n)=>n],(t,e,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[t.left+e.left,t.left+t.width-e.right]}),bat=He([Vo,Nr,xat,F8,U8,(t,e,n)=>n],(t,e,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),Xb=(t,e,n,r)=>{var i;switch(e){case"xAxis":return wat(t,n,r);case"yAxis":return bat(t,n,r);case"zAxis":return(i=vj(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return _pe(t);case"radiusAxis":return Tpe(t,n);default:return}},rme=He([oc,Xb],rE),E2=He([oc,Yb,gat,rme],Sj);He([Kb,wj,mo],eat);function ime(t,e){return t.id<e.id?-1:t.id>e.id?1:0}var dE=(t,e)=>e,hE=(t,e,n)=>n,Sat=He($8,dE,hE,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(ime)),Cat=He(j8,dE,hE,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(ime)),ame=(t,e)=>({width:t.width,height:e.height}),_at=(t,e)=>{var n=typeof e.width=="number"?e.width:Bb;return{width:n,height:t.height}},ome=He(Vo,Mh,ame),Tat=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},Eat=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},Oat=He(Oh,Vo,Sat,dE,hE,(t,e,n,r,i)=>{var a={},o;return n.forEach(s=>{var c=ame(e,s);o==null&&(o=Tat(e,r,t));var l=r==="top"&&!i||r==="bottom"&&i;a[s.id]=o-Number(l)*c.height,o+=(l?-1:1)*c.height}),a}),Dat=He(Eh,Vo,Cat,dE,hE,(t,e,n,r,i)=>{var a={},o;return n.forEach(s=>{var c=_at(e,s);o==null&&(o=Eat(e,r,t));var l=r==="left"&&!i||r==="right"&&i;a[s.id]=o-Number(l)*c.width,o+=(l?-1:1)*c.width}),a}),Mat=(t,e)=>{var n=Mh(t,e);if(n!=null)return Oat(t,n.orientation,n.mirror)},Rat=He([Vo,Mh,Mat,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n?.[r];return i==null?{x:t.left,y:0}:{x:t.left,y:i}}}),Iat=(t,e)=>{var n=Rh(t,e);if(n!=null)return Dat(t,n.orientation,n.mirror)},Nat=He([Vo,Rh,Iat,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n?.[r];return i==null?{x:0,y:t.top}:{x:i,y:t.top}}}),sme=He(Vo,Rh,(t,e)=>{var n=typeof e.width=="number"?e.width:Bb;return{width:n,height:t.height}}),eQ=(t,e,n)=>{switch(e){case"xAxis":return ome(t,n).width;case"yAxis":return sme(t,n).height;default:return}},cme=(t,e,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=Th(t,r),c=e.map(l=>l.value);if(o&&s&&a==="category"&&i&&phe(c))return c}},_j=He([Nr,fE,oc,mo],cme),lme=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:a}=n,o=Th(t,r);if(o&&(i==="number"||a!=="auto"))return e.map(s=>s.value)}},Tj=He([Nr,fE,qb,mo],lme),tQ=He([Nr,Hit,Yb,E2,_j,Tj,Xb,Cj,mo],(t,e,n,r,i,a,o,s,c)=>{if(e==null)return null;var l=Th(t,c);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:l,niceTicks:s,range:o,realScaleType:n,scale:r}}),Pat=(t,e,n,r,i,a,o,s,c)=>{if(!(e==null||r==null)){var l=Th(t,c),{type:u,ticks:f,tickCount:d}=e,h=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,m=u==="category"&&r.bandwidth?r.bandwidth()/h:0;m=c==="angleAxis"&&a!=null&&a.length>=2?Rc(a[0]-a[1])*2*m:m;var p=f||i;if(p){var y=p.map((x,S)=>{var C=o?o.indexOf(x):x;return{index:S,coordinate:r(C)+m,value:x,offset:m}});return y.filter(x=>!El(x.coordinate))}return l&&s?s.map((x,S)=>({coordinate:r(x)+m,value:x,index:S,offset:m})):r.ticks?r.ticks(d).map(x=>({coordinate:r(x)+m,value:x,offset:m})):r.domain().map((x,S)=>({coordinate:r(x)+m,value:o?o[x]:x,index:S,offset:m}))}},ume=He([Nr,qb,Yb,E2,Cj,Xb,_j,Tj,mo],Pat),kat=(t,e,n,r,i,a,o)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var s=Th(t,o),{tickCount:c}=e,l=0;return l=o==="angleAxis"&&r?.length>=2?Rc(r[0]-r[1])*2*l:l,s&&a?a.map((u,f)=>({coordinate:n(u)+l,value:u,index:f,offset:l})):n.ticks?n.ticks(c).map(u=>({coordinate:n(u)+l,value:u,offset:l})):n.domain().map((u,f)=>({coordinate:n(u)+l,value:i?i[u]:u,index:f,offset:l}))}},Jg=He([Nr,qb,E2,Xb,_j,Tj,mo],kat),ep=He(oc,E2,(t,e)=>{if(!(t==null||e==null))return uT(uT({},t),{},{scale:e})}),Aat=He([oc,Yb,bj,rme],Sj);He((t,e,n)=>vj(t,n),Aat,(t,e)=>{if(!(t==null||e==null))return uT(uT({},t),{},{scale:e})});var Lat=He([Nr,$8,j8],(t,e,n)=>{switch(t){case"horizontal":return e.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),fme=t=>t.options.defaultTooltipEventType,dme=t=>t.options.validateTooltipEventTypes;function hme(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function Ej(t,e){var n=fme(t),r=dme(t);return hme(e,n,r)}function Vat(t){return Jt(e=>Ej(e,t))}var gme=(t,e)=>{var n,r=Number(e);if(!(El(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},$at=t=>t.tooltip.settings,Sg={active:!1,index:null,dataKey:void 0,coordinate:void 0},jat={itemInteraction:{click:Sg,hover:Sg},axisInteraction:{click:Sg,hover:Sg},keyboardInteraction:Sg,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},pme=Nl({name:"tooltip",initialState:jat,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:Ws()},removeTooltipEntrySettings:{reducer(t,e){var n=Y0(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:Ws()},setTooltipSettingsState(t,e){t.settings=e.payload},setActiveMouseOverItemIndex(t,e){t.syncInteraction.active=!1,t.keyboardInteraction.active=!1,t.itemInteraction.hover.active=!0,t.itemInteraction.hover.index=e.payload.activeIndex,t.itemInteraction.hover.dataKey=e.payload.activeDataKey,t.itemInteraction.hover.coordinate=e.payload.activeCoordinate},mouseLeaveChart(t){t.itemInteraction.hover.active=!1,t.axisInteraction.hover.active=!1},mouseLeaveItem(t){t.itemInteraction.hover.active=!1},setActiveClickItemIndex(t,e){t.syncInteraction.active=!1,t.itemInteraction.click.active=!0,t.keyboardInteraction.active=!1,t.itemInteraction.click.index=e.payload.activeIndex,t.itemInteraction.click.dataKey=e.payload.activeDataKey,t.itemInteraction.click.coordinate=e.payload.activeCoordinate},setMouseOverAxisIndex(t,e){t.syncInteraction.active=!1,t.axisInteraction.hover.active=!0,t.keyboardInteraction.active=!1,t.axisInteraction.hover.index=e.payload.activeIndex,t.axisInteraction.hover.dataKey=e.payload.activeDataKey,t.axisInteraction.hover.coordinate=e.payload.activeCoordinate},setMouseClickAxisIndex(t,e){t.syncInteraction.active=!1,t.keyboardInteraction.active=!1,t.axisInteraction.click.active=!0,t.axisInteraction.click.index=e.payload.activeIndex,t.axisInteraction.click.dataKey=e.payload.activeDataKey,t.axisInteraction.click.coordinate=e.payload.activeCoordinate},setSyncInteraction(t,e){t.syncInteraction=e.payload},setKeyboardInteraction(t,e){t.keyboardInteraction.active=e.payload.active,t.keyboardInteraction.index=e.payload.activeIndex,t.keyboardInteraction.coordinate=e.payload.activeCoordinate,t.keyboardInteraction.dataKey=e.payload.activeDataKey}}}),{addTooltipEntrySettings:Uat,removeTooltipEntrySettings:Fat,setTooltipSettingsState:Bat,setActiveMouseOverItemIndex:mme,mouseLeaveItem:zat,mouseLeaveChart:vme,setActiveClickItemIndex:Gat,setMouseOverAxisIndex:yme,setMouseClickAxisIndex:Wat,setSyncInteraction:pP,setKeyboardInteraction:mP}=pme.actions,Hat=pme.reducer;function nQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function fS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nQ(Object(n),!0).forEach(function(r){qat(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function qat(t,e,n){return(e=Kat(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kat(t){var e=Yat(t,"string");return typeof e=="symbol"?e:e+""}function Yat(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Xat(t,e,n){return e==="axis"?n==="click"?t.axisInteraction.click:t.axisInteraction.hover:n==="click"?t.itemInteraction.click:t.itemInteraction.hover}function Zat(t){return t.index!=null}var xme=(t,e,n,r)=>{if(e==null)return Sg;var i=Xat(t,e,n);if(i==null)return Sg;if(i.active)return i;if(t.keyboardInteraction.active)return t.keyboardInteraction;if(t.syncInteraction.active&&t.syncInteraction.index!=null)return t.syncInteraction;var a=t.settings.active===!0;if(Zat(i)){if(a)return fS(fS({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r};return fS(fS({},Sg),{},{coordinate:i.coordinate})},Oj=(t,e)=>{var n=t?.index;if(n==null)return null;var r=Number(n);if(!Za(r))return n;var i=0,a=1/0;return e.length>0&&(a=e.length-1),String(Math.max(i,Math.min(r,a)))},wme=(t,e,n,r,i,a,o,s)=>{if(!(a==null||s==null)){var c=o[0],l=c==null?void 0:s(c.positions,a);if(l!=null)return l;var u=i?.[Number(a)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+e)/2};default:return{x:(r.left+t)/2,y:u.coordinate}}}},bme=(t,e,n,r)=>{if(e==="axis")return t.tooltipItemPayloads;if(t.tooltipItemPayloads.length===0)return[];var i;return n==="hover"?i=t.itemInteraction.hover.dataKey:i=t.itemInteraction.click.dataKey,i==null&&r!=null?[t.tooltipItemPayloads[0]]:t.tooltipItemPayloads.filter(a=>{var o;return((o=a.settings)===null||o===void 0?void 0:o.dataKey)===i})},Zb=t=>t.options.tooltipPayloadSearcher,O2=t=>t.tooltip;function rQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function iQ(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rQ(Object(n),!0).forEach(function(r){Qat(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Qat(t,e,n){return(e=Jat(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jat(t){var e=eot(t,"string");return typeof e=="symbol"?e:e+""}function eot(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tot(t,e){return t??e}var Sme=(t,e,n,r,i,a,o)=>{if(!(e==null||a==null)){var{chartData:s,computedData:c,dataStartIndex:l,dataEndIndex:u}=n,f=[];return t.reduce((d,h)=>{var m,{dataDefinedOnItem:p,settings:y}=h,x=tot(p,s),S=Array.isArray(x)?ige(x,l,u):x,C=(m=y?.dataKey)!==null&&m!==void 0?m:r,_=y?.nameKey,T;if(r&&Array.isArray(S)&&!Array.isArray(S[0])&&o==="axis"?T=mhe(S,r,i):T=a(S,e,c,_),Array.isArray(T))T.forEach(M=>{var I=iQ(iQ({},y),{},{name:M.name,unit:M.unit,color:void 0,fill:void 0});d.push(PX({tooltipEntrySettings:I,dataKey:M.dataKey,payload:M.payload,value:Po(M.payload,M.dataKey),name:M.name}))});else{var O;d.push(PX({tooltipEntrySettings:y,dataKey:C,payload:T,value:Po(T,C),name:(O=Po(T,_))!==null&&O!==void 0?O:y?.name}))}return d},f)}},Dj=He([yo,Nr,Ipe,fj,vo],Jpe),not=He([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),rot=He([vo,C2],Npe),Qb=He([not,yo,rot],Ppe,{memoizeOptions:{resultEqualityCheck:lE}}),iot=He([Qb],t=>t.filter(sE)),aot=He([Qb],Lpe,{memoizeOptions:{resultEqualityCheck:lE}}),D2=He([aot,wp],Vpe),oot=He([iot,wp,yo],Dpe),Mj=He([D2,yo,Qb],$pe),Cme=He([yo],xj),sot=He([yo],t=>t.allowDataOverflow),_me=He([Cme,sot],ipe),cot=He([Qb],t=>t.filter(sE)),lot=He([oot,cot,nE],Upe),uot=He([lot,wp,vo,_me],Fpe),fot=He([Qb],Ape),dot=He([D2,yo,fot,wj,vo],Gpe,{memoizeOptions:{resultEqualityCheck:cE}}),hot=He([Wpe,vo,C2],T2),got=He([hot,vo],Kpe),pot=He([Hpe,vo,C2],T2),mot=He([pot,vo],Ype),vot=He([qpe,vo,C2],T2),yot=He([vot,vo],Xpe),xot=He([got,yot,mot],fT),wot=He([yo,Cme,_me,uot,dot,xot,Nr,vo],Zpe),Tme=He([yo,Nr,D2,Mj,nE,vo,wot],Qpe),bot=He([Tme,yo,Dj],eme),Sot=He([yo,Tme,bot,vo],tme),Eme=t=>{var e=vo(t),n=C2(t),r=!1;return Xb(t,e,n,r)},Ome=He([yo,Eme],rE),Dme=He([yo,Dj,Sot,Ome],Sj),Cot=He([Nr,Mj,yo,vo],cme),_ot=He([Nr,Mj,yo,vo],lme),Tot=(t,e,n,r,i,a,o,s)=>{if(e){var{type:c}=e,l=Th(t,s);if(r){var u=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=c==="category"&&r.bandwidth?r.bandwidth()/u:0;return f=s==="angleAxis"&&i!=null&&i?.length>=2?Rc(i[0]-i[1])*2*f:f,l&&o?o.map((d,h)=>({coordinate:r(d)+f,value:d,index:h,offset:f})):r.domain().map((d,h)=>({coordinate:r(d)+f,value:a?a[d]:d,index:h,offset:f}))}}},Ih=He([Nr,yo,Dj,Dme,Eme,Cot,_ot,vo],Tot),Rj=He([fme,dme,$at],(t,e,n)=>hme(n.shared,t,e)),Mme=t=>t.tooltip.settings.trigger,Ij=t=>t.tooltip.settings.defaultIndex,gE=He([O2,Rj,Mme,Ij],xme),e1=He([gE,D2],Oj),Rme=He([Ih,e1],gme),Ime=He([gE],t=>{if(t)return t.dataKey}),Nme=He([O2,Rj,Mme,Ij],bme),Eot=He([Eh,Oh,Nr,Vo,Ih,Ij,Nme,Zb],wme),Oot=He([gE,Eot],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Dot=He([gE],t=>t.active),Mot=He([Nme,e1,wp,Ope,Rme,Zb,Rj],Sme),Rot=He([Mot],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function aQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function oQ(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?aQ(Object(n),!0).forEach(function(r){Iot(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):aQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Iot(t,e,n){return(e=Not(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Not(t){var e=Pot(t,"string");return typeof e=="symbol"?e:e+""}function Pot(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var kot=()=>Jt(yo),Aot=()=>{var t=kot(),e=Jt(Ih),n=Jt(Dme);return Pw(oQ(oQ({},t),{},{scale:n}),e)},Pme=()=>Jt(fj),Nj=(t,e)=>e,kme=(t,e,n)=>n,Pj=(t,e,n,r)=>r,Lot=He(Ih,t=>I8(t,e=>e.coordinate)),kj=He([O2,Nj,kme,Pj],xme),Ame=He([kj,D2],Oj),Vot=(t,e,n)=>{if(e!=null){var r=O2(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},Lme=He([O2,Nj,kme,Pj],bme),dT=He([Eh,Oh,Nr,Vo,Ih,Pj,Lme,Zb],wme),$ot=He([kj,dT],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),Vme=He(Ih,Ame,gme),jot=He([Lme,Ame,wp,Ope,Vme,Zb,Nj],Sme),Uot=He([kj],t=>({isActive:t.active,activeIndex:t.index})),Fot=(t,e,n,r,i,a,o,s)=>{if(!(!t||!e||!r||!i||!a)){var c=IJe(t.chartX,t.chartY,e,n,s);if(c){var l=PJe(c,e),u=xJe(l,o,a,r,i),f=NJe(e,a,u,c);return{activeIndex:String(u),activeCoordinate:f}}}};function vP(){return vP=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},vP.apply(null,arguments)}function sQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function dS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?sQ(Object(n),!0).forEach(function(r){Bot(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Bot(t,e,n){return(e=zot(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zot(t){var e=Got(t,"string");return typeof e=="symbol"?e:e+""}function Got(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Wot(t){var{coordinate:e,payload:n,index:r,offset:i,tooltipAxisBandSize:a,layout:o,cursor:s,tooltipEventType:c,chartName:l}=t,u=e,f=n,d=r;if(!s||!u||l!=="ScatterChart"&&c!=="axis")return null;var h,m;if(l==="ScatterChart")h=u,m=ttt;else if(l==="BarChart")h=ntt(o,u,i,a),m=xge;else if(o==="radial"){var{cx:p,cy:y,radius:x,startAngle:S,endAngle:C}=wge(u);h={cx:p,cy:y,startAngle:S,endAngle:C,innerRadius:x,outerRadius:x},m=Sge}else h={points:jtt(o,u,i)},m=gC;var _=typeof s=="object"&&"className"in s?s.className:void 0,T=dS(dS(dS(dS({stroke:"#ccc",pointerEvents:"none"},i),h),$b(s)),{},{payload:f,payloadIndex:d,className:$r("recharts-tooltip-cursor",_)});return D.isValidElement(s)?D.cloneElement(s,T):D.createElement(m,T)}function Hot(t){var e=Aot(),n=dge(),r=z8(),i=Pme();return D.createElement(Wot,vP({},t,{coordinate:t.coordinate,index:t.index,payload:t.payload,offset:n,layout:r,tooltipAxisBandSize:e,chartName:i}))}var $me=D.createContext(null),qot=()=>D.useContext($me),$M={exports:{}},cQ;function Kot(){return cQ||(cQ=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,l,u){this.fn=c,this.context=l,this.once=u||!1}function a(c,l,u,f,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var h=new i(u,f||c,d),m=n?n+l:l;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],h]:c._events[m].push(h):(c._events[m]=h,c._eventsCount++),c}function o(c,l){--c._eventsCount===0?c._events=new r:delete c._events[l]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var l=[],u,f;if(this._eventsCount===0)return l;for(f in u=this._events)e.call(u,f)&&l.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},s.prototype.listeners=function(l){var u=n?n+l:l,f=this._events[u];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,h=f.length,m=new Array(h);d<h;d++)m[d]=f[d].fn;return m},s.prototype.listenerCount=function(l){var u=n?n+l:l,f=this._events[u];return f?f.fn?1:f.length:0},s.prototype.emit=function(l,u,f,d,h,m){var p=n?n+l:l;if(!this._events[p])return!1;var y=this._events[p],x=arguments.length,S,C;if(y.fn){switch(y.once&&this.removeListener(l,y.fn,void 0,!0),x){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,u),!0;case 3:return y.fn.call(y.context,u,f),!0;case 4:return y.fn.call(y.context,u,f,d),!0;case 5:return y.fn.call(y.context,u,f,d,h),!0;case 6:return y.fn.call(y.context,u,f,d,h,m),!0}for(C=1,S=new Array(x-1);C<x;C++)S[C-1]=arguments[C];y.fn.apply(y.context,S)}else{var _=y.length,T;for(C=0;C<_;C++)switch(y[C].once&&this.removeListener(l,y[C].fn,void 0,!0),x){case 1:y[C].fn.call(y[C].context);break;case 2:y[C].fn.call(y[C].context,u);break;case 3:y[C].fn.call(y[C].context,u,f);break;case 4:y[C].fn.call(y[C].context,u,f,d);break;default:if(!S)for(T=1,S=new Array(x-1);T<x;T++)S[T-1]=arguments[T];y[C].fn.apply(y[C].context,S)}}return!0},s.prototype.on=function(l,u,f){return a(this,l,u,f,!1)},s.prototype.once=function(l,u,f){return a(this,l,u,f,!0)},s.prototype.removeListener=function(l,u,f,d){var h=n?n+l:l;if(!this._events[h])return this;if(!u)return o(this,h),this;var m=this._events[h];if(m.fn)m.fn===u&&(!d||m.once)&&(!f||m.context===f)&&o(this,h);else{for(var p=0,y=[],x=m.length;p<x;p++)(m[p].fn!==u||d&&!m[p].once||f&&m[p].context!==f)&&y.push(m[p]);y.length?this._events[h]=y.length===1?y[0]:y:o(this,h)}return this},s.prototype.removeAllListeners=function(l){var u;return l?(u=n?n+l:l,this._events[u]&&o(this,u)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s})($M)),$M.exports}var Yot=Kot();const Xot=ka(Yot);var Fw=new Xot,yP="recharts.syncEvent.tooltip",lQ="recharts.syncEvent.brush";function jme(t,e){if(e){var n=Number.parseInt(e,10);if(!El(n))return t?.[n]}}var Zot={chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},Ume=Nl({name:"options",initialState:Zot,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Qot=Ume.reducer,{createEventEmitter:Jot}=Ume.actions;function est(t){return t.tooltip.syncInteraction}var tst={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},Fme=Nl({name:"chartData",initialState:tst,reducers:{setChartData(t,e){if(t.chartData=e.payload,e.payload==null){t.dataStartIndex=0,t.dataEndIndex=0;return}e.payload.length>0&&t.dataEndIndex!==e.payload.length-1&&(t.dataEndIndex=e.payload.length-1)},setComputedData(t,e){t.computedData=e.payload},setDataStartEndIndexes(t,e){var{startIndex:n,endIndex:r}=e.payload;n!=null&&(t.dataStartIndex=n),r!=null&&(t.dataEndIndex=r)}}}),{setChartData:uQ,setDataStartEndIndexes:nst,setComputedData:KYt}=Fme.actions,rst=Fme.reducer,ist=["x","y"];function fQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fQ(Object(n),!0).forEach(function(r){ast(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ast(t,e,n){return(e=ost(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ost(t){var e=sst(t,"string");return typeof e=="symbol"?e:e+""}function sst(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function cst(t,e){if(t==null)return{};var n,r,i=lst(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function lst(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Bme=()=>{};function ust(){var t=Jt(dj),e=Jt(hj),n=Aa(),r=Jt(bpe),i=Jt(Ih),a=z8(),o=B8(),s=Jt(c=>c.rootProps.className);D.useEffect(()=>{if(t==null)return Bme;var c=(l,u,f)=>{if(e!==f&&t===l){if(r==="index"){var d;if(o&&u!==null&&u!==void 0&&(d=u.payload)!==null&&d!==void 0&&d.coordinate&&u.payload.sourceViewBox){var h=u.payload.coordinate,{x:m,y:p}=h,y=cst(h,ist),{x,y:S,width:C,height:_}=u.payload.sourceViewBox,T=gv(gv({},y),{},{x:o.x+(C?(m-x)/C:0)*o.width,y:o.y+(_?(p-S)/_:0)*o.height});n(gv(gv({},u),{},{payload:gv(gv({},u.payload),{},{coordinate:T})}))}else n(u);return}if(i!=null){var O;if(typeof r=="function"){var M={activeTooltipIndex:u.payload.index==null?void 0:Number(u.payload.index),isTooltipActive:u.payload.active,activeIndex:u.payload.index==null?void 0:Number(u.payload.index),activeLabel:u.payload.label,activeDataKey:u.payload.dataKey,activeCoordinate:u.payload.coordinate},I=r(i,M);O=i[I]}else r==="value"&&(O=i.find(U=>String(U.value)===u.payload.label));var{coordinate:V}=u.payload;if(O==null||u.payload.active===!1||V==null||o==null){n(pP({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0}));return}var{x:k,y:L}=V,$=Math.min(k,o.x+o.width),W=Math.min(L,o.y+o.height),G={x:a==="horizontal"?O.coordinate:$,y:a==="horizontal"?W:O.coordinate},oe=pP({active:u.payload.active,coordinate:G,dataKey:u.payload.dataKey,index:String(O.index),label:u.payload.label,sourceViewBox:u.payload.sourceViewBox});n(oe)}}};return Fw.on(yP,c),()=>{Fw.off(yP,c)}},[s,n,e,t,r,i,a,o])}function fst(){var t=Jt(dj),e=Jt(hj),n=Aa();D.useEffect(()=>{if(t==null)return Bme;var r=(i,a,o)=>{e!==o&&t===i&&n(nst(a))};return Fw.on(lQ,r),()=>{Fw.off(lQ,r)}},[n,e,t])}function dst(){var t=Aa();D.useEffect(()=>{t(Jot())},[t]),ust(),fst()}function hst(t,e,n,r,i,a){var o=Jt(h=>Vot(h,t,e)),s=Jt(hj),c=Jt(dj),l=Jt(bpe),u=Jt(est),f=u?.active,d=B8();D.useEffect(()=>{if(!f&&c!=null&&s!=null){var h=pP({active:a,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:d});Fw.emit(yP,c,h,s)}},[f,n,o,i,r,s,c,l,a,d])}function dQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function hQ(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dQ(Object(n),!0).forEach(function(r){gst(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gst(t,e,n){return(e=pst(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pst(t){var e=mst(t,"string");return typeof e=="symbol"?e:e+""}function mst(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function vst(t){return t.dataKey}function yst(t,e){return D.isValidElement(t)?D.cloneElement(t,e):typeof t=="function"?D.createElement(t,e):D.createElement(Pet,e)}var gQ=[],xst={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,isAnimationActive:!_1.isSsr,itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function wst(t){var e=Fc(t,xst),{active:n,allowEscapeViewBox:r,animationDuration:i,animationEasing:a,content:o,filterNull:s,isAnimationActive:c,offset:l,payloadUniqBy:u,position:f,reverseDirection:d,useTranslate3d:h,wrapperStyle:m,cursor:p,shared:y,trigger:x,defaultIndex:S,portal:C,axisId:_}=e,T=Aa(),O=typeof S=="number"?String(S):S;D.useEffect(()=>{T(Bat({shared:y,trigger:x,axisId:_,active:n,defaultIndex:O}))},[T,y,x,_,n,O]);var M=B8(),I=gge(),V=Vat(y),{activeIndex:k,isActive:L}=Jt(we=>Uot(we,V,x,O)),$=Jt(we=>jot(we,V,x,O)),W=Jt(we=>Vme(we,V,x,O)),G=Jt(we=>$ot(we,V,x,O)),oe=$,U=qot(),Y=n??L,[J,ne]=Ihe([oe,Y]),F=V==="axis"?W:void 0;hst(V,x,G,F,k,Y);var ae=C??U;if(ae==null)return null;var re=oe??gQ;Y||(re=gQ),s&&re.length&&(re=Ehe(oe.filter(we=>we.value!=null&&(we.hide!==!0||e.includeHidden)),u,vst));var te=re.length>0,ye=D.createElement(Uet,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:c,active:Y,coordinate:G,hasPayload:te,offset:l,position:f,reverseDirection:d,useTranslate3d:h,viewBox:M,wrapperStyle:m,lastBoundingBox:J,innerRef:ne,hasPortalFromProps:!!C},yst(o,hQ(hQ({},e),{},{payload:re,label:F,active:Y,coordinate:G,accessibilityLayer:I})));return D.createElement(D.Fragment,null,x1.createPortal(ye,ae),Y&&D.createElement(Hot,{cursor:p,tooltipEventType:V,coordinate:G,payload:oe,index:k}))}var zme=t=>null;zme.displayName="Cell";function bst(t,e,n){return(e=Sst(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Sst(t){var e=Cst(t,"string");return typeof e=="symbol"?e:e+""}function Cst(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class _st{constructor(e){bst(this,"cache",new Map),this.maxSize=e}get(e){var n=this.cache.get(e);return n!==void 0&&(this.cache.delete(e),this.cache.set(e,n)),n}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;this.cache.delete(r)}this.cache.set(e,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function pQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Tst(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pQ(Object(n),!0).forEach(function(r){Est(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Est(t,e,n){return(e=Ost(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ost(t){var e=Dst(t,"string");return typeof e=="symbol"?e:e+""}function Dst(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Mst={cacheSize:2e3,enableCache:!0},Gme=Tst({},Mst),mQ=new _st(Gme.cacheSize),Rst={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},vQ="recharts_measurement_span";function Ist(t,e){var n=e.fontSize||"",r=e.fontFamily||"",i=e.fontWeight||"",a=e.fontStyle||"",o=e.letterSpacing||"",s=e.textTransform||"";return"".concat(t,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(a,"|").concat(o,"|").concat(s)}var yQ=(t,e)=>{try{var n=document.getElementById(vQ);n||(n=document.createElement("span"),n.setAttribute("id",vQ),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Rst,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},U5=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||_1.isSsr)return{width:0,height:0};if(!Gme.enableCache)return yQ(e,n);var r=Ist(e,n),i=mQ.get(r);if(i)return i;var a=yQ(e,n);return mQ.set(r,a),a},xQ=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,wQ=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Nst=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Pst=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Wme={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},kst=Object.keys(Wme),Gv="NaN";function Ast(t,e){return t*Wme[e]}class Ec{static parse(e){var n,[,r,i]=(n=Pst.exec(e))!==null&&n!==void 0?n:[];return new Ec(parseFloat(r),i??"")}constructor(e,n){this.num=e,this.unit=n,this.num=e,this.unit=n,El(e)&&(this.unit=""),n!==""&&!Nst.test(n)&&(this.num=NaN,this.unit=""),kst.includes(n)&&(this.num=Ast(e,n),this.unit="px")}add(e){return this.unit!==e.unit?new Ec(NaN,""):new Ec(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Ec(NaN,""):new Ec(this.num-e.num,this.unit)}multiply(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ec(NaN,""):new Ec(this.num*e.num,this.unit||e.unit)}divide(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ec(NaN,""):new Ec(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return El(this.num)}}function Hme(t){if(t.includes(Gv))return Gv;for(var e=t;e.includes("*")||e.includes("/");){var n,[,r,i,a]=(n=xQ.exec(e))!==null&&n!==void 0?n:[],o=Ec.parse(r??""),s=Ec.parse(a??""),c=i==="*"?o.multiply(s):o.divide(s);if(c.isNaN())return Gv;e=e.replace(xQ,c.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var l,[,u,f,d]=(l=wQ.exec(e))!==null&&l!==void 0?l:[],h=Ec.parse(u??""),m=Ec.parse(d??""),p=f==="+"?h.add(m):h.subtract(m);if(p.isNaN())return Gv;e=e.replace(wQ,p.toString())}return e}var bQ=/\(([^()]*)\)/;function Lst(t){for(var e=t,n;(n=bQ.exec(e))!=null;){var[,r]=n;e=e.replace(bQ,Hme(r))}return e}function Vst(t){var e=t.replace(/\s+/g,"");return e=Lst(e),e=Hme(e),e}function $st(t){try{return Vst(t)}catch{return Gv}}function jM(t){var e=$st(t.slice(5,-1));return e===Gv?"":e}var jst=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],Ust=["dx","dy","angle","className","breakAll"];function xP(){return xP=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},xP.apply(null,arguments)}function SQ(t,e){if(t==null)return{};var n,r,i=Fst(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Fst(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var qme=/[ \f\n\r\t\v\u2028\u2029]+/,Kme=t=>{var{children:e,breakAll:n,style:r}=t;try{var i=[];ta(e)||(n?i=e.toString().split(""):i=e.toString().split(qme));var a=i.map(s=>({word:s,width:U5(s,r).width})),o=n?0:U5(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch{return null}},Bst=(t,e,n,r,i)=>{var{maxLines:a,children:o,style:s,breakAll:c}=t,l=qt(a),u=o,f=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return L.reduce(($,W)=>{var{word:G,width:oe}=W,U=$[$.length-1];if(U&&(r==null||i||U.width+oe+n<Number(r)))U.words.push(G),U.width+=oe+n;else{var Y={words:[G],width:oe};$.push(Y)}return $},[])},d=f(e),h=k=>k.reduce((L,$)=>L.width>$.width?L:$);if(!l||i)return d;var m=d.length>a||h(d).width>Number(r);if(!m)return d;for(var p="…",y=k=>{var L=u.slice(0,k),$=Kme({breakAll:c,style:s,children:L+p}).wordsWithComputedWidth,W=f($),G=W.length>a||h(W).width>Number(r);return[G,W]},x=0,S=u.length-1,C=0,_;x<=S&&C<=u.length-1;){var T=Math.floor((x+S)/2),O=T-1,[M,I]=y(O),[V]=y(T);if(!M&&!V&&(x=T+1),M&&V&&(S=T-1),!M&&V){_=I;break}C++}return _||d},CQ=t=>{var e=ta(t)?[]:t.toString().split(qme);return[{words:e}]},zst=t=>{var{width:e,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=t;if((e||n)&&!_1.isSsr){var s,c,l=Kme({breakAll:a,children:r,style:i});if(l){var{wordsWithComputedWidth:u,spaceWidth:f}=l;s=u,c=f}else return CQ(r);return Bst({breakAll:a,children:r,maxLines:o,style:i},s,c,e,n)}return CQ(r)},_Q="#808080",Aj=D.forwardRef((t,e)=>{var{x:n=0,y:r=0,lineHeight:i="1em",capHeight:a="0.71em",scaleToFit:o=!1,textAnchor:s="start",verticalAnchor:c="end",fill:l=_Q}=t,u=SQ(t,jst),f=D.useMemo(()=>zst({breakAll:u.breakAll,children:u.children,maxLines:u.maxLines,scaleToFit:o,style:u.style,width:u.width}),[u.breakAll,u.children,u.maxLines,o,u.style,u.width]),{dx:d,dy:h,angle:m,className:p,breakAll:y}=u,x=SQ(u,Ust);if(!bd(n)||!bd(r)||f.length===0)return null;var S=n+(qt(d)?d:0),C=r+(qt(h)?h:0),_;switch(c){case"start":_=jM("calc(".concat(a,")"));break;case"middle":_=jM("calc(".concat((f.length-1)/2," * -").concat(i," + (").concat(a," / 2))"));break;default:_=jM("calc(".concat(f.length-1," * -").concat(i,")"));break}var T=[];if(o){var O=f[0].width,{width:M}=u;T.push("scale(".concat(qt(M)?M/O:1,")"))}return m&&T.push("rotate(".concat(m,", ").concat(S,", ").concat(C,")")),T.length&&(x.transform=T.join(" ")),D.createElement("text",xP({},Lc(x),{ref:e,x:S,y:C,className:$r("recharts-text",p),textAnchor:s,fill:l.includes("url")?_Q:l}),f.map((I,V)=>{var k=I.words.join(y?"":" ");return D.createElement("tspan",{x:S,dy:V===0?_:i,key:"".concat(k,"-").concat(V)},k)}))});Aj.displayName="Text";var Gst=["labelRef"];function Wst(t,e){if(t==null)return{};var n,r,i=Hst(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Hst(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function TQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ea(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?TQ(Object(n),!0).forEach(function(r){qst(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):TQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function qst(t,e,n){return(e=Kst(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kst(t){var e=Yst(t,"string");return typeof e=="symbol"?e:e+""}function Yst(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function O0(){return O0=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},O0.apply(null,arguments)}var Yme=D.createContext(null),Xst=t=>{var{x:e,y:n,width:r,height:i,children:a}=t,o=D.useMemo(()=>({x:e,y:n,width:r,height:i}),[e,n,r,i]);return D.createElement(Yme.Provider,{value:o},a)},Xme=()=>{var t=D.useContext(Yme),e=B8();return t||e},Zst=D.createContext(null),Qst=()=>{var t=D.useContext(Zst),e=Jt(Epe);return t||e},Jst=t=>{var{value:e,formatter:n}=t,r=ta(t.children)?e:t.children;return typeof n=="function"?n(r):r},Lj=t=>t!=null&&typeof t=="function",ect=(t,e)=>{var n=Rc(e-t),r=Math.min(Math.abs(e-t),360);return n*r},tct=(t,e,n,r,i)=>{var{offset:a,className:o}=t,{cx:s,cy:c,innerRadius:l,outerRadius:u,startAngle:f,endAngle:d,clockWise:h}=i,m=(l+u)/2,p=ect(f,d),y=p>=0?1:-1,x,S;switch(e){case"insideStart":x=f+y*a,S=h;break;case"insideEnd":x=d-y*a,S=!h;break;case"end":x=d+y*a,S=h;break;default:throw new Error("Unsupported position ".concat(e))}S=p<=0?S:!S;var C=ts(s,c,m,x),_=ts(s,c,m,x+(S?1:-1)*359),T="M".concat(C.x,",").concat(C.y,`
    A`).concat(m,",").concat(m,",0,1,").concat(S?0:1,`,
    `).concat(_.x,",").concat(_.y),O=ta(t.id)?Rw("recharts-radial-line-"):t.id;return D.createElement("text",O0({},r,{dominantBaseline:"central",className:$r("recharts-radial-bar-label",o)}),D.createElement("defs",null,D.createElement("path",{id:O,d:T})),D.createElement("textPath",{xlinkHref:"#".concat(O)},n))},nct=(t,e,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:c}=t,l=(s+c)/2;if(n==="outside"){var{x:u,y:f}=ts(r,i,o+e,l);return{x:u,y:f,textAnchor:u>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var d=(a+o)/2,{x:h,y:m}=ts(r,i,d,l);return{x:h,y:m,textAnchor:"middle",verticalAnchor:"middle"}},Zme=t=>"cx"in t&&qt(t.cx),rct=(t,e)=>{var{parentViewBox:n,offset:r,position:i}=t,a;n!=null&&!Zme(n)&&(a=n);var{x:o,y:s,width:c,height:l}=e,u=l>=0?1:-1,f=u*r,d=u>0?"end":"start",h=u>0?"start":"end",m=c>=0?1:-1,p=m*r,y=m>0?"end":"start",x=m>0?"start":"end";if(i==="top"){var S={x:o+c/2,y:s-u*r,textAnchor:"middle",verticalAnchor:d};return Ea(Ea({},S),a?{height:Math.max(s-a.y,0),width:c}:{})}if(i==="bottom"){var C={x:o+c/2,y:s+l+f,textAnchor:"middle",verticalAnchor:h};return Ea(Ea({},C),a?{height:Math.max(a.y+a.height-(s+l),0),width:c}:{})}if(i==="left"){var _={x:o-p,y:s+l/2,textAnchor:y,verticalAnchor:"middle"};return Ea(Ea({},_),a?{width:Math.max(_.x-a.x,0),height:l}:{})}if(i==="right"){var T={x:o+c+p,y:s+l/2,textAnchor:x,verticalAnchor:"middle"};return Ea(Ea({},T),a?{width:Math.max(a.x+a.width-T.x,0),height:l}:{})}var O=a?{width:c,height:l}:{};return i==="insideLeft"?Ea({x:o+p,y:s+l/2,textAnchor:x,verticalAnchor:"middle"},O):i==="insideRight"?Ea({x:o+c-p,y:s+l/2,textAnchor:y,verticalAnchor:"middle"},O):i==="insideTop"?Ea({x:o+c/2,y:s+f,textAnchor:"middle",verticalAnchor:h},O):i==="insideBottom"?Ea({x:o+c/2,y:s+l-f,textAnchor:"middle",verticalAnchor:d},O):i==="insideTopLeft"?Ea({x:o+p,y:s+f,textAnchor:x,verticalAnchor:h},O):i==="insideTopRight"?Ea({x:o+c-p,y:s+f,textAnchor:y,verticalAnchor:h},O):i==="insideBottomLeft"?Ea({x:o+p,y:s+l-f,textAnchor:x,verticalAnchor:d},O):i==="insideBottomRight"?Ea({x:o+c-p,y:s+l-f,textAnchor:y,verticalAnchor:d},O):i&&typeof i=="object"&&(qt(i.x)||hh(i.x))&&(qt(i.y)||hh(i.y))?Ea({x:o+pf(i.x,c),y:s+pf(i.y,l),textAnchor:"end",verticalAnchor:"end"},O):Ea({x:o+c/2,y:s+l/2,textAnchor:"middle",verticalAnchor:"middle"},O)},ict={offset:5};function vg(t){var e=Fc(t,ict),{viewBox:n,position:r,value:i,children:a,content:o,className:s="",textBreakAll:c,labelRef:l}=e,u=Qst(),f=Xme(),d=r==="center"?f:u??f,h=n||d;if(!h||ta(i)&&ta(a)&&!D.isValidElement(o)&&typeof o!="function")return null;var m=Ea(Ea({},e),{},{viewBox:h});if(D.isValidElement(o)){var{labelRef:p}=m,y=Wst(m,Gst);return D.cloneElement(o,y)}var x;if(typeof o=="function"){if(x=D.createElement(o,m),D.isValidElement(x))return x}else x=Jst(e);var S=Zme(h),C=Lc(e);if(S&&(r==="insideStart"||r==="insideEnd"||r==="end"))return tct(e,r,x,C,h);var _=S?nct(h,e.offset,e.position):rct(e,h);return D.createElement(Aj,O0({ref:l,className:$r("recharts-label",s)},C,_,{breakAll:c}),x)}vg.displayName="Label";var act=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?D.createElement(vg,O0({key:"label-implicit"},r)):bd(t)?D.createElement(vg,O0({key:"label-implicit",value:t},r)):D.isValidElement(t)?t.type===vg?D.cloneElement(t,Ea({key:"label-implicit"},r)):D.createElement(vg,O0({key:"label-implicit",content:t},r)):Lj(t)?D.createElement(vg,O0({key:"label-implicit",content:t},r)):t&&typeof t=="object"?D.createElement(vg,O0({},t,{key:"label-implicit"},r)):null};function oct(t){var{label:e,labelRef:n}=t,r=Xme();return act(e,r,n)||null}var UM={},FM={},EQ;function sct(){return EQ||(EQ=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n[n.length-1]}t.last=e})(FM)),FM}var BM={},OQ;function cct(){return OQ||(OQ=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Array.isArray(n)?n:Array.from(n)}t.toArray=e})(BM)),BM}var DQ;function lct(){return DQ||(DQ=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=sct(),n=cct(),r=O$();function i(a){if(r.isArrayLike(a))return e.last(n.toArray(a))}t.last=i})(UM)),UM}var zM,MQ;function uct(){return MQ||(MQ=1,zM=lct().last),zM}var fct=uct();const dct=ka(fct);var hct=["valueAccessor"],gct=["dataKey","clockWise","id","textBreakAll"];function hT(){return hT=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},hT.apply(null,arguments)}function RQ(t,e){if(t==null)return{};var n,r,i=pct(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function pct(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var mct=t=>Array.isArray(t.value)?dct(t.value):t.value,Qme=D.createContext(void 0),Jme=Qme.Provider,e1e=D.createContext(void 0);e1e.Provider;function vct(){return D.useContext(Qme)}function yct(){return D.useContext(e1e)}function mC(t){var{valueAccessor:e=mct}=t,n=RQ(t,hct),{dataKey:r,clockWise:i,id:a,textBreakAll:o}=n,s=RQ(n,gct),c=vct(),l=yct(),u=c||l;return!u||!u.length?null:D.createElement(Vc,{className:"recharts-label-list"},u.map((f,d)=>{var h,m=ta(r)?e(f,d):Po(f&&f.payload,r),p=ta(a)?{}:{id:"".concat(a,"-").concat(d)};return D.createElement(vg,hT({key:"label-".concat(d)},Lc(f),s,p,{fill:(h=n.fill)!==null&&h!==void 0?h:f.fill,parentViewBox:f.parentViewBox,value:m,textBreakAll:o,viewBox:f.viewBox,index:d}))}))}mC.displayName="LabelList";function t1e(t){var{label:e}=t;return e?e===!0?D.createElement(mC,{key:"labelList-implicit"}):D.isValidElement(e)||Lj(e)?D.createElement(mC,{key:"labelList-implicit",content:e}):typeof e=="object"?D.createElement(mC,hT({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function wP(){return wP=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},wP.apply(null,arguments)}var n1e=t=>{var{cx:e,cy:n,r,className:i}=t,a=$r("recharts-dot",i);return e===+e&&n===+n&&r===+r?D.createElement("circle",wP({},bu(t),_$(t),{className:a,cx:e,cy:n,r})):null},xct={radiusAxis:{},angleAxis:{}},r1e=Nl({name:"polarAxis",initialState:xct,reducers:{addRadiusAxis(t,e){t.radiusAxis[e.payload.id]=e.payload},removeRadiusAxis(t,e){delete t.radiusAxis[e.payload.id]},addAngleAxis(t,e){t.angleAxis[e.payload.id]=e.payload},removeAngleAxis(t,e){delete t.angleAxis[e.payload.id]}}}),{addRadiusAxis:YYt,removeRadiusAxis:XYt,addAngleAxis:ZYt,removeAngleAxis:QYt}=r1e.actions,wct=r1e.reducer,GM={exports:{}},ti={};/**
 * @license React
 * react-is.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 IQ;function bct(){if(IQ)return ti;IQ=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"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),d=Symbol.for("react.view_transition"),h=Symbol.for("react.client.reference");function m(p){if(typeof p=="object"&&p!==null){var y=p.$$typeof;switch(y){case t:switch(p=p.type,p){case n:case i:case r:case c:case l:case d:return p;default:switch(p=p&&p.$$typeof,p){case o:case s:case f:case u:return p;case a:return p;default:return y}}case e:return y}}}return ti.ContextConsumer=a,ti.ContextProvider=o,ti.Element=t,ti.ForwardRef=s,ti.Fragment=n,ti.Lazy=f,ti.Memo=u,ti.Portal=e,ti.Profiler=i,ti.StrictMode=r,ti.Suspense=c,ti.SuspenseList=l,ti.isContextConsumer=function(p){return m(p)===a},ti.isContextProvider=function(p){return m(p)===o},ti.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===t},ti.isForwardRef=function(p){return m(p)===s},ti.isFragment=function(p){return m(p)===n},ti.isLazy=function(p){return m(p)===f},ti.isMemo=function(p){return m(p)===u},ti.isPortal=function(p){return m(p)===e},ti.isProfiler=function(p){return m(p)===i},ti.isStrictMode=function(p){return m(p)===r},ti.isSuspense=function(p){return m(p)===c},ti.isSuspenseList=function(p){return m(p)===l},ti.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===i||p===r||p===c||p===l||typeof p=="object"&&p!==null&&(p.$$typeof===f||p.$$typeof===u||p.$$typeof===o||p.$$typeof===a||p.$$typeof===s||p.$$typeof===h||p.getModuleId!==void 0)},ti.typeOf=m,ti}var NQ;function Sct(){return NQ||(NQ=1,GM.exports=bct()),GM.exports}var Cct=Sct(),PQ=t=>typeof t=="string"?t:t?t.displayName||t.name||"Component":"",kQ=null,WM=null,i1e=t=>{if(t===kQ&&Array.isArray(WM))return WM;var e=[];return D.Children.forEach(t,n=>{ta(n)||(Cct.isFragment(n)?e=e.concat(i1e(n.props.children)):e.push(n))}),WM=e,kQ=t,e};function _ct(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(i=>PQ(i)):r=[PQ(e)],i1e(t).forEach(i=>{var a=Iy(i,"type.displayName")||Iy(i,"type.name");r.indexOf(a)!==-1&&n.push(i)}),n}var a1e=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0,HM={},AQ;function Tct(){return AQ||(AQ=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const i=n[Symbol.toStringTag];return i==null||!Object.getOwnPropertyDescriptor(n,Symbol.toStringTag)?.writable?!1:n.toString()===`[object ${i}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}t.isPlainObject=e})(HM)),HM}var qM,LQ;function Ect(){return LQ||(LQ=1,qM=Tct().isPlainObject),qM}var Oct=Ect();const Dct=ka(Oct);function VQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function $Q(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?VQ(Object(n),!0).forEach(function(r){Mct(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):VQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Mct(t,e,n){return(e=Rct(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Rct(t){var e=Ict(t,"string");return typeof e=="symbol"?e:e+""}function Ict(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function gT(){return gT=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},gT.apply(null,arguments)}var jQ=(t,e,n,r,i)=>{var a=n-r,o;return o="M ".concat(t,",").concat(e),o+="L ".concat(t+n,",").concat(e),o+="L ".concat(t+n-a/2,",").concat(e+i),o+="L ".concat(t+n-a/2-r,",").concat(e+i),o+="L ".concat(t,",").concat(e," Z"),o},Nct={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Pct=t=>{var e=Fc(t,Nct),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=e,{animationEasing:c,animationDuration:l,animationBegin:u,isUpdateAnimationActive:f}=e,d=D.useRef(null),[h,m]=D.useState(-1),p=D.useRef(i),y=D.useRef(a),x=D.useRef(o),S=D.useRef(n),C=D.useRef(r),_=q8(t,"trapezoid-");if(D.useEffect(()=>{if(d.current&&d.current.getTotalLength)try{var G=d.current.getTotalLength();G&&m(G)}catch{}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var T=$r("recharts-trapezoid",s);if(!f)return D.createElement("g",null,D.createElement("path",gT({},Lc(e),{className:T,d:jQ(n,r,i,a,o)})));var O=p.current,M=y.current,I=x.current,V=S.current,k=C.current,L="0px ".concat(h===-1?1:h,"px"),$="".concat(h,"px 0px"),W=pge(["strokeDasharray"],l,c);return D.createElement(H8,{animationId:_,key:_,canBegin:h>0,duration:l,easing:c,isActive:f,begin:u},G=>{var oe=Ia(O,i,G),U=Ia(M,a,G),Y=Ia(I,o,G),J=Ia(V,n,G),ne=Ia(k,r,G);d.current&&(p.current=oe,y.current=U,x.current=Y,S.current=J,C.current=ne);var F=G>0?{transition:W,strokeDasharray:$}:{strokeDasharray:L};return D.createElement("path",gT({},Lc(e),{className:T,d:jQ(J,ne,oe,U,Y),ref:d,style:$Q($Q({},F),e.style)}))})},kct=["option","shapeType","propTransformer","activeClassName","isActive"];function Act(t,e){if(t==null)return{};var n,r,i=Lct(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Lct(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function UQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pT(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?UQ(Object(n),!0).forEach(function(r){Vct(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):UQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Vct(t,e,n){return(e=$ct(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $ct(t){var e=jct(t,"string");return typeof e=="symbol"?e:e+""}function jct(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Uct(t,e){return pT(pT({},e),t)}function Fct(t,e){return t==="symbols"}function FQ(t){var{shapeType:e,elementProps:n}=t;switch(e){case"rectangle":return D.createElement(xge,n);case"trapezoid":return D.createElement(Pct,n);case"sector":return D.createElement(Sge,n);case"symbols":if(Fct(e))return D.createElement(C$,n);break;default:return null}}function Bct(t){return D.isValidElement(t)?t.props:t}function zct(t){var{option:e,shapeType:n,propTransformer:r=Uct,activeClassName:i="recharts-active-shape",isActive:a}=t,o=Act(t,kct),s;if(D.isValidElement(e))s=D.cloneElement(e,pT(pT({},o),Bct(e)));else if(typeof e=="function")s=e(o);else if(Dct(e)&&typeof e!="boolean"){var c=r(e,o);s=D.createElement(FQ,{shapeType:n,elementProps:c})}else{var l=o;s=D.createElement(FQ,{shapeType:n,elementProps:l})}return a?D.createElement(Vc,{className:i},s):s}var o1e=(t,e)=>{var n=Aa();return(r,i)=>a=>{t?.(r,i,a),n(mme({activeIndex:String(i),activeDataKey:e,activeCoordinate:r.tooltipPosition}))}},s1e=t=>{var e=Aa();return(n,r)=>i=>{t?.(n,r,i),e(zat())}},c1e=(t,e)=>{var n=Aa();return(r,i)=>a=>{t?.(r,i,a),n(Gat({activeIndex:String(i),activeDataKey:e,activeCoordinate:r.tooltipPosition}))}};function l1e(t){var{fn:e,args:n}=t,r=Aa(),i=ac();return D.useLayoutEffect(()=>{if(!i){var a=e(n);return r(Uat(a)),()=>{r(Fat(a))}}},[e,n,r,i]),null}var Gct=()=>{};function u1e(t){var{legendPayload:e}=t,n=Aa(),r=ac();return D.useLayoutEffect(()=>r?Gct:(n(get(e)),()=>{n(pet(e))}),[n,r,e]),null}var KM,Wct=()=>{var[t]=D.useState(()=>Rw("uid-"));return t},Hct=(KM=Bk.useId)!==null&&KM!==void 0?KM:Wct;function qct(t,e){var n=Hct();return e||(t?"".concat(t,"-").concat(n):n)}var Kct=D.createContext(void 0),f1e=t=>{var{id:e,type:n,children:r}=t,i=qct("recharts-".concat(n),e);return D.createElement(Kct.Provider,{value:i},r(i))},Yct={cartesianItems:[],polarItems:[]},d1e=Nl({name:"graphicalItems",initialState:Yct,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:Ws()},replaceCartesianGraphicalItem:{reducer(t,e){var{prev:n,next:r}=e.payload,i=Y0(t).cartesianItems.indexOf(n);i>-1&&(t.cartesianItems[i]=r)},prepare:Ws()},removeCartesianGraphicalItem:{reducer(t,e){var n=Y0(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:Ws()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:Ws()},removePolarGraphicalItem:{reducer(t,e){var n=Y0(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:Ws()}}}),{addCartesianGraphicalItem:Xct,replaceCartesianGraphicalItem:Zct,removeCartesianGraphicalItem:Qct,addPolarGraphicalItem:JYt,removePolarGraphicalItem:eXt}=d1e.actions,Jct=d1e.reducer;function h1e(t){var e=Aa(),n=D.useRef(null);return D.useLayoutEffect(()=>{n.current===null?e(Xct(t)):n.current!==t&&e(Zct({prev:n.current,next:t})),n.current=t},[e,t]),D.useLayoutEffect(()=>()=>{n.current&&(e(Qct(n.current)),n.current=null)},[e]),null}function BQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function zQ(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?BQ(Object(n),!0).forEach(function(r){elt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):BQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function elt(t,e,n){return(e=tlt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tlt(t){var e=nlt(t,"string");return typeof e=="symbol"?e:e+""}function nlt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var rlt={xAxis:{},yAxis:{},zAxis:{}},g1e=Nl({name:"cartesianAxis",initialState:rlt,reducers:{addXAxis:{reducer(t,e){t.xAxis[e.payload.id]=e.payload},prepare:Ws()},removeXAxis:{reducer(t,e){delete t.xAxis[e.payload.id]},prepare:Ws()},addYAxis:{reducer(t,e){t.yAxis[e.payload.id]=e.payload},prepare:Ws()},removeYAxis:{reducer(t,e){delete t.yAxis[e.payload.id]},prepare:Ws()},addZAxis:{reducer(t,e){t.zAxis[e.payload.id]=e.payload},prepare:Ws()},removeZAxis:{reducer(t,e){delete t.zAxis[e.payload.id]},prepare:Ws()},updateYAxisWidth(t,e){var{id:n,width:r}=e.payload,i=t.yAxis[n];if(i){var a=i.widthHistory||[];if(a.length===3&&a[0]===a[2]&&r===a[1]&&r!==i.width&&Math.abs(r-a[0])<=1)return;var o=[...a,r].slice(-3);t.yAxis[n]=zQ(zQ({},t.yAxis[n]),{},{width:r,widthHistory:o})}}}}),{addXAxis:ilt,removeXAxis:alt,addYAxis:olt,removeYAxis:slt,addZAxis:tXt,removeZAxis:nXt,updateYAxisWidth:clt}=g1e.actions,llt=g1e.reducer,ult=He([Vo],t=>{if(t)return{top:t.top,bottom:t.bottom,left:t.left,right:t.right}}),flt=He([ult,Eh,Oh],(t,e,n)=>{if(!(!t||e==null||n==null))return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}),Vj=()=>Jt(flt),dlt=()=>Jt(Rot);function GQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function WQ(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?GQ(Object(n),!0).forEach(function(r){hlt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):GQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hlt(t,e,n){return(e=glt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function glt(t){var e=plt(t,"string");return typeof e=="symbol"?e:e+""}function plt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var mlt=t=>{var{point:e,childIndex:n,mainColor:r,activeDot:i,dataKey:a}=t;if(i===!1||e.x==null||e.y==null)return null;var o=WQ(WQ({index:n,dataKey:a,cx:e.x,cy:e.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},$b(i)),_$(i)),s;return D.isValidElement(i)?s=D.cloneElement(i,o):typeof i=="function"?s=i(o):s=D.createElement(n1e,o),D.createElement(Vc,{className:"recharts-active-dot"},s)};function HQ(t){var{points:e,mainColor:n,activeDot:r,itemDataKey:i}=t,a=Jt(e1),o=dlt();if(e==null||o==null)return null;var s=e.find(c=>o.includes(c.payload));return ta(s)?null:mlt({point:s,childIndex:Number(a),mainColor:n,dataKey:i,activeDot:r})}var vlt="Invariant failed";function ylt(t,e){throw new Error(vlt)}var xlt=["x","y"];function bP(){return bP=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},bP.apply(null,arguments)}function qQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function qx(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qQ(Object(n),!0).forEach(function(r){wlt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wlt(t,e,n){return(e=blt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function blt(t){var e=Slt(t,"string");return typeof e=="symbol"?e:e+""}function Slt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Clt(t,e){if(t==null)return{};var n,r,i=_lt(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function _lt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Tlt(t,e){var{x:n,y:r}=t,i=Clt(t,xlt),a="".concat(n),o=parseInt(a,10),s="".concat(r),c=parseInt(s,10),l="".concat(e.height||i.height),u=parseInt(l,10),f="".concat(e.width||i.width),d=parseInt(f,10);return qx(qx(qx(qx(qx({},e),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:u,width:d,name:e.name,radius:e.radius})}function $j(t){return D.createElement(zct,bP({shapeType:"rectangle",propTransformer:Tlt,activeClassName:"recharts-active-bar"},t))}var Elt=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(r,i)=>{if(qt(e))return e;var a=qt(r)||ta(r);return a?e(r,i):(a||ylt(),n)}},Olt={},p1e=Nl({name:"errorBars",initialState:Olt,reducers:{addErrorBar:(t,e)=>{var{itemId:n,errorBar:r}=e.payload;t[n]||(t[n]=[]),t[n].push(r)},replaceErrorBar:(t,e)=>{var{itemId:n,prev:r,next:i}=e.payload;t[n]&&(t[n]=t[n].map(a=>a.dataKey===r.dataKey&&a.direction===r.direction?i:a))},removeErrorBar:(t,e)=>{var{itemId:n,errorBar:r}=e.payload;t[n]&&(t[n]=t[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:rXt,replaceErrorBar:iXt,removeErrorBar:aXt}=p1e.actions,Dlt=p1e.reducer,Mlt=["children"];function Rlt(t,e){if(t==null)return{};var n,r,i=Ilt(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Ilt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Nlt={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},Plt=D.createContext(Nlt);function klt(t){var{children:e}=t,n=Rlt(t,Mlt);return D.createElement(Plt.Provider,{value:n},e)}function jj(t,e){var n,r,i=Jt(l=>Mh(l,t)),a=Jt(l=>Rh(l,e)),o=(n=i?.allowDataOverflow)!==null&&n!==void 0?n:al.allowDataOverflow,s=(r=a?.allowDataOverflow)!==null&&r!==void 0?r:ol.allowDataOverflow,c=o||s;return{needClip:c,needClipX:o,needClipY:s}}function m1e(t){var{xAxisId:e,yAxisId:n,clipPathId:r}=t,i=Vj(),{needClipX:a,needClipY:o,needClip:s}=jj(e,n);if(!s)return null;var{x:c,y:l,width:u,height:f}=i;return D.createElement("clipPath",{id:"clipPath-".concat(r)},D.createElement("rect",{x:a?c:c-u/2,y:o?l:l-f/2,width:a?u:u*2,height:o?f:f*2}))}var Alt=["onMouseEnter","onMouseLeave","onClick"],Llt=["value","background","tooltipPosition"],Vlt=["id"],$lt=["onMouseEnter","onClick","onMouseLeave"];function tp(){return tp=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},tp.apply(null,arguments)}function KQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hs(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?KQ(Object(n),!0).forEach(function(r){jlt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):KQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function jlt(t,e,n){return(e=Ult(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ult(t){var e=Flt(t,"string");return typeof e=="symbol"?e:e+""}function Flt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function mT(t,e){if(t==null)return{};var n,r,i=Blt(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Blt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var zlt=t=>{var{dataKey:e,name:n,fill:r,legendType:i,hide:a}=t;return[{inactive:a,dataKey:e,type:i,color:r,value:V8(n,e),payload:t}]};function Glt(t){var{dataKey:e,stroke:n,strokeWidth:r,fill:i,name:a,hide:o,unit:s}=t;return{dataDefinedOnItem:void 0,positions:void 0,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:e,nameKey:void 0,name:V8(a,e),hide:o,type:t.tooltipType,color:t.fill,unit:s}}}function Wlt(t){var e=Jt(e1),{data:n,dataKey:r,background:i,allOtherBarProps:a}=t,{onMouseEnter:o,onMouseLeave:s,onClick:c}=a,l=mT(a,Alt),u=o1e(o,r),f=s1e(s),d=c1e(c,r);if(!i||n==null)return null;var h=$b(i);return D.createElement(D.Fragment,null,n.map((m,p)=>{var{value:y,background:x,tooltipPosition:S}=m,C=mT(m,Llt);if(!x)return null;var _=u(m,p),T=f(m,p),O=d(m,p),M=Hs(Hs(Hs(Hs(Hs({option:i,isActive:String(p)===e},C),{},{fill:"#eee"},x),h),R8(l,m,p)),{},{onMouseEnter:_,onMouseLeave:T,onClick:O,dataKey:r,index:p,className:"recharts-bar-background-rectangle"});return D.createElement($j,tp({key:"background-bar-".concat(p)},M))}))}function Hlt(t){var{showLabels:e,children:n,rects:r}=t,i=r?.map(a=>{var o={x:a.x,y:a.y,width:a.width,height:a.height};return Hs(Hs({},o),{},{value:a.value,payload:a.payload,parentViewBox:a.parentViewBox,viewBox:o,fill:a.fill})});return D.createElement(Jme,{value:e?i:void 0},n)}function qlt(t){var{shape:e,activeBar:n,baseProps:r,entry:i,index:a,dataKey:o}=t,s=Jt(e1),c=Jt(Ime),l=n&&String(a)===s&&(c==null||o===c),u=l?n:e;return D.createElement($j,tp({},r,{name:String(r.name)},i,{isActive:l,option:u,index:a,dataKey:o}))}function Klt(t){var{shape:e,baseProps:n,entry:r,index:i,dataKey:a}=t;return D.createElement($j,tp({},n,{name:String(n.name)},r,{isActive:!1,option:e,index:i,dataKey:a}))}function Ylt(t){var{data:e,props:n}=t,r=bu(n),{id:i}=r,a=mT(r,Vlt),{shape:o,dataKey:s,activeBar:c}=n,{onMouseEnter:l,onClick:u,onMouseLeave:f}=n,d=mT(n,$lt),h=o1e(l,s),m=s1e(f),p=c1e(u,s);return e?D.createElement(D.Fragment,null,e.map((y,x)=>D.createElement(Vc,tp({key:"rectangle-".concat(y?.x,"-").concat(y?.y,"-").concat(y?.value,"-").concat(x),className:"recharts-bar-rectangle"},R8(d,y,x),{onMouseEnter:h(y,x),onMouseLeave:m(y,x),onClick:p(y,x)}),c?D.createElement(qlt,{shape:o,activeBar:c,baseProps:a,entry:y,index:x,dataKey:s}):D.createElement(Klt,{shape:o,baseProps:a,entry:y,index:x,dataKey:s})))):null}function Xlt(t){var{props:e,previousRectanglesRef:n}=t,{data:r,layout:i,isAnimationActive:a,animationBegin:o,animationDuration:s,animationEasing:c,onAnimationEnd:l,onAnimationStart:u}=e,f=n.current,d=q8(e,"recharts-bar-"),[h,m]=D.useState(!1),p=!h,y=D.useCallback(()=>{typeof l=="function"&&l(),m(!1)},[l]),x=D.useCallback(()=>{typeof u=="function"&&u(),m(!0)},[u]);return D.createElement(Hlt,{showLabels:p,rects:r},D.createElement(H8,{animationId:d,begin:o,duration:s,isActive:a,easing:c,onAnimationEnd:y,onAnimationStart:x,key:d},S=>{var C=S===1?r:r?.map((_,T)=>{var O=f&&f[T];if(O)return Hs(Hs({},_),{},{x:Ia(O.x,_.x,S),y:Ia(O.y,_.y,S),width:Ia(O.width,_.width,S),height:Ia(O.height,_.height,S)});if(i==="horizontal"){var M=Ia(0,_.height,S);return Hs(Hs({},_),{},{y:_.y+_.height-M,height:M})}var I=Ia(0,_.width,S);return Hs(Hs({},_),{},{width:I})});return S>0&&(n.current=C??null),C==null?null:D.createElement(Vc,null,D.createElement(Ylt,{props:e,data:C}))}),D.createElement(t1e,{label:e.label}),e.children)}function Zlt(t){var e=D.useRef(null);return D.createElement(Xlt,{previousRectanglesRef:e,props:t})}var v1e=0,Qlt=(t,e)=>{var n=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:n,errorVal:Po(t,e)}};class Jlt extends D.PureComponent{render(){var{hide:e,data:n,dataKey:r,className:i,xAxisId:a,yAxisId:o,needClip:s,background:c,id:l}=this.props;if(e||n==null)return null;var u=$r("recharts-bar",i),f=l;return D.createElement(Vc,{className:u,id:l},s&&D.createElement("defs",null,D.createElement(m1e,{clipPathId:f,xAxisId:a,yAxisId:o})),D.createElement(Vc,{className:"recharts-bar-rectangles",clipPath:s?"url(#clipPath-".concat(f,")"):void 0},D.createElement(Wlt,{data:n,dataKey:r,background:c,allOtherBarProps:this.props}),D.createElement(Zlt,this.props)))}}var eut={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",hide:!1,isAnimationActive:!_1.isSsr,legendType:"rect",minPointSize:v1e,xAxisId:0,yAxisId:0};function tut(t){var{xAxisId:e,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u}=t,{needClip:f}=jj(e,n),d=z8(),h=ac(),m=_ct(t.children,zme),p=Jt(S=>Mut(S,e,n,h,t.id,m));if(d!=="vertical"&&d!=="horizontal")return null;var y,x=p?.[0];return x==null||x.height==null||x.width==null?y=0:y=d==="vertical"?x.height/2:x.width/2,D.createElement(klt,{xAxisId:e,yAxisId:n,data:p,dataPointFormatter:Qlt,errorBarOffset:y},D.createElement(Jlt,tp({},t,{layout:d,needClip:f,data:p,xAxisId:e,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u})))}function nut(t){var{layout:e,barSettings:{dataKey:n,minPointSize:r},pos:i,bandSize:a,xAxis:o,yAxis:s,xAxisTicks:c,yAxisTicks:l,stackedData:u,displayedData:f,offset:d,cells:h,parentViewBox:m}=t,p=e==="horizontal"?s:o,y=u?p.scale.domain():null,x=OJe({numericAxis:p});return f.map((S,C)=>{var _,T,O,M,I,V;u?_=SJe(u[C],y):(_=Po(S,n),Array.isArray(_)||(_=[x,_]));var k=Elt(r,v1e)(_[1],C);if(e==="horizontal"){var L,[$,W]=[s.scale(_[0]),s.scale(_[1])];T=RX({axis:o,ticks:c,bandSize:a,offset:i.offset,entry:S,index:C}),O=(L=W??$)!==null&&L!==void 0?L:void 0,M=i.size;var G=$-W;if(I=El(G)?0:G,V={x:T,y:d.top,width:M,height:d.height},Math.abs(k)>0&&Math.abs(I)<Math.abs(k)){var oe=Rc(I||k)*(Math.abs(k)-Math.abs(I));O-=oe,I+=oe}}else{var[U,Y]=[o.scale(_[0]),o.scale(_[1])];if(T=U,O=RX({axis:s,ticks:l,bandSize:a,offset:i.offset,entry:S,index:C}),M=Y-U,I=i.size,V={x:d.left,y:O,width:d.width,height:I},Math.abs(k)>0&&Math.abs(M)<Math.abs(k)){var J=Rc(M||k)*(Math.abs(k)-Math.abs(M));M+=J}}if(T==null||O==null||M==null||I==null)return null;var ne=Hs(Hs({},S),{},{x:T,y:O,width:M,height:I,value:u?_:_[1],payload:S,background:V,tooltipPosition:{x:T+M/2,y:O+I/2},parentViewBox:m},h&&h[C]&&h[C].props);return ne}).filter(Boolean)}function rut(t){var e=Fc(t,eut),n=ac();return D.createElement(f1e,{id:e.id,type:"bar"},r=>D.createElement(D.Fragment,null,D.createElement(u1e,{legendPayload:zlt(e)}),D.createElement(l1e,{fn:Glt,args:e}),D.createElement(h1e,{type:"bar",id:r,data:void 0,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,dataKey:e.dataKey,stackId:sge(e.stackId),hide:e.hide,barSize:e.barSize,minPointSize:e.minPointSize,maxBarSize:e.maxBarSize,isPanorama:n}),D.createElement(tut,tp({},e,{id:r}))))}var y1e=D.memo(rut);y1e.displayName="Bar";function YQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function hS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?YQ(Object(n),!0).forEach(function(r){iut(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):YQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iut(t,e,n){return(e=aut(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aut(t){var e=out(t,"string");return typeof e=="symbol"?e:e+""}function out(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var sut=(t,e)=>e,cut=(t,e,n)=>n,lut=(t,e,n,r)=>r,uut=(t,e,n,r,i)=>i,Jb=He([uE,uut],(t,e)=>t.filter(n=>n.type==="bar").find(n=>n.id===e)),fut=He([Jb],t=>t?.maxBarSize),dut=(t,e,n,r,i,a)=>a,XQ=(t,e,n)=>{var r=n??t;if(!ta(r))return pf(r,e,0)},hut=He([Nr,uE,sut,cut,lut],(t,e,n,r,i)=>e.filter(a=>t==="horizontal"?a.xAxisId===n:a.yAxisId===r).filter(a=>a.isPanorama===i).filter(a=>a.hide===!1).filter(a=>a.type==="bar")),gut=(t,e,n,r)=>{var i=Nr(t);return i==="horizontal"?Uw(t,"yAxis",n,r):Uw(t,"xAxis",e,r)},put=(t,e,n)=>{var r=Nr(t);return r==="horizontal"?eQ(t,"xAxis",e):eQ(t,"yAxis",n)},mut=(t,e,n)=>{var r={},i=t.filter(sE),a=t.filter(l=>l.stackId==null),o=i.reduce((l,u)=>(l[u.stackId]||(l[u.stackId]=[]),l[u.stackId].push(u),l),r),s=Object.entries(o).map(l=>{var[u,f]=l,d=f.map(m=>m.dataKey),h=XQ(e,n,f[0].barSize);return{stackId:u,dataKeys:d,barSize:h}}),c=a.map(l=>{var u=[l.dataKey].filter(d=>d!=null),f=XQ(e,n,l.barSize);return{stackId:void 0,dataKeys:u,barSize:f}});return[...s,...c]},vut=He([hut,Lit,put],mut),yut=(t,e,n,r,i)=>{var a,o,s=Jb(t,e,n,r,i);if(s!=null){var c=Nr(t),l=xpe(t),{maxBarSize:u}=s,f=ta(u)?l:u,d,h;return c==="horizontal"?(d=ep(t,"xAxis",e,r),h=Jg(t,"xAxis",e,r)):(d=ep(t,"yAxis",n,r),h=Jg(t,"yAxis",n,r)),(a=(o=Pw(d,h,!0))!==null&&o!==void 0?o:f)!==null&&a!==void 0?a:0}},x1e=(t,e,n,r)=>{var i=Nr(t),a,o;return i==="horizontal"?(a=ep(t,"xAxis",e,r),o=Jg(t,"xAxis",e,r)):(a=ep(t,"yAxis",n,r),o=Jg(t,"yAxis",n,r)),Pw(a,o)};function xut(t,e,n,r,i){var a=r.length;if(!(a<1)){var o=pf(t,n,0,!0),s,c=[];if(Za(r[0].barSize)){var l=!1,u=n/a,f=r.reduce((x,S)=>x+(S.barSize||0),0);f+=(a-1)*o,f>=n&&(f-=(a-1)*o,o=0),f>=n&&u>0&&(l=!0,u*=.9,f=a*u);var d=(n-f)/2>>0,h={offset:d-o,size:0};s=r.reduce((x,S)=>{var C,_={stackId:S.stackId,dataKeys:S.dataKeys,position:{offset:h.offset+h.size+o,size:l?u:(C=S.barSize)!==null&&C!==void 0?C:0}},T=[...x,_];return h=T[T.length-1].position,T},c)}else{var m=pf(e,n,0,!0);n-2*m-(a-1)*o<=0&&(o=0);var p=(n-2*m-(a-1)*o)/a;p>1&&(p>>=0);var y=Za(i)?Math.min(p,i):p;s=r.reduce((x,S,C)=>[...x,{stackId:S.stackId,dataKeys:S.dataKeys,position:{offset:m+(p+o)*C+(p-y)/2,size:y}}],c)}return s}}var wut=(t,e,n,r,i,a,o)=>{var s=ta(o)?e:o,c=xut(n,r,i!==a?i:a,t,s);return i!==a&&c!=null&&(c=c.map(l=>hS(hS({},l),{},{position:hS(hS({},l.position),{},{offset:l.position.offset-i/2})}))),c},but=He([vut,xpe,Ait,wpe,yut,x1e,fut],wut),Sut=(t,e,n,r)=>ep(t,"xAxis",e,r),Cut=(t,e,n,r)=>ep(t,"yAxis",n,r),_ut=(t,e,n,r)=>Jg(t,"xAxis",e,r),Tut=(t,e,n,r)=>Jg(t,"yAxis",n,r),Eut=He([but,Jb],(t,e)=>{if(!(t==null||e==null)){var n=t.find(r=>r.stackId===e.stackId&&e.dataKey!=null&&r.dataKeys.includes(e.dataKey));if(n!=null)return n.position}}),Out=(t,e)=>{var n=oE(e);if(!(!t||n==null||e==null)){var{stackId:r}=e;if(r!=null){var i=t[r];if(i){var{stackedData:a}=i;if(a)return a.find(o=>o.key===n)}}}},Dut=He([gut,Jb],Out),Mut=He([Vo,A$,Sut,Cut,_ut,Tut,Eut,Nr,eE,x1e,Dut,Jb,dut],(t,e,n,r,i,a,o,s,c,l,u,f,d)=>{var{chartData:h,dataStartIndex:m,dataEndIndex:p}=c;if(!(f==null||o==null||e==null||s!=="horizontal"&&s!=="vertical"||n==null||r==null||i==null||a==null||l==null)){var{data:y}=f,x;if(y!=null&&y.length>0?x=y:x=h?.slice(m,p+1),x!=null)return nut({layout:s,barSettings:f,pos:o,parentViewBox:e,bandSize:l,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:u,displayedData:x,offset:t,cells:d})}}),Rut=t=>{var{chartData:e}=t,n=Aa(),r=ac();return D.useEffect(()=>r?()=>{}:(n(uQ(e)),()=>{n(uQ(void 0))}),[e,n,r]),null},ZQ={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},w1e=Nl({name:"brush",initialState:ZQ,reducers:{setBrushSettings(t,e){return e.payload==null?ZQ:e.payload}}}),{setBrushSettings:oXt}=w1e.actions,Iut=w1e.reducer;function Nut(t,e,n){return(e=Put(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Put(t){var e=kut(t,"string");return typeof e=="symbol"?e:e+""}function kut(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Uj{static create(e){return new Uj(e)}constructor(e){this.scale=e}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(e){var{bandAware:n,position:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e!==void 0){if(r)switch(r){case"start":return this.scale(e);case"middle":{var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+i}case"end":{var a=this.bandwidth?this.bandwidth():0;return this.scale(e)+a}default:return this.scale(e)}if(n){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+o}return this.scale(e)}}isInRange(e){var n=this.range(),r=n[0],i=n[n.length-1];return r<=i?e>=r&&e<=i:e>=i&&e<=r}}Nut(Uj,"EPS",1e-4);function Aut(t){return(t%180+180)%180}var Lut=function(e){var{width:n,height:r}=e,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=Aut(i),o=a*Math.PI/180,s=Math.atan(r/n),c=o>s&&o<Math.PI-s?r/Math.sin(o):n/Math.cos(o);return Math.abs(c)},Vut={dots:[],areas:[],lines:[]},b1e=Nl({name:"referenceElements",initialState:Vut,reducers:{addDot:(t,e)=>{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=Y0(t).dots.findIndex(r=>r===e.payload);n!==-1&&t.dots.splice(n,1)},addArea:(t,e)=>{t.areas.push(e.payload)},removeArea:(t,e)=>{var n=Y0(t).areas.findIndex(r=>r===e.payload);n!==-1&&t.areas.splice(n,1)},addLine:(t,e)=>{t.lines.push(e.payload)},removeLine:(t,e)=>{var n=Y0(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),{addDot:sXt,removeDot:cXt,addArea:lXt,removeArea:uXt,addLine:fXt,removeLine:dXt}=b1e.actions,$ut=b1e.reducer,jut=D.createContext(void 0),Uut=t=>{var{children:e}=t,[n]=D.useState("".concat(Rw("recharts"),"-clip")),r=Vj();if(r==null)return null;var{x:i,y:a,width:o,height:s}=r;return D.createElement(jut.Provider,{value:n},D.createElement("defs",null,D.createElement("clipPath",{id:n},D.createElement("rect",{x:i,y:a,height:s,width:o}))),e)};function $y(t,e){for(var n in t)if({}.hasOwnProperty.call(t,n)&&(!{}.hasOwnProperty.call(e,n)||t[n]!==e[n]))return!1;for(var r in e)if({}.hasOwnProperty.call(e,r)&&!{}.hasOwnProperty.call(t,r))return!1;return!0}function S1e(t,e,n){if(e<1)return[];if(e===1&&n===void 0)return t;for(var r=[],i=0;i<t.length;i+=e)r.push(t[i]);return r}function Fut(t,e,n){var r={width:t.width+e.width,height:t.height+e.height};return Lut(r,n)}function But(t,e,n){var r=n==="width",{x:i,y:a,width:o,height:s}=t;return e===1?{start:r?i:a,end:r?i+o:a+s}:{start:r?i+o:a+s,end:r?i:a}}function vT(t,e,n,r,i){if(t*e<t*r||t*e>t*i)return!1;var a=n();return t*(e-t*a/2-r)>=0&&t*(e+t*a/2-i)<=0}function zut(t,e){return S1e(t,e+1)}function Gut(t,e,n,r,i){for(var a=(r||[]).slice(),{start:o,end:s}=e,c=0,l=1,u=o,f=function(){var m=r?.[c];if(m===void 0)return{v:S1e(r,l)};var p=c,y,x=()=>(y===void 0&&(y=n(m,p)),y),S=m.coordinate,C=c===0||vT(t,S,x,u,s);C||(c=0,u=o,l+=1),C&&(u=S+t*(x()/2+i),c+=l)},d;l<=a.length;)if(d=f(),d)return d.v;return[]}function QQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ys(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?QQ(Object(n),!0).forEach(function(r){Wut(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):QQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Wut(t,e,n){return(e=Hut(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hut(t){var e=qut(t,"string");return typeof e=="symbol"?e:e+""}function qut(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Kut(t,e,n,r,i){for(var a=(r||[]).slice(),o=a.length,{start:s}=e,{end:c}=e,l=function(d){var h=a[d],m,p=()=>(m===void 0&&(m=n(h,d)),m);if(d===o-1){var y=t*(h.coordinate+t*p()/2-c);a[d]=h=ys(ys({},h),{},{tickCoord:y>0?h.coordinate-y*t:h.coordinate})}else a[d]=h=ys(ys({},h),{},{tickCoord:h.coordinate});var x=vT(t,h.tickCoord,p,s,c);x&&(c=h.tickCoord-t*(p()/2+i),a[d]=ys(ys({},h),{},{isShow:!0}))},u=o-1;u>=0;u--)l(u);return a}function Yut(t,e,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:c,end:l}=e;if(a){var u=r[s-1],f=n(u,s-1),d=t*(u.coordinate+t*f/2-l);o[s-1]=u=ys(ys({},u),{},{tickCoord:d>0?u.coordinate-d*t:u.coordinate});var h=vT(t,u.tickCoord,()=>f,c,l);h&&(l=u.tickCoord-t*(f/2+i),o[s-1]=ys(ys({},u),{},{isShow:!0}))}for(var m=a?s-1:s,p=function(S){var C=o[S],_,T=()=>(_===void 0&&(_=n(C,S)),_);if(S===0){var O=t*(C.coordinate-t*T()/2-c);o[S]=C=ys(ys({},C),{},{tickCoord:O<0?C.coordinate-O*t:C.coordinate})}else o[S]=C=ys(ys({},C),{},{tickCoord:C.coordinate});var M=vT(t,C.tickCoord,T,c,l);M&&(c=C.tickCoord+t*(T()/2+i),o[S]=ys(ys({},C),{},{isShow:!0}))},y=0;y<m;y++)p(y);return o}function Fj(t,e,n){var{tick:r,ticks:i,viewBox:a,minTickGap:o,orientation:s,interval:c,tickFormatter:l,unit:u,angle:f}=t;if(!i||!i.length||!r)return[];if(qt(c)||_1.isSsr){var d;return(d=zut(i,qt(c)?c:0))!==null&&d!==void 0?d:[]}var h=[],m=s==="top"||s==="bottom"?"width":"height",p=u&&m==="width"?U5(u,{fontSize:e,letterSpacing:n}):{width:0,height:0},y=(C,_)=>{var T=typeof l=="function"?l(C.value,_):C.value;return m==="width"?Fut(U5(T,{fontSize:e,letterSpacing:n}),p,f):U5(T,{fontSize:e,letterSpacing:n})[m]},x=i.length>=2?Rc(i[1].coordinate-i[0].coordinate):1,S=But(a,x,m);return c==="equidistantPreserveStart"?Gut(x,S,y,i,o):(c==="preserveStart"||c==="preserveStartEnd"?h=Yut(x,S,y,i,o,c==="preserveStartEnd"):h=Kut(x,S,y,i,o),h.filter(C=>C.isShow))}var Xut=t=>{var{ticks:e,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=t,o=0;if(e){Array.from(e).forEach(u=>{if(u){var f=u.getBoundingClientRect();f.width>o&&(o=f.width)}});var s=n?n.getBoundingClientRect().width:0,c=i+a,l=o+c+s+(n?r:0);return Math.round(l)}return 0},Zut=["axisLine","width","height","className","hide","ticks"],Qut=["viewBox"],Jut=["viewBox"];function SP(t,e){if(t==null)return{};var n,r,i=eft(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function eft(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function t1(){return t1=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},t1.apply(null,arguments)}function JQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function lo(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?JQ(Object(n),!0).forEach(function(r){tft(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):JQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function tft(t,e,n){return(e=nft(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nft(t){var e=rft(t,"string");return typeof e=="symbol"?e:e+""}function rft(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Bj={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"};function ift(t){var{x:e,y:n,width:r,height:i,orientation:a,mirror:o,axisLine:s,otherSvgProps:c}=t;if(!s)return null;var l=lo(lo(lo({},c),bu(s)),{},{fill:"none"});if(a==="top"||a==="bottom"){var u=+(a==="top"&&!o||a==="bottom"&&o);l=lo(lo({},l),{},{x1:e,y1:n+u*i,x2:e+r,y2:n+u*i})}else{var f=+(a==="left"&&!o||a==="right"&&o);l=lo(lo({},l),{},{x1:e+f*r,y1:n,x2:e+f*r,y2:n+i})}return D.createElement("line",t1({},l,{className:$r("recharts-cartesian-axis-line",Iy(s,"className"))}))}function aft(t,e,n,r,i,a,o,s,c){var l,u,f,d,h,m,p=s?-1:1,y=t.tickSize||o,x=qt(t.tickCoord)?t.tickCoord:t.coordinate;switch(a){case"top":l=u=t.coordinate,d=n+ +!s*i,f=d-p*y,m=f-p*c,h=x;break;case"left":f=d=t.coordinate,u=e+ +!s*r,l=u-p*y,h=l-p*c,m=x;break;case"right":f=d=t.coordinate,u=e+ +s*r,l=u+p*y,h=l+p*c,m=x;break;default:l=u=t.coordinate,d=n+ +s*i,f=d+p*y,m=f+p*c,h=x;break}return{line:{x1:l,y1:f,x2:u,y2:d},tick:{x:h,y:m}}}function oft(t,e){switch(t){case"left":return e?"start":"end";case"right":return e?"end":"start";default:return"middle"}}function sft(t,e){switch(t){case"left":case"right":return"middle";case"top":return e?"start":"end";default:return e?"end":"start"}}function cft(t){var{option:e,tickProps:n,value:r}=t,i,a=$r(n.className,"recharts-cartesian-axis-tick-value");if(D.isValidElement(e))i=D.cloneElement(e,lo(lo({},n),{},{className:a}));else if(typeof e=="function")i=e(lo(lo({},n),{},{className:a}));else{var o="recharts-cartesian-axis-tick-value";typeof e!="boolean"&&(o=$r(o,e?.className)),i=D.createElement(Aj,t1({},n,{className:o}),r)}return i}function lft(t){var{ticks:e=[],tick:n,tickLine:r,stroke:i,tickFormatter:a,unit:o,padding:s,tickTextProps:c,orientation:l,mirror:u,x:f,y:d,width:h,height:m,tickSize:p,tickMargin:y,fontSize:x,letterSpacing:S,getTicksConfig:C,events:_}=t,T=Fj(lo(lo({},C),{},{ticks:e}),x,S),O=oft(l,u),M=sft(l,u),I=bu(C),V=$b(n),k={};typeof r=="object"&&(k=r);var L=lo(lo({},I),{},{fill:"none"},k),$=T.map((W,G)=>{var{line:oe,tick:U}=aft(W,f,d,h,m,l,p,u,y),Y=lo(lo(lo(lo({textAnchor:O,verticalAnchor:M},I),{},{stroke:"none",fill:i},V),U),{},{index:G,payload:W,visibleTicksCount:T.length,tickFormatter:a,padding:s},c);return D.createElement(Vc,t1({className:"recharts-cartesian-axis-tick",key:"tick-".concat(W.value,"-").concat(W.coordinate,"-").concat(W.tickCoord)},R8(_,W,G)),r&&D.createElement("line",t1({},L,oe,{className:$r("recharts-cartesian-axis-tick-line",Iy(r,"className"))})),n&&D.createElement(cft,{option:n,tickProps:Y,value:"".concat(typeof a=="function"?a(W.value,G):W.value).concat(o||"")}))});return $.length>0?D.createElement("g",{className:"recharts-cartesian-axis-ticks"},$):null}var uft=D.forwardRef((t,e)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:s}=t,c=SP(t,Zut),[l,u]=D.useState(""),[f,d]=D.useState(""),h=D.useRef(null);D.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var p;return Xut({ticks:h.current,label:(p=t.labelRef)===null||p===void 0?void 0:p.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var m=D.useCallback(p=>{if(p){var y=p.getElementsByClassName("recharts-cartesian-axis-tick-value");h.current=y;var x=y[0];if(x){var S=window.getComputedStyle(x),C=S.fontSize,_=S.letterSpacing;(C!==l||_!==f)&&(u(C),d(_))}}},[l,f]);return o||r!=null&&r<=0||i!=null&&i<=0?null:D.createElement(Vc,{className:$r("recharts-cartesian-axis",a),ref:m},D.createElement(ift,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:bu(t)}),D.createElement(lft,{ticks:s,tick:t.tick,tickLine:t.tickLine,stroke:t.stroke,tickFormatter:t.tickFormatter,unit:t.unit,padding:t.padding,tickTextProps:t.tickTextProps,orientation:t.orientation,mirror:t.mirror,x:t.x,y:t.y,width:t.width,height:t.height,tickSize:t.tickSize,tickMargin:t.tickMargin,fontSize:l,letterSpacing:f,getTicksConfig:t,events:c}),D.createElement(Xst,{x:t.x,y:t.y,width:t.width,height:t.height},D.createElement(oct,{label:t.label,labelRef:t.labelRef}),t.children))}),fft=D.memo(uft,(t,e)=>{var{viewBox:n}=t,r=SP(t,Qut),{viewBox:i}=e,a=SP(e,Jut);return $y(n,i)&&$y(r,a)}),zj=D.forwardRef((t,e)=>{var n=Fc(t,Bj);return D.createElement(fft,t1({},n,{ref:e}))});zj.displayName="CartesianAxis";var dft=["x1","y1","x2","y2","key"],hft=["offset"],gft=["xAxisId","yAxisId"],pft=["xAxisId","yAxisId"];function eJ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Cs(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?eJ(Object(n),!0).forEach(function(r){mft(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):eJ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function mft(t,e,n){return(e=vft(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vft(t){var e=yft(t,"string");return typeof e=="symbol"?e:e+""}function yft(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Sm(){return Sm=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},Sm.apply(null,arguments)}function yT(t,e){if(t==null)return{};var n,r,i=xft(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function xft(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var wft=t=>{var{fill:e}=t;if(!e||e==="none")return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=t;return D.createElement("rect",{x:r,y:i,ry:s,width:a,height:o,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function C1e(t,e){var n;if(D.isValidElement(t))n=D.cloneElement(t,e);else if(typeof t=="function")n=t(e);else{var{x1:r,y1:i,x2:a,y2:o,key:s}=e,c=yT(e,dft),l=bu(c),{offset:u}=l,f=yT(l,hft);n=D.createElement("line",Sm({},f,{x1:r,y1:i,x2:a,y2:o,fill:"none",key:s}))}return n}function bft(t){var{x:e,width:n,horizontal:r=!0,horizontalPoints:i}=t;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=t,s=yT(t,gft),c=i.map((l,u)=>{var f=Cs(Cs({},s),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(u),index:u});return C1e(r,f)});return D.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function Sft(t){var{y:e,height:n,vertical:r=!0,verticalPoints:i}=t;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=t,s=yT(t,pft),c=i.map((l,u)=>{var f=Cs(Cs({},s),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(u),index:u});return C1e(r,f)});return D.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function Cft(t){var{horizontalFill:e,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:c=!0}=t;if(!c||!e||!e.length)return null;var l=s.map(f=>Math.round(f+i-i)).sort((f,d)=>f-d);i!==l[0]&&l.unshift(0);var u=l.map((f,d)=>{var h=!l[d+1],m=h?i+o-f:l[d+1]-f;if(m<=0)return null;var p=d%e.length;return D.createElement("rect",{key:"react-".concat(d),y:f,x:r,height:m,width:a,stroke:"none",fill:e[p],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return D.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function _ft(t){var{vertical:e=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:c}=t;if(!e||!n||!n.length)return null;var l=c.map(f=>Math.round(f+i-i)).sort((f,d)=>f-d);i!==l[0]&&l.unshift(0);var u=l.map((f,d)=>{var h=!l[d+1],m=h?i+o-f:l[d+1]-f;if(m<=0)return null;var p=d%n.length;return D.createElement("rect",{key:"react-".concat(d),x:f,y:a,width:m,height:s,stroke:"none",fill:n[p],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return D.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var Tft=(t,e)=>{var{xAxis:n,width:r,height:i,offset:a}=t;return age(Fj(Cs(Cs(Cs({},Bj),n),{},{ticks:oge(n),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,e)},Eft=(t,e)=>{var{yAxis:n,width:r,height:i,offset:a}=t;return age(Fj(Cs(Cs(Cs({},Bj),n),{},{ticks:oge(n),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,e)},Oft={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0};function vC(t){var e=V$(),n=$$(),r=dge(),i=Cs(Cs({},Fc(t,Oft)),{},{x:qt(t.x)?t.x:r.left,y:qt(t.y)?t.y:r.top,width:qt(t.width)?t.width:r.width,height:qt(t.height)?t.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:c,width:l,height:u,syncWithTicks:f,horizontalValues:d,verticalValues:h}=i,m=ac(),p=Jt(V=>tQ(V,"xAxis",a,m)),y=Jt(V=>tQ(V,"yAxis",o,m));if(!qt(l)||l<=0||!qt(u)||u<=0||!qt(s)||s!==+s||!qt(c)||c!==+c)return null;var x=i.verticalCoordinatesGenerator||Tft,S=i.horizontalCoordinatesGenerator||Eft,{horizontalPoints:C,verticalPoints:_}=i;if((!C||!C.length)&&typeof S=="function"){var T=d&&d.length,O=S({yAxis:y?Cs(Cs({},y),{},{ticks:T?d:y.ticks}):void 0,width:e,height:n,offset:r},T?!0:f);X_(Array.isArray(O),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof O,"]")),Array.isArray(O)&&(C=O)}if((!_||!_.length)&&typeof x=="function"){var M=h&&h.length,I=x({xAxis:p?Cs(Cs({},p),{},{ticks:M?h:p.ticks}):void 0,width:e,height:n,offset:r},M?!0:f);X_(Array.isArray(I),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof I,"]")),Array.isArray(I)&&(_=I)}return D.createElement("g",{className:"recharts-cartesian-grid"},D.createElement(wft,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),D.createElement(Cft,Sm({},i,{horizontalPoints:C})),D.createElement(_ft,Sm({},i,{verticalPoints:_})),D.createElement(bft,Sm({},i,{offset:r,horizontalPoints:C,xAxis:p,yAxis:y})),D.createElement(Sft,Sm({},i,{offset:r,verticalPoints:_,xAxis:p,yAxis:y})))}vC.displayName="CartesianGrid";function Dft(t){var e=$b(t),n=3,r=2;if(e!=null){var{r:i,strokeWidth:a}=e,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}var _1e=(t,e,n,r)=>ep(t,"xAxis",e,r),T1e=(t,e,n,r)=>Jg(t,"xAxis",e,r),E1e=(t,e,n,r)=>ep(t,"yAxis",n,r),O1e=(t,e,n,r)=>Jg(t,"yAxis",n,r),Mft=He([Nr,_1e,E1e,T1e,O1e],(t,e,n,r,i)=>Th(t,"xAxis")?Pw(e,r,!1):Pw(n,i,!1)),Rft=(t,e,n,r,i)=>i,D1e=He([uE,Rft],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),Ift=(t,e,n,r,i)=>{var a,o=D1e(t,e,n,r,i);if(o!=null){var s=Nr(t),c=Th(s,"xAxis"),l;if(c?l=Uw(t,"yAxis",n,r):l=Uw(t,"xAxis",e,r),l!=null){var{stackId:u}=o,f=oE(o);if(!(u==null||f==null)){var d=(a=l[u])===null||a===void 0?void 0:a.stackedData;return d?.find(h=>h.key===f)}}}},Nft=He([Nr,_1e,E1e,T1e,O1e,Ift,eE,Mft,D1e],(t,e,n,r,i,a,o,s,c)=>{var{chartData:l,dataStartIndex:u,dataEndIndex:f}=o;if(!(c==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var{data:d}=c,h;if(d&&d.length>0?h=d:h=l?.slice(u,f+1),h!=null){var m=void 0;return Jft({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:u,areaSettings:c,stackedData:a,displayedData:h,chartBaseValue:m,bandSize:s})}}}),Pft=["id"],kft=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function M1e(t,e){if(t==null)return{};var n,r,i=Aft(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Aft(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function tJ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function U0(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tJ(Object(n),!0).forEach(function(r){Lft(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tJ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Lft(t,e,n){return(e=Vft(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Vft(t){var e=$ft(t,"string");return typeof e=="symbol"?e:e+""}function $ft(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Z0(){return Z0=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},Z0.apply(null,arguments)}function xT(t,e){return t&&t!=="none"?t:e}var jft=t=>{var{dataKey:e,name:n,stroke:r,fill:i,legendType:a,hide:o}=t;return[{inactive:o,dataKey:e,type:a,color:xT(r,i),value:V8(n,e),payload:t}]};function Uft(t){var{dataKey:e,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:c}=t;return{dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:e,nameKey:void 0,name:V8(o,e),hide:s,type:t.tooltipType,color:xT(r,a),unit:c}}}var Fft=(t,e)=>{var n;if(D.isValidElement(t))n=D.cloneElement(t,e);else if(typeof t=="function")n=t(e);else{var r=$r("recharts-area-dot",typeof t!="boolean"?t.className:"");n=D.createElement(n1e,Z0({},e,{className:r}))}return n};function Bft(t,e){return t==null?!1:e?!0:t.length===1}function zft(t){var{clipPathId:e,points:n,props:r}=t,{needClip:i,dot:a,dataKey:o}=r;if(!Bft(n,a))return null;var s=a1e(a),c=bu(r),l=fXe(a),u=n.map((d,h)=>{var m=U0(U0(U0({key:"dot-".concat(h),r:3},c),l),{},{index:h,cx:d.x,cy:d.y,dataKey:o,value:d.value,payload:d.payload,points:n});return Fft(a,m)}),f={clipPath:i?"url(#clipPath-".concat(s?"":"dots-").concat(e,")"):void 0};return D.createElement(Vc,Z0({className:"recharts-area-dots"},f),u)}function Gft(t){var{showLabels:e,children:n,points:r}=t,i=r.map(a=>{var o={x:a.x,y:a.y,width:0,height:0};return U0(U0({},o),{},{value:a.value,payload:a.payload,parentViewBox:void 0,viewBox:o,fill:void 0})});return D.createElement(Jme,{value:e?i:null},n)}function nJ(t){var{points:e,baseLine:n,needClip:r,clipPathId:i,props:a}=t,{layout:o,type:s,stroke:c,connectNulls:l,isRange:u}=a,{id:f}=a,d=M1e(a,Pft),h=bu(d);return D.createElement(D.Fragment,null,e?.length>1&&D.createElement(Vc,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},D.createElement(gC,Z0({},h,{id:f,points:e,connectNulls:l,type:s,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&D.createElement(gC,Z0({},h,{className:"recharts-area-curve",layout:o,type:s,connectNulls:l,fill:"none",points:e})),c!=="none"&&u&&D.createElement(gC,Z0({},h,{className:"recharts-area-curve",layout:o,type:s,connectNulls:l,fill:"none",points:n}))),D.createElement(zft,{points:e,props:d,clipPathId:i}))}function Wft(t){var{alpha:e,baseLine:n,points:r,strokeWidth:i}=t,a=r[0].y,o=r[r.length-1].y;if(!Za(a)||!Za(o))return null;var s=e*Math.abs(a-o),c=Math.max(...r.map(l=>l.x||0));return qt(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(l=>l.x||0),c)),qt(c)?D.createElement("rect",{x:0,y:a<o?a:a-s,width:c+(i?parseInt("".concat(i),10):1),height:Math.floor(s)}):null}function Hft(t){var{alpha:e,baseLine:n,points:r,strokeWidth:i}=t,a=r[0].x,o=r[r.length-1].x;if(!Za(a)||!Za(o))return null;var s=e*Math.abs(a-o),c=Math.max(...r.map(l=>l.y||0));return qt(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(l=>l.y||0),c)),qt(c)?D.createElement("rect",{x:a<o?a:a-s,y:0,width:s,height:Math.floor(c+(i?parseInt("".concat(i),10):1))}):null}function qft(t){var{alpha:e,layout:n,points:r,baseLine:i,strokeWidth:a}=t;return n==="vertical"?D.createElement(Wft,{alpha:e,points:r,baseLine:i,strokeWidth:a}):D.createElement(Hft,{alpha:e,points:r,baseLine:i,strokeWidth:a})}function Kft(t){var{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a}=t,{points:o,baseLine:s,isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:f,onAnimationStart:d,onAnimationEnd:h}=r,m=q8(r,"recharts-area-"),[p,y]=D.useState(!1),x=!p,S=D.useCallback(()=>{typeof h=="function"&&h(),y(!1)},[h]),C=D.useCallback(()=>{typeof d=="function"&&d(),y(!0)},[d]),_=i.current,T=a.current;return D.createElement(Gft,{showLabels:x,points:o},r.children,D.createElement(H8,{animationId:m,begin:l,duration:u,isActive:c,easing:f,onAnimationEnd:S,onAnimationStart:C,key:m},O=>{if(_){var M=_.length/o.length,I=O===1?o:o.map((k,L)=>{var $=Math.floor(L*M);if(_[$]){var W=_[$];return U0(U0({},k),{},{x:Ia(W.x,k.x,O),y:Ia(W.y,k.y,O)})}return k}),V;return qt(s)?V=Ia(T,s,O):ta(s)||El(s)?V=Ia(T,0,O):V=s.map((k,L)=>{var $=Math.floor(L*M);if(Array.isArray(T)&&T[$]){var W=T[$];return U0(U0({},k),{},{x:Ia(W.x,k.x,O),y:Ia(W.y,k.y,O)})}return k}),O>0&&(i.current=I,a.current=V),D.createElement(nJ,{points:I,baseLine:V,needClip:e,clipPathId:n,props:r})}return O>0&&(i.current=o,a.current=s),D.createElement(Vc,null,c&&D.createElement("defs",null,D.createElement("clipPath",{id:"animationClipPath-".concat(n)},D.createElement(qft,{alpha:O,points:o,baseLine:s,layout:r.layout,strokeWidth:r.strokeWidth}))),D.createElement(Vc,{clipPath:"url(#animationClipPath-".concat(n,")")},D.createElement(nJ,{points:o,baseLine:s,needClip:e,clipPathId:n,props:r})))}),D.createElement(t1e,{label:r.label}))}function Yft(t){var{needClip:e,clipPathId:n,props:r}=t,i=D.useRef(null),a=D.useRef();return D.createElement(Kft,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class Xft extends D.PureComponent{render(){var{hide:e,dot:n,points:r,className:i,top:a,left:o,needClip:s,xAxisId:c,yAxisId:l,width:u,height:f,id:d,baseLine:h}=this.props;if(e)return null;var m=$r("recharts-area",i),p=d,{r:y,strokeWidth:x}=Dft(n),S=a1e(n),C=y*2+x;return D.createElement(D.Fragment,null,D.createElement(Vc,{className:m},s&&D.createElement("defs",null,D.createElement(m1e,{clipPathId:p,xAxisId:c,yAxisId:l}),!S&&D.createElement("clipPath",{id:"clipPath-dots-".concat(p)},D.createElement("rect",{x:o-C/2,y:a-C/2,width:u+C,height:f+C}))),D.createElement(Yft,{needClip:s,clipPathId:p,props:this.props})),D.createElement(HQ,{points:r,mainColor:xT(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot}),this.props.isRange&&Array.isArray(h)&&D.createElement(HQ,{points:h,mainColor:xT(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot}))}}var R1e={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:!_1.isSsr,legendType:"line",stroke:"#3182bd",xAxisId:0,yAxisId:0};function Zft(t){var e,n=Fc(t,R1e),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:c,fill:l,fillOpacity:u,hide:f,isAnimationActive:d,legendType:h,stroke:m,xAxisId:p,yAxisId:y}=n,x=M1e(n,kft),S=z8(),C=Pme(),{needClip:_}=jj(p,y),T=ac(),{points:O,isRange:M,baseLine:I}=(e=Jt(G=>Nft(G,p,y,T,t.id)))!==null&&e!==void 0?e:{},V=Vj();if(S!=="horizontal"&&S!=="vertical"||V==null||C!=="AreaChart"&&C!=="ComposedChart")return null;var{height:k,width:L,x:$,y:W}=V;return!O||!O.length?null:D.createElement(Xft,Z0({},x,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:I,connectNulls:s,dot:c,fill:l,fillOpacity:u,height:k,hide:f,layout:S,isAnimationActive:d,isRange:M,legendType:h,needClip:_,points:O,stroke:m,width:L,left:$,top:W,xAxisId:p,yAxisId:y}))}var Qft=(t,e,n,r,i)=>{var a=n??e;if(qt(a))return a;var o=t==="horizontal"?i:r,s=o.scale.domain();if(o.type==="number"){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a==="dataMin"?l:a==="dataMax"||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a==="dataMin"?s[0]:a==="dataMax"?s[1]:s[0]};function Jft(t){var{areaSettings:{connectNulls:e,baseValue:n,dataKey:r},stackedData:i,layout:a,chartBaseValue:o,xAxis:s,yAxis:c,displayedData:l,dataStartIndex:u,xAxisTicks:f,yAxisTicks:d,bandSize:h}=t,m=i&&i.length,p=Qft(a,o,n,s,c),y=a==="horizontal",x=!1,S=l.map((_,T)=>{var O;m?O=i[u+T]:(O=Po(_,r),Array.isArray(O)?x=!0:O=[p,O]);var M=O[1]==null||m&&!e&&Po(_,r)==null;return y?{x:MX({axis:s,ticks:f,bandSize:h,entry:_,index:T}),y:M?null:c.scale(O[1]),value:O,payload:_}:{x:M?null:s.scale(O[1]),y:MX({axis:c,ticks:d,bandSize:h,entry:_,index:T}),value:O,payload:_}}),C;return m||x?C=S.map(_=>{var T=Array.isArray(_.value)?_.value[0]:null;return y?{x:_.x,y:T!=null&&_.y!=null?c.scale(T):null,payload:_.payload}:{x:T!=null?s.scale(T):null,y:_.y,payload:_.payload}}):C=y?c.scale(p):s.scale(p),{points:S,baseLine:C,isRange:x}}function edt(t){var e=Fc(t,R1e),n=ac();return D.createElement(f1e,{id:e.id,type:"area"},r=>D.createElement(D.Fragment,null,D.createElement(u1e,{legendPayload:jft(e)}),D.createElement(l1e,{fn:Uft,args:e}),D.createElement(h1e,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:sge(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),D.createElement(Zft,Z0({},e,{id:r}))))}var CP=D.memo(edt);CP.displayName="Area";var tdt=["dangerouslySetInnerHTML","ticks"],ndt=["id"],rdt=["domain"],idt=["domain"];function _P(){return _P=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},_P.apply(null,arguments)}function wT(t,e){if(t==null)return{};var n,r,i=adt(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function adt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function odt(t){var e=Aa();return D.useLayoutEffect(()=>(e(ilt(t)),()=>{e(alt(t))}),[t,e]),null}var sdt=t=>{var{xAxisId:e,className:n}=t,r=Jt(A$),i=ac(),a="xAxis",o=Jt(y=>E2(y,a,e,i)),s=Jt(y=>ume(y,a,e,i)),c=Jt(y=>ome(y,e)),l=Jt(y=>Rat(y,e)),u=Jt(y=>Mpe(y,e));if(c==null||l==null||u==null)return null;var{dangerouslySetInnerHTML:f,ticks:d}=t,h=wT(t,tdt),{id:m}=u,p=wT(u,ndt);return D.createElement(zj,_P({},h,p,{scale:o,x:l.x,y:l.y,width:c.width,height:c.height,className:$r("recharts-".concat(a," ").concat(a),n),viewBox:r,ticks:s}))},cdt={allowDataOverflow:al.allowDataOverflow,allowDecimals:al.allowDecimals,allowDuplicatedCategory:al.allowDuplicatedCategory,height:al.height,hide:!1,mirror:al.mirror,orientation:al.orientation,padding:al.padding,reversed:al.reversed,scale:al.scale,tickCount:al.tickCount,type:al.type,xAxisId:0},ldt=t=>{var e,n,r,i,a,o=Fc(t,cdt);return D.createElement(D.Fragment,null,D.createElement(odt,{interval:(e=o.interval)!==null&&e!==void 0?e:"preserveEnd",id:o.xAxisId,scale:o.scale,type:o.type,padding:o.padding,allowDataOverflow:o.allowDataOverflow,domain:o.domain,dataKey:o.dataKey,allowDuplicatedCategory:o.allowDuplicatedCategory,allowDecimals:o.allowDecimals,tickCount:o.tickCount,includeHidden:(n=o.includeHidden)!==null&&n!==void 0?n:!1,reversed:o.reversed,ticks:o.ticks,height:o.height,orientation:o.orientation,mirror:o.mirror,hide:o.hide,unit:o.unit,name:o.name,angle:(r=o.angle)!==null&&r!==void 0?r:0,minTickGap:(i=o.minTickGap)!==null&&i!==void 0?i:5,tick:(a=o.tick)!==null&&a!==void 0?a:!0,tickFormatter:o.tickFormatter}),D.createElement(sdt,o))},udt=(t,e)=>{var{domain:n}=t,r=wT(t,rdt),{domain:i}=e,a=wT(e,idt);return $y(r,a)?Array.isArray(n)&&n.length===2&&Array.isArray(i)&&i.length===2?n[0]===i[0]&&n[1]===i[1]:$y({domain:n},{domain:i}):!1},yC=D.memo(ldt,udt);yC.displayName="XAxis";var fdt=["dangerouslySetInnerHTML","ticks"],ddt=["id"],hdt=["domain"],gdt=["domain"];function TP(){return TP=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},TP.apply(null,arguments)}function bT(t,e){if(t==null)return{};var n,r,i=pdt(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function pdt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function mdt(t){var e=Aa();return D.useLayoutEffect(()=>(e(olt(t)),()=>{e(slt(t))}),[t,e]),null}var vdt=t=>{var{yAxisId:e,className:n,width:r,label:i}=t,a=D.useRef(null),o=D.useRef(null),s=Jt(A$),c=ac(),l=Aa(),u="yAxis",f=Jt(T=>E2(T,u,e,c)),d=Jt(T=>sme(T,e)),h=Jt(T=>Nat(T,e)),m=Jt(T=>ume(T,u,e,c)),p=Jt(T=>Rpe(T,e));if(D.useLayoutEffect(()=>{if(!(r!=="auto"||!d||Lj(i)||D.isValidElement(i)||p==null)){var T=a.current;if(T){var O=T.getCalculatedWidth();Math.round(d.width)!==Math.round(O)&&l(clt({id:e,width:O}))}}},[m,d,l,i,e,r,p]),d==null||h==null||p==null)return null;var{dangerouslySetInnerHTML:y,ticks:x}=t,S=bT(t,fdt),{id:C}=p,_=bT(p,ddt);return D.createElement(zj,TP({},S,_,{ref:a,labelRef:o,scale:f,x:h.x,y:h.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:d.width,height:d.height,className:$r("recharts-".concat(u," ").concat(u),n),viewBox:s,ticks:m}))},ydt={allowDataOverflow:ol.allowDataOverflow,allowDecimals:ol.allowDecimals,allowDuplicatedCategory:ol.allowDuplicatedCategory,hide:!1,mirror:ol.mirror,orientation:ol.orientation,padding:ol.padding,reversed:ol.reversed,scale:ol.scale,tickCount:ol.tickCount,type:ol.type,width:ol.width,yAxisId:0},xdt=t=>{var e,n,r,i,a,o=Fc(t,ydt);return D.createElement(D.Fragment,null,D.createElement(mdt,{interval:(e=o.interval)!==null&&e!==void 0?e:"preserveEnd",id:o.yAxisId,scale:o.scale,type:o.type,domain:o.domain,allowDataOverflow:o.allowDataOverflow,dataKey:o.dataKey,allowDuplicatedCategory:o.allowDuplicatedCategory,allowDecimals:o.allowDecimals,tickCount:o.tickCount,padding:o.padding,includeHidden:(n=o.includeHidden)!==null&&n!==void 0?n:!1,reversed:o.reversed,ticks:o.ticks,width:o.width,orientation:o.orientation,mirror:o.mirror,hide:o.hide,unit:o.unit,name:o.name,angle:(r=o.angle)!==null&&r!==void 0?r:0,minTickGap:(i=o.minTickGap)!==null&&i!==void 0?i:5,tick:(a=o.tick)!==null&&a!==void 0?a:!0,tickFormatter:o.tickFormatter}),D.createElement(vdt,o))},wdt=(t,e)=>{var{domain:n}=t,r=bT(t,hdt),{domain:i}=e,a=bT(e,gdt);return $y(r,a)?Array.isArray(n)&&n.length===2&&Array.isArray(i)&&i.length===2?n[0]===i[0]&&n[1]===i[1]:$y({domain:n},{domain:i}):!1},xC=D.memo(xdt,wdt);xC.displayName="YAxis";var YM={exports:{}},XM={};/**
 * @license React
 * use-sync-external-store-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 rJ;function bdt(){if(rJ)return XM;rJ=1;var t=Jy();function e(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,a=t.useEffect,o=t.useMemo,s=t.useDebugValue;return XM.useSyncExternalStoreWithSelector=function(c,l,u,f,d){var h=i(null);if(h.current===null){var m={hasValue:!1,value:null};h.current=m}else m=h.current;h=o(function(){function y(T){if(!x){if(x=!0,S=T,T=f(T),d!==void 0&&m.hasValue){var O=m.value;if(d(O,T))return C=O}return C=T}if(O=C,n(S,T))return O;var M=f(T);return d!==void 0&&d(O,M)?(S=T,O):(S=T,C=M)}var x=!1,S,C,_=u===void 0?null:u;return[function(){return y(l())},_===null?void 0:function(){return y(_())}]},[l,u,f,d]);var p=r(c,h[0],h[1]);return a(function(){m.hasValue=!0,m.value=p},[p]),s(p),p},XM}var iJ;function Sdt(){return iJ||(iJ=1,YM.exports=bdt()),YM.exports}Sdt();function Cdt(t){t()}function _dt(){let t=null,e=null;return{clear(){t=null,e=null},notify(){Cdt(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var aJ={notify(){},get:()=>[]};function Tdt(t,e){let n,r=aJ,i=0,a=!1;function o(p){u();const y=r.subscribe(p);let x=!1;return()=>{x||(x=!0,y(),f())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t.subscribe(c),r=_dt())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=aJ)}function d(){a||(a=!0,u())}function h(){a&&(a=!1,f())}const m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:d,tryUnsubscribe:h,getListeners:()=>r};return m}var Edt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Odt=Edt(),Ddt=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Mdt=Ddt(),Rdt=()=>Odt||Mdt?D.useLayoutEffect:D.useEffect,Idt=Rdt(),Ndt=Symbol.for("react-redux-context"),Pdt=typeof globalThis<"u"?globalThis:{};function kdt(){if(!D.createContext)return{};const t=Pdt[Ndt]??=new Map;let e=t.get(D.createContext);return e||(e=D.createContext(null),t.set(D.createContext,e)),e}var Adt=kdt();function Ldt(t){const{children:e,context:n,serverState:r,store:i}=t,a=D.useMemo(()=>{const c=Tdt(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=D.useMemo(()=>i.getState(),[i]);Idt(()=>{const{subscription:c}=a;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[a,o]);const s=n||Adt;return D.createElement(s.Provider,{value:a},e)}var Vdt=Ldt,$dt=(t,e)=>e,Gj=He([$dt,Nr,Epe,vo,Ome,Ih,Lot,Vo],Fot),Wj=t=>{var e=t.currentTarget.getBoundingClientRect(),n=e.width/t.currentTarget.offsetWidth,r=e.height/t.currentTarget.offsetHeight;return{chartX:Math.round((t.clientX-e.left)/n),chartY:Math.round((t.clientY-e.top)/r)}},I1e=Su("mouseClick"),N1e=Fb();N1e.startListening({actionCreator:I1e,effect:(t,e)=>{var n=t.payload,r=Gj(e.getState(),Wj(n));r?.activeIndex!=null&&e.dispatch(Wat({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var EP=Su("mouseMove"),P1e=Fb();P1e.startListening({actionCreator:EP,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=Ej(r,r.tooltip.settings.shared),a=Gj(r,Wj(n));i==="axis"&&(a?.activeIndex!=null?e.dispatch(yme({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate})):e.dispatch(vme()))}});var oJ={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index"},k1e=Nl({name:"rootProps",initialState:oJ,reducers:{updateOptions:(t,e)=>{var n;t.accessibilityLayer=e.payload.accessibilityLayer,t.barCategoryGap=e.payload.barCategoryGap,t.barGap=(n=e.payload.barGap)!==null&&n!==void 0?n:oJ.barGap,t.barSize=e.payload.barSize,t.maxBarSize=e.payload.maxBarSize,t.stackOffset=e.payload.stackOffset,t.syncId=e.payload.syncId,t.syncMethod=e.payload.syncMethod,t.className=e.payload.className}}}),jdt=k1e.reducer,{updateOptions:Udt}=k1e.actions,A1e=Nl({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(t,e)=>e.payload}}),{updatePolarOptions:hXt}=A1e.actions,Fdt=A1e.reducer,L1e=Su("keyDown"),V1e=Su("focus"),Hj=Fb();Hj.startListening({actionCreator:L1e,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,a=t.payload;if(!(a!=="ArrowRight"&&a!=="ArrowLeft"&&a!=="Enter")){var o=Number(Oj(i,D2(n))),s=Ih(n);if(a==="Enter"){var c=dT(n,"axis","hover",String(i.index));e.dispatch(mP({active:!i.active,activeIndex:i.index,activeDataKey:i.dataKey,activeCoordinate:c}));return}var l=Lat(n),u=l==="left-to-right"?1:-1,f=a==="ArrowRight"?1:-1,d=o+f*u;if(!(s==null||d>=s.length||d<0)){var h=dT(n,"axis","hover",String(d));e.dispatch(mP({active:!0,activeIndex:d.toString(),activeDataKey:void 0,activeCoordinate:h}))}}}}});Hj.startListening({actionCreator:V1e,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var a="0",o=dT(n,"axis","hover",String(a));e.dispatch(mP({activeDataKey:void 0,active:!0,activeIndex:a,activeCoordinate:o}))}}}});var iu=Su("externalEvent"),$1e=Fb();$1e.startListening({actionCreator:iu,effect:(t,e)=>{if(t.payload.handler!=null){var n=e.getState(),r={activeCoordinate:Oot(n),activeDataKey:Ime(n),activeIndex:e1(n),activeLabel:Rme(n),activeTooltipIndex:e1(n),isTooltipActive:Dot(n)};t.payload.handler(r,t.payload.reactEvent)}}});var Bdt=He([O2],t=>t.tooltipItemPayloads),zdt=He([Bdt,Zb,(t,e,n)=>e,(t,e,n)=>n],(t,e,n,r)=>{var i=t.find(s=>s.settings.dataKey===r);if(i!=null){var{positions:a}=i;if(a!=null){var o=e(a,n);return o}}}),j1e=Su("touchMove"),U1e=Fb();U1e.startListening({actionCreator:j1e,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=Ej(r,r.tooltip.settings.shared);if(i==="axis"){var a=Gj(r,Wj({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,currentTarget:n.currentTarget}));a?.activeIndex!=null&&e.dispatch(yme({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate}))}else if(i==="item"){var o,s=n.touches[0],c=document.elementFromPoint(s.clientX,s.clientY);if(!c||!c.getAttribute)return;var l=c.getAttribute(AJe),u=(o=c.getAttribute(LJe))!==null&&o!==void 0?o:void 0,f=zdt(e.getState(),l,u);e.dispatch(mme({activeDataKey:u,activeIndex:l,activeCoordinate:f}))}}});var Gdt=Phe({brush:Iut,cartesianAxis:llt,chartData:rst,errorBars:Dlt,graphicalItems:Jct,layout:aJe,legend:met,options:Qot,polarAxis:wct,polarOptions:Fdt,referenceElements:$ut,rootProps:jdt,tooltip:Hat}),Wdt=function(e){return RQe({reducer:Gdt,preloadedState:e,middleware:n=>n({serializableCheck:!1}).concat([N1e.middleware,P1e.middleware,Hj.middleware,$1e.middleware,U1e.middleware]),enhancers:n=>{var r=n;return typeof n=="function"&&(r=n()),r.concat(Whe({type:"raf"}))},devTools:_1.devToolsEnabled})};function Hdt(t){var{preloadedState:e,children:n,reduxStoreName:r}=t,i=ac(),a=D.useRef(null);if(i)return n;a.current==null&&(a.current=Wdt(e));var o=M$;return D.createElement(Vdt,{context:o,store:a.current},n)}function qdt(t){var{layout:e,margin:n}=t,r=Aa(),i=ac();return D.useEffect(()=>{i||(r(nJe(e)),r(tJe(n)))},[r,i,e,n]),null}function Kdt(t){var e=Aa();return D.useEffect(()=>{e(Udt(t))},[e,t]),null}var Ydt=["children"];function Xdt(t,e){if(t==null)return{};var n,r,i=Zdt(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Zdt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function ST(){return ST=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},ST.apply(null,arguments)}var Qdt={width:"100%",height:"100%",display:"block"},Jdt=D.forwardRef((t,e)=>{var n=V$(),r=$$(),i=gge();if(!Py(n)||!Py(r))return null;var{children:a,otherAttributes:o,title:s,desc:c}=t,l,u;return typeof o.tabIndex=="number"?l=o.tabIndex:l=i?0:void 0,typeof o.role=="string"?u=o.role:u=i?"application":void 0,D.createElement(m$,ST({},o,{title:s,desc:c,role:u,tabIndex:l,width:n,height:r,style:Qdt,ref:e}),a)}),e0t=t=>{var{children:e}=t,n=Jt(F8);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return D.createElement(m$,{width:r,height:i,x:o,y:a},e)},sJ=D.forwardRef((t,e)=>{var{children:n}=t,r=Xdt(t,Ydt),i=ac();return i?D.createElement(e0t,null,n):D.createElement(Jdt,ST({ref:e},r),n)});function t0t(){var t=Aa(),[e,n]=D.useState(null),r=Jt(kJe);return D.useEffect(()=>{if(e!=null){var i=e.getBoundingClientRect(),a=i.width/e.offsetWidth;Za(a)&&a!==r&&t(iJe(a))}},[e,t,r]),n}function cJ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function n0t(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cJ(Object(n),!0).forEach(function(r){r0t(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cJ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function r0t(t,e,n){return(e=i0t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i0t(t){var e=a0t(t,"string");return typeof e=="symbol"?e:e+""}function a0t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function n1(){return n1=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},n1.apply(null,arguments)}var o0t=()=>(dst(),null);function CT(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var s0t=D.forwardRef((t,e)=>{var n,r,i=D.useRef(null),[a,o]=D.useState({containerWidth:CT((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:CT((r=t.style)===null||r===void 0?void 0:r.height)}),s=D.useCallback((l,u)=>{o(f=>{var d=Math.round(l),h=Math.round(u);return f.containerWidth===d&&f.containerHeight===h?f:{containerWidth:d,containerHeight:h}})},[]),c=D.useCallback(l=>{if(typeof e=="function"&&e(l),l!=null){var{width:u,height:f}=l.getBoundingClientRect();s(u,f);var d=m=>{var{width:p,height:y}=m[0].contentRect;s(p,y)},h=new ResizeObserver(d);h.observe(l),i.current=h}},[e,s]);return D.useEffect(()=>()=>{var l=i.current;l?.disconnect()},[s]),D.createElement(D.Fragment,null,D.createElement(G8,{width:a.containerWidth,height:a.containerHeight}),D.createElement("div",n1({ref:c},t)))}),c0t=D.forwardRef((t,e)=>{var{width:n,height:r}=t,[i,a]=D.useState({containerWidth:CT(n),containerHeight:CT(r)}),o=D.useCallback((c,l)=>{a(u=>{var f=Math.round(c),d=Math.round(l);return u.containerWidth===f&&u.containerHeight===d?u:{containerWidth:f,containerHeight:d}})},[]),s=D.useCallback(c=>{if(typeof e=="function"&&e(c),c!=null){var{width:l,height:u}=c.getBoundingClientRect();o(l,u)}},[e,o]);return D.createElement(D.Fragment,null,D.createElement(G8,{width:i.containerWidth,height:i.containerHeight}),D.createElement("div",n1({ref:s},t)))}),l0t=D.forwardRef((t,e)=>{var{width:n,height:r}=t;return D.createElement(D.Fragment,null,D.createElement(G8,{width:n,height:r}),D.createElement("div",n1({ref:e},t)))}),u0t=D.forwardRef((t,e)=>{var{width:n,height:r}=t;return hh(n)||hh(r)?D.createElement(c0t,n1({},t,{ref:e})):D.createElement(l0t,n1({},t,{ref:e}))});function f0t(t){return t===!0?s0t:u0t}var d0t=D.forwardRef((t,e)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:c,onMouseEnter:l,onMouseLeave:u,onMouseMove:f,onMouseUp:d,onTouchEnd:h,onTouchMove:m,onTouchStart:p,style:y,width:x,responsive:S,dispatchTouchEvents:C=!0}=t,_=D.useRef(null),T=Aa(),[O,M]=D.useState(null),[I,V]=D.useState(null),k=t0t(),L=L$(),$=L?.width>0?L.width:x,W=L?.height>0?L.height:i,G=D.useCallback(be=>{k(be),typeof e=="function"&&e(be),M(be),V(be),be!=null&&(_.current=be)},[k,e,M,V]),oe=D.useCallback(be=>{T(I1e(be)),T(iu({handler:a,reactEvent:be}))},[T,a]),U=D.useCallback(be=>{T(EP(be)),T(iu({handler:l,reactEvent:be}))},[T,l]),Y=D.useCallback(be=>{T(vme()),T(iu({handler:u,reactEvent:be}))},[T,u]),J=D.useCallback(be=>{T(EP(be)),T(iu({handler:f,reactEvent:be}))},[T,f]),ne=D.useCallback(()=>{T(V1e())},[T]),F=D.useCallback(be=>{T(L1e(be.key))},[T]),ae=D.useCallback(be=>{T(iu({handler:o,reactEvent:be}))},[T,o]),re=D.useCallback(be=>{T(iu({handler:s,reactEvent:be}))},[T,s]),te=D.useCallback(be=>{T(iu({handler:c,reactEvent:be}))},[T,c]),ye=D.useCallback(be=>{T(iu({handler:d,reactEvent:be}))},[T,d]),we=D.useCallback(be=>{T(iu({handler:p,reactEvent:be}))},[T,p]),Oe=D.useCallback(be=>{C&&T(j1e(be)),T(iu({handler:m,reactEvent:be}))},[T,C,m]),Te=D.useCallback(be=>{T(iu({handler:h,reactEvent:be}))},[T,h]),Me=f0t(S);return D.createElement($me.Provider,{value:O},D.createElement(Z0e.Provider,{value:I},D.createElement(Me,{width:$??y?.width,height:W??y?.height,className:$r("recharts-wrapper",r),style:n0t({position:"relative",cursor:"default",width:$,height:W},y),onClick:oe,onContextMenu:ae,onDoubleClick:re,onFocus:ne,onKeyDown:F,onMouseDown:te,onMouseEnter:U,onMouseLeave:Y,onMouseMove:J,onMouseUp:ye,onTouchEnd:Te,onTouchMove:Oe,onTouchStart:we,ref:G},D.createElement(o0t,null),n)))}),h0t=["width","height","responsive","children","className","style","compact","title","desc"];function g0t(t,e){if(t==null)return{};var n,r,i=p0t(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function p0t(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var m0t=D.forwardRef((t,e)=>{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:c,title:l,desc:u}=t,f=g0t(t,h0t),d=bu(f);return c?D.createElement(D.Fragment,null,D.createElement(G8,{width:n,height:r}),D.createElement(sJ,{otherAttributes:d,title:l,desc:u},a)):D.createElement(d0t,{className:o,style:s,width:n,height:r,responsive:i,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},D.createElement(sJ,{otherAttributes:d,title:l,desc:u,ref:e},D.createElement(Uut,null,a)))});function OP(){return OP=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},OP.apply(null,arguments)}var v0t={top:5,right:5,bottom:5,left:5},y0t={accessibilityLayer:!0,layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:v0t,reverseStackOrder:!1,syncMethod:"index",responsive:!1},F1e=D.forwardRef(function(e,n){var r,i=Fc(e.categoricalChartProps,y0t),{chartName:a,defaultTooltipEventType:o,validateTooltipEventTypes:s,tooltipPayloadSearcher:c,categoricalChartProps:l}=e,u={chartName:a,defaultTooltipEventType:o,validateTooltipEventTypes:s,tooltipPayloadSearcher:c,eventEmitter:void 0};return D.createElement(Hdt,{preloadedState:{options:u},reduxStoreName:(r=l.id)!==null&&r!==void 0?r:a},D.createElement(Rut,{chartData:l.data}),D.createElement(qdt,{layout:i.layout,margin:i.margin}),D.createElement(Kdt,{accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className}),D.createElement(m0t,OP({},i,{ref:n})))}),x0t=["axis","item"],w0t=D.forwardRef((t,e)=>D.createElement(F1e,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:x0t,tooltipPayloadSearcher:jme,categoricalChartProps:t,ref:e})),b0t=["axis"],lJ=D.forwardRef((t,e)=>D.createElement(F1e,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:b0t,tooltipPayloadSearcher:jme,categoricalChartProps:t,ref:e}));function DP(t,[e,n]){return Math.min(n,Math.max(e,t))}function qj(t){const e=D.useRef({value:t,previous:t});return D.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var B1e=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"}),S0t="VisuallyHidden",z1e=D.forwardRef((t,e)=>w.jsx(Yt.span,{...t,ref:e,style:{...B1e,...t.style}}));z1e.displayName=S0t;var C0t=z1e,_0t=[" ","Enter","ArrowUp","ArrowDown"],T0t=[" ","Enter"],r1="Select",[pE,mE,E0t]=QV(r1),[M2]=Uc(r1,[E0t,vp]),vE=vp(),[O0t,bp]=M2(r1),[D0t,M0t]=M2(r1),G1e=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:f,disabled:d,required:h,form:m}=t,p=vE(e),[y,x]=D.useState(null),[S,C]=D.useState(null),[_,T]=D.useState(!1),O=h8(l),[M,I]=xd({prop:r,defaultProp:i??!1,onChange:a,caller:r1}),[V,k]=xd({prop:o,defaultProp:s,onChange:c,caller:r1}),L=D.useRef(null),$=y?m||!!y.closest("form"):!0,[W,G]=D.useState(new Set),oe=Array.from(W).map(U=>U.props.value).join(";");return w.jsx(y8,{...p,children:w.jsxs(O0t,{required:h,scope:e,trigger:y,onTriggerChange:x,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:_,onValueNodeHasChildrenChange:T,contentId:No(),value:V,onValueChange:k,open:M,onOpenChange:I,dir:O,triggerPointerDownPosRef:L,disabled:d,children:[w.jsx(pE.Provider,{scope:e,children:w.jsx(D0t,{scope:t.__scopeSelect,onNativeOptionAdd:D.useCallback(U=>{G(Y=>new Set(Y).add(U))},[]),onNativeOptionRemove:D.useCallback(U=>{G(Y=>{const J=new Set(Y);return J.delete(U),J})},[]),children:n})}),$?w.jsxs(dve,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:f,value:V,onChange:U=>k(U.target.value),disabled:d,form:m,children:[V===void 0?w.jsx("option",{value:""}):null,Array.from(W)]},oe):null]})})};G1e.displayName=r1;var W1e="SelectTrigger",H1e=D.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,a=vE(n),o=bp(W1e,n),s=o.disabled||r,c=$n(e,o.onTriggerChange),l=mE(n),u=D.useRef("touch"),[f,d,h]=gve(p=>{const y=l().filter(C=>!C.disabled),x=y.find(C=>C.value===o.value),S=pve(y,p,x);S!==void 0&&o.onValueChange(S.value)}),m=p=>{s||(o.onOpenChange(!0),h()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return w.jsx(kb,{asChild:!0,...a,children:w.jsx(Yt.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:s,"data-disabled":s?"":void 0,"data-placeholder":hve(o.value)?"":void 0,...i,ref:c,onClick:Et(i.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&m(p)}),onPointerDown:Et(i.onPointerDown,p=>{u.current=p.pointerType;const y=p.target;y.hasPointerCapture(p.pointerId)&&y.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(m(p),p.preventDefault())}),onKeyDown:Et(i.onKeyDown,p=>{const y=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&d(p.key),!(y&&p.key===" ")&&_0t.includes(p.key)&&(m(),p.preventDefault())})})})});H1e.displayName=W1e;var q1e="SelectValue",K1e=D.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:a,placeholder:o="",...s}=t,c=bp(q1e,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,f=$n(e,c.onValueNodeChange);return ko(()=>{l(u)},[l,u]),w.jsx(Yt.span,{...s,ref:f,style:{pointerEvents:"none"},children:hve(c.value)?w.jsx(w.Fragment,{children:o}):a})});K1e.displayName=q1e;var R0t="SelectIcon",Y1e=D.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return w.jsx(Yt.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});Y1e.displayName=R0t;var I0t="SelectPortal",X1e=t=>w.jsx(f2,{asChild:!0,...t});X1e.displayName=I0t;var i1="SelectContent",Z1e=D.forwardRef((t,e)=>{const n=bp(i1,t.__scopeSelect),[r,i]=D.useState();if(ko(()=>{i(new DocumentFragment)},[]),!n.open){const a=r;return a?x1.createPortal(w.jsx(Q1e,{scope:t.__scopeSelect,children:w.jsx(pE.Slot,{scope:t.__scopeSelect,children:w.jsx("div",{children:t.children})})}),a):null}return w.jsx(J1e,{...t,ref:e})});Z1e.displayName=i1;var Wu=10,[Q1e,Sp]=M2(i1),N0t="SelectContentImpl",P0t=Hg("SelectContent.RemoveScroll"),J1e=D.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:d,collisionPadding:h,sticky:m,hideWhenDetached:p,avoidCollisions:y,...x}=t,S=bp(i1,n),[C,_]=D.useState(null),[T,O]=D.useState(null),M=$n(e,Te=>_(Te)),[I,V]=D.useState(null),[k,L]=D.useState(null),$=mE(n),[W,G]=D.useState(!1),oe=D.useRef(!1);D.useEffect(()=>{if(C)return L6(C)},[C]),k6();const U=D.useCallback(Te=>{const[Me,...be]=$().map(je=>je.ref.current),[Ye]=be.slice(-1),ft=document.activeElement;for(const je of Te)if(je===ft||(je?.scrollIntoView({block:"nearest"}),je===Me&&T&&(T.scrollTop=0),je===Ye&&T&&(T.scrollTop=T.scrollHeight),je?.focus(),document.activeElement!==ft))return},[$,T]),Y=D.useCallback(()=>U([I,C]),[U,I,C]);D.useEffect(()=>{W&&Y()},[W,Y]);const{onOpenChange:J,triggerPointerDownPosRef:ne}=S;D.useEffect(()=>{if(C){let Te={x:0,y:0};const Me=Ye=>{Te={x:Math.abs(Math.round(Ye.pageX)-(ne.current?.x??0)),y:Math.abs(Math.round(Ye.pageY)-(ne.current?.y??0))}},be=Ye=>{Te.x<=10&&Te.y<=10?Ye.preventDefault():C.contains(Ye.target)||J(!1),document.removeEventListener("pointermove",Me),ne.current=null};return ne.current!==null&&(document.addEventListener("pointermove",Me),document.addEventListener("pointerup",be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Me),document.removeEventListener("pointerup",be,{capture:!0})}}},[C,J,ne]),D.useEffect(()=>{const Te=()=>J(!1);return window.addEventListener("blur",Te),window.addEventListener("resize",Te),()=>{window.removeEventListener("blur",Te),window.removeEventListener("resize",Te)}},[J]);const[F,ae]=gve(Te=>{const Me=$().filter(ft=>!ft.disabled),be=Me.find(ft=>ft.ref.current===document.activeElement),Ye=pve(Me,Te,be);Ye&&setTimeout(()=>Ye.ref.current.focus())}),re=D.useCallback((Te,Me,be)=>{const Ye=!oe.current&&!be;(S.value!==void 0&&S.value===Me||Ye)&&(V(Te),Ye&&(oe.current=!0))},[S.value]),te=D.useCallback(()=>C?.focus(),[C]),ye=D.useCallback((Te,Me,be)=>{const Ye=!oe.current&&!be;(S.value!==void 0&&S.value===Me||Ye)&&L(Te)},[S.value]),we=r==="popper"?MP:eve,Oe=we===MP?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:d,collisionPadding:h,sticky:m,hideWhenDetached:p,avoidCollisions:y}:{};return w.jsx(Q1e,{scope:n,content:C,viewport:T,onViewportChange:O,itemRefCallback:re,selectedItem:I,onItemLeave:te,itemTextRefCallback:ye,focusSelectedItem:Y,selectedItemText:k,position:r,isPositioned:W,searchRef:F,children:w.jsx(mb,{as:P0t,allowPinchZoom:!0,children:w.jsx(pb,{asChild:!0,trapped:S.open,onMountAutoFocus:Te=>{Te.preventDefault()},onUnmountAutoFocus:Et(i,Te=>{S.trigger?.focus({preventScroll:!0}),Te.preventDefault()}),children:w.jsx(u2,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:Te=>Te.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:w.jsx(we,{role:"listbox",id:S.contentId,"data-state":S.open?"open":"closed",dir:S.dir,onContextMenu:Te=>Te.preventDefault(),...x,...Oe,onPlaced:()=>G(!0),ref:M,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:Et(x.onKeyDown,Te=>{const Me=Te.ctrlKey||Te.altKey||Te.metaKey;if(Te.key==="Tab"&&Te.preventDefault(),!Me&&Te.key.length===1&&ae(Te.key),["ArrowUp","ArrowDown","Home","End"].includes(Te.key)){let Ye=$().filter(ft=>!ft.disabled).map(ft=>ft.ref.current);if(["ArrowUp","End"].includes(Te.key)&&(Ye=Ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(Te.key)){const ft=Te.target,je=Ye.indexOf(ft);Ye=Ye.slice(je+1)}setTimeout(()=>U(Ye)),Te.preventDefault()}})})})})})})});J1e.displayName=N0t;var k0t="SelectItemAlignedPosition",eve=D.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,a=bp(i1,n),o=Sp(i1,n),[s,c]=D.useState(null),[l,u]=D.useState(null),f=$n(e,M=>u(M)),d=mE(n),h=D.useRef(!1),m=D.useRef(!0),{viewport:p,selectedItem:y,selectedItemText:x,focusSelectedItem:S}=o,C=D.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&p&&y&&x){const M=a.trigger.getBoundingClientRect(),I=l.getBoundingClientRect(),V=a.valueNode.getBoundingClientRect(),k=x.getBoundingClientRect();if(a.dir!=="rtl"){const ft=k.left-I.left,je=V.left-ft,It=M.left-je,Rt=M.width+It,cn=Math.max(Rt,I.width),ln=window.innerWidth-Wu,en=DP(je,[Wu,Math.max(Wu,ln-cn)]);s.style.minWidth=Rt+"px",s.style.left=en+"px"}else{const ft=I.right-k.right,je=window.innerWidth-V.right-ft,It=window.innerWidth-M.right-je,Rt=M.width+It,cn=Math.max(Rt,I.width),ln=window.innerWidth-Wu,en=DP(je,[Wu,Math.max(Wu,ln-cn)]);s.style.minWidth=Rt+"px",s.style.right=en+"px"}const L=d(),$=window.innerHeight-Wu*2,W=p.scrollHeight,G=window.getComputedStyle(l),oe=parseInt(G.borderTopWidth,10),U=parseInt(G.paddingTop,10),Y=parseInt(G.borderBottomWidth,10),J=parseInt(G.paddingBottom,10),ne=oe+U+W+J+Y,F=Math.min(y.offsetHeight*5,ne),ae=window.getComputedStyle(p),re=parseInt(ae.paddingTop,10),te=parseInt(ae.paddingBottom,10),ye=M.top+M.height/2-Wu,we=$-ye,Oe=y.offsetHeight/2,Te=y.offsetTop+Oe,Me=oe+U+Te,be=ne-Me;if(Me<=ye){const ft=L.length>0&&y===L[L.length-1].ref.current;s.style.bottom="0px";const je=l.clientHeight-p.offsetTop-p.offsetHeight,It=Math.max(we,Oe+(ft?te:0)+je+Y),Rt=Me+It;s.style.height=Rt+"px"}else{const ft=L.length>0&&y===L[0].ref.current;s.style.top="0px";const It=Math.max(ye,oe+p.offsetTop+(ft?re:0)+Oe)+be;s.style.height=It+"px",p.scrollTop=Me-ye+p.offsetTop}s.style.margin=`${Wu}px 0`,s.style.minHeight=F+"px",s.style.maxHeight=$+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[d,a.trigger,a.valueNode,s,l,p,y,x,a.dir,r]);ko(()=>C(),[C]);const[_,T]=D.useState();ko(()=>{l&&T(window.getComputedStyle(l).zIndex)},[l]);const O=D.useCallback(M=>{M&&m.current===!0&&(C(),S?.(),m.current=!1)},[C,S]);return w.jsx(L0t,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:h,onScrollButtonChange:O,children:w.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:w.jsx(Yt.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});eve.displayName=k0t;var A0t="SelectPopperPosition",MP=D.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Wu,...a}=t,o=vE(n);return w.jsx(x8,{...o,...a,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...a.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)"}})});MP.displayName=A0t;var[L0t,Kj]=M2(i1,{}),RP="SelectViewport",tve=D.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,a=Sp(RP,n),o=Kj(RP,n),s=$n(e,a.onViewportChange),c=D.useRef(0);return w.jsxs(w.Fragment,{children:[w.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}),w.jsx(pE.Slot,{scope:n,children:w.jsx(Yt.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Et(i.onScroll,l=>{const u=l.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:d}=o;if(d?.current&&f){const h=Math.abs(c.current-u.scrollTop);if(h>0){const m=window.innerHeight-Wu*2,p=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),x=Math.max(p,y);if(x<m){const S=x+h,C=Math.min(m,S),_=S-C;f.style.height=C+"px",f.style.bottom==="0px"&&(u.scrollTop=_>0?_:0,f.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});tve.displayName=RP;var nve="SelectGroup",[V0t,$0t]=M2(nve),j0t=D.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=No();return w.jsx(V0t,{scope:n,id:i,children:w.jsx(Yt.div,{role:"group","aria-labelledby":i,...r,ref:e})})});j0t.displayName=nve;var rve="SelectLabel",U0t=D.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=$0t(rve,n);return w.jsx(Yt.div,{id:i.id,...r,ref:e})});U0t.displayName=rve;var _T="SelectItem",[F0t,ive]=M2(_T),ave=D.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=t,s=bp(_T,n),c=Sp(_T,n),l=s.value===r,[u,f]=D.useState(a??""),[d,h]=D.useState(!1),m=$n(e,S=>c.itemRefCallback?.(S,r,i)),p=No(),y=D.useRef("touch"),x=()=>{i||(s.onValueChange(r),s.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 w.jsx(F0t,{scope:n,value:r,disabled:i,textId:p,isSelected:l,onItemTextChange:D.useCallback(S=>{f(C=>C||(S?.textContent??"").trim())},[]),children:w.jsx(pE.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:w.jsx(Yt.div,{role:"option","aria-labelledby":p,"data-highlighted":d?"":void 0,"aria-selected":l&&d,"data-state":l?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:Et(o.onFocus,()=>h(!0)),onBlur:Et(o.onBlur,()=>h(!1)),onClick:Et(o.onClick,()=>{y.current!=="mouse"&&x()}),onPointerUp:Et(o.onPointerUp,()=>{y.current==="mouse"&&x()}),onPointerDown:Et(o.onPointerDown,S=>{y.current=S.pointerType}),onPointerMove:Et(o.onPointerMove,S=>{y.current=S.pointerType,i?c.onItemLeave?.():y.current==="mouse"&&S.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Et(o.onPointerLeave,S=>{S.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Et(o.onKeyDown,S=>{c.searchRef?.current!==""&&S.key===" "||(T0t.includes(S.key)&&x(),S.key===" "&&S.preventDefault())})})})})});ave.displayName=_T;var y5="SelectItemText",ove=D.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...a}=t,o=bp(y5,n),s=Sp(y5,n),c=ive(y5,n),l=M0t(y5,n),[u,f]=D.useState(null),d=$n(e,x=>f(x),c.onItemTextChange,x=>s.itemTextRefCallback?.(x,c.value,c.disabled)),h=u?.textContent,m=D.useMemo(()=>w.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:y}=l;return ko(()=>(p(m),()=>y(m)),[p,y,m]),w.jsxs(w.Fragment,{children:[w.jsx(Yt.span,{id:c.textId,...a,ref:d}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?x1.createPortal(a.children,o.valueNode):null]})});ove.displayName=y5;var sve="SelectItemIndicator",cve=D.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return ive(sve,n).isSelected?w.jsx(Yt.span,{"aria-hidden":!0,...r,ref:e}):null});cve.displayName=sve;var IP="SelectScrollUpButton",lve=D.forwardRef((t,e)=>{const n=Sp(IP,t.__scopeSelect),r=Kj(IP,t.__scopeSelect),[i,a]=D.useState(!1),o=$n(e,r.onScrollButtonChange);return ko(()=>{if(n.viewport&&n.isPositioned){let s=function(){const l=c.scrollTop>0;a(l)};const c=n.viewport;return s(),c.addEventListener("scroll",s),()=>c.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),i?w.jsx(fve,{...t,ref:o,onAutoScroll:()=>{const{viewport:s,selectedItem:c}=n;s&&c&&(s.scrollTop=s.scrollTop-c.offsetHeight)}}):null});lve.displayName=IP;var NP="SelectScrollDownButton",uve=D.forwardRef((t,e)=>{const n=Sp(NP,t.__scopeSelect),r=Kj(NP,t.__scopeSelect),[i,a]=D.useState(!1),o=$n(e,r.onScrollButtonChange);return ko(()=>{if(n.viewport&&n.isPositioned){let s=function(){const l=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<l;a(u)};const c=n.viewport;return s(),c.addEventListener("scroll",s),()=>c.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),i?w.jsx(fve,{...t,ref:o,onAutoScroll:()=>{const{viewport:s,selectedItem:c}=n;s&&c&&(s.scrollTop=s.scrollTop+c.offsetHeight)}}):null});uve.displayName=NP;var fve=D.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,a=Sp("SelectScrollButton",n),o=D.useRef(null),s=mE(n),c=D.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return D.useEffect(()=>()=>c(),[c]),ko(()=>{s().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),w.jsx(Yt.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Et(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Et(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Et(i.onPointerLeave,()=>{c()})})}),B0t="SelectSeparator",z0t=D.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return w.jsx(Yt.div,{"aria-hidden":!0,...r,ref:e})});z0t.displayName=B0t;var PP="SelectArrow",G0t=D.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=vE(n),a=bp(PP,n),o=Sp(PP,n);return a.open&&o.position==="popper"?w.jsx(w8,{...i,...r,ref:e}):null});G0t.displayName=PP;var W0t="SelectBubbleInput",dve=D.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=D.useRef(null),a=$n(r,i),o=qj(e);return D.useEffect(()=>{const s=i.current;if(!s)return;const c=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&u){const f=new Event("change",{bubbles:!0});u.call(s,e),s.dispatchEvent(f)}},[o,e]),w.jsx(Yt.select,{...n,style:{...B1e,...n.style},ref:a,defaultValue:e})});dve.displayName=W0t;function hve(t){return t===""||t===void 0}function gve(t){const e=es(t),n=D.useRef(""),r=D.useRef(0),i=D.useCallback(o=>{const s=n.current+o;e(s),(function c(l){n.current=l,window.clearTimeout(r.current),l!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(s)},[e]),a=D.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return D.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function pve(t,e,n){const i=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let o=H0t(t,Math.max(a,0));i.length===1&&(o=o.filter(l=>l!==n));const c=o.find(l=>l.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function H0t(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var q0t=G1e,K0t=H1e,Y0t=K1e,X0t=Y1e,Z0t=X1e,Q0t=Z1e,J0t=tve,eht=ave,tht=ove,nht=cve,rht=lve,iht=uve;function F5({...t}){return w.jsx(q0t,{"data-slot":"select",...t})}function B5({...t}){return w.jsx(Y0t,{"data-slot":"select-value",...t})}function z5({className:t,size:e="default",children:n,...r}){return w.jsxs(K0t,{"data-slot":"select-trigger","data-size":e,className:rt("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground 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:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[n,w.jsx(X0t,{asChild:!0,children:w.jsx(iL,{className:"size-4 opacity-50"})})]})}function G5({className:t,children:e,position:n="popper",...r}){return w.jsx(Z0t,{children:w.jsxs(Q0t,{"data-slot":"select-content",className:rt("bg-popover text-popover-foreground 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 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",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,...r,children:[w.jsx(aht,{}),w.jsx(J0t,{className:rt("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),w.jsx(oht,{})]})})}function tf({className:t,children:e,...n}){return w.jsxs(eht,{"data-slot":"select-item",className:rt("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...n,children:[w.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:w.jsx(nht,{children:w.jsx($6,{className:"size-4"})})}),w.jsx(tht,{children:e})]})}function aht({className:t,...e}){return w.jsx(rht,{"data-slot":"select-scroll-up-button",className:rt("flex cursor-default items-center justify-center py-1",t),...e,children:w.jsx(v$e,{className:"size-4"})})}function oht({className:t,...e}){return w.jsx(iht,{"data-slot":"select-scroll-down-button",className:rt("flex cursor-default items-center justify-center py-1",t),...e,children:w.jsx(iL,{className:"size-4"})})}var sht="Separator",uJ="horizontal",cht=["horizontal","vertical"],mve=D.forwardRef((t,e)=>{const{decorative:n,orientation:r=uJ,...i}=t,a=lht(r)?r:uJ,s=n?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return w.jsx(Yt.div,{"data-orientation":a,...s,...i,ref:e})});mve.displayName=sht;function lht(t){return cht.includes(t)}var uht=mve;function kP({className:t,orientation:e="horizontal",decorative:n=!0,...r}){return w.jsx(uht,{"data-slot":"separator",decorative:n,orientation:e,className:rt("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}const fht={light:"",dark:".dark"},vve=D.createContext(null);function dht(){const t=D.useContext(vve);if(!t)throw new Error("useChart must be used within a <ChartContainer />");return t}function ZM({id:t,className:e,children:n,config:r,...i}){const a=D.useId(),o=`chart-${t||a.replace(/:/g,"")}`;return w.jsx(vve.Provider,{value:{config:r},children:w.jsxs("div",{"data-slot":"chart","data-chart":o,className:rt("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",e),...i,children:[w.jsx(hht,{id:o,config:r}),w.jsx(hC,{children:n})]})})}const hht=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?w.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(fht).map(([r,i])=>`
${i} [data-chart=${t}] {
${n.map(([a,o])=>{const s=o.theme?.[r]||o.color;return s?`  --color-${a}: ${s};`:null}).join(`
`)}
}
`).join(`
`)}}):null},QM=wst;function JM({active:t,payload:e,className:n,indicator:r="dot",hideLabel:i=!1,hideIndicator:a=!1,label:o,labelFormatter:s,labelClassName:c,formatter:l,color:u,nameKey:f,labelKey:d}){const{config:h}=dht(),m=D.useMemo(()=>{if(i||!e?.length)return null;const[y]=e,x=`${d||y?.dataKey||y?.name||"value"}`,S=fJ(h,y,x),C=!d&&typeof o=="string"?h[o]?.label||o:S?.label;return s?w.jsx("div",{className:rt("font-medium",c),children:s(C,e)}):C?w.jsx("div",{className:rt("font-medium",c),children:C}):null},[o,s,e,i,c,h,d]);if(!t||!e?.length)return null;const p=e.length===1&&r!=="dot";return w.jsxs("div",{className:rt("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",n),children:[p?null:m,w.jsx("div",{className:"grid gap-1.5",children:e.filter(y=>y.type!=="none").map((y,x)=>{const S=`${f||y.name||y.dataKey||"value"}`,C=fJ(h,y,S),_=u||y.payload?.fill||y.color;return w.jsx("div",{className:rt("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",r==="dot"&&"items-center"),children:l&&y?.value!==void 0&&y.name?l(y.value,y.name,y,x,y.payload):w.jsxs(w.Fragment,{children:[C?.icon?w.jsx(C.icon,{}):!a&&w.jsx("div",{className:rt("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":p&&r==="dashed"}),style:{"--color-bg":_,"--color-border":_}}),w.jsxs("div",{className:rt("flex flex-1 justify-between leading-none",p?"items-end":"items-center"),children:[w.jsxs("div",{className:"grid gap-1.5",children:[p?m:null,w.jsx("span",{className:"text-muted-foreground",children:C?.label||y.name})]}),y.value&&w.jsx("span",{className:"text-foreground font-mono font-medium tabular-nums",children:y.value.toLocaleString()})]})]})},y.dataKey)})})]})}const ght=W8;function fJ(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let i=n;return n in e&&typeof e[n]=="string"?i=e[n]:r&&n in r&&typeof r[n]=="string"&&(i=r[n]),i in t?t[i]:t[n]}const pht="_container_p4luk_1",mht="_overlay_p4luk_10",vht="_card_p4luk_28",yht="_cardFull_p4luk_47",xht="_cardContent_p4luk_51",wht="_overlayWrapper_p4luk_59",bht="_content_p4luk_85",Sht="_iconWrapper_p4luk_106",Cht="_iconPulse_p4luk_114",_ht="_icon_p4luk_106",Tht="_textContent_p4luk_153",Eht="_title_p4luk_158",Oht="_description_p4luk_166",Dht="_retryButton_p4luk_174",Mht="_retryIcon_p4luk_190",ds={container:pht,overlay:mht,card:vht,cardFull:yht,cardContent:xht,overlayWrapper:wht,content:bht,iconWrapper:Sht,iconPulse:Cht,icon:_ht,textContent:Tht,title:Eht,description:Oht,retryButton:Dht,retryIcon:Mht};function e3({title:t,description:e,onRetry:n,retryText:r,className:i,variant:a="default",overlay:o=!1,fullWidth:s=!1}){const{t:c}=Hn(""),l=t??c("error_state.title"),u=e??c("error_state.description"),f=r??c("error_state.retry"),d=w.jsxs("div",{className:ds.content,children:[w.jsxs("div",{className:ds.iconWrapper,children:[w.jsx("div",{className:ds.iconPulse}),w.jsx("div",{className:ds.iconPulse,"data-delay":"1"}),w.jsx(w$e,{className:ds.icon})]}),w.jsxs("div",{className:ds.textContent,children:[w.jsx("h3",{className:ds.title,children:l}),w.jsx("p",{className:ds.description,children:u})]}),n&&w.jsxs(bt,{onClick:n,variant:"outline",className:ds.retryButton,children:[w.jsx(Ije,{className:ds.retryIcon}),f]})]});if(a==="card"){const h=w.jsx(Oc,{className:`${ds.card} ${s?ds.cardFull:""} ${i||""}`,children:w.jsx(Yu,{className:ds.cardContent,children:d})});return o?w.jsx("div",{className:ds.overlayWrapper,children:h}):h}return w.jsx("div",{className:`${ds.container} ${o?ds.overlay:""} ${i||""}`,children:d})}function An({className:t,...e}){return w.jsx("div",{"data-slot":"skeleton",className:rt("bg-border animate-pulse rounded-md",t),...e})}function Kx({value:t,delay:e=0,duration:n=2,className:r="",decimalPlaces:i=0,prefix:a="",suffix:o="",locale:s="ru-RU"}){const c=D.useRef(null),l=hoe(0),u=sAe(c,{once:!0,margin:"-100px"}),f=$ke(l,d=>new Intl.NumberFormat(s,{minimumFractionDigits:i,maximumFractionDigits:i}).format(d));return D.useEffect(()=>{if(u){const d=setTimeout(()=>{iAe(l,t,{duration:n,ease:"easeOut"})},e*1e3);return()=>clearTimeout(d)}},[u,t,e,n,l]),w.jsxs("span",{ref:c,className:r,children:[a,w.jsx(ho.span,{children:f}),o]})}const Rht="_card_1x4gg_1",Iht="_cardFull_1x4gg_8",Nht="_header_1x4gg_12",Pht="_headerTitle_1x4gg_18",kht="_title_1x4gg_24",Aht="_description_1x4gg_30",Lht="_legend_1x4gg_36",Vht="_body_1x4gg_41",$ht="_chartArea_1x4gg_45",jht="_yAxis_1x4gg_52",Uht="_yLabel_1x4gg_62",Fht="_chart_1x4gg_45",Bht="_grid_1x4gg_75",zht="_gridLine_1x4gg_86",Ght="_bars_1x4gg_93",Wht="_bar_1x4gg_93",Hht="_lineSvg_1x4gg_119",qht="_linePath_1x4gg_127",Kht="_areaPath_1x4gg_148",Yht="_linePoints_1x4gg_166",Xht="_linePoint_1x4gg_166",Zht="_area_1x4gg_148",Qht="_xAxis_1x4gg_222",Jht="_xLabel_1x4gg_230",ki={card:Rht,cardFull:Iht,header:Nht,headerTitle:Pht,title:kht,description:Aht,legend:Lht,body:Vht,chartArea:$ht,yAxis:jht,yLabel:Uht,chart:Fht,grid:Bht,gridLine:zht,bars:Ght,bar:Wht,lineSvg:Hht,linePath:qht,areaPath:Kht,linePoints:Yht,linePoint:Xht,area:Zht,xAxis:Qht,xLabel:Jht};function eR({type:t="bar",showLegend:e=!1,fullWidth:n=!1}){return w.jsxs(Oc,{className:`${ki.card} ${n?ki.cardFull:""}`,children:[w.jsxs(Jf,{className:ki.header,children:[w.jsxs("div",{className:ki.headerTitle,children:[w.jsx(An,{className:ki.title}),w.jsx(An,{className:ki.description})]}),e&&w.jsx(An,{className:ki.legend})]}),w.jsxs(Yu,{className:ki.body,children:[w.jsxs("div",{className:ki.chartArea,children:[w.jsx("div",{className:ki.yAxis,children:[...Array(5)].map((r,i)=>w.jsx(An,{className:ki.yLabel},i))}),w.jsxs("div",{className:ki.chart,children:[t==="bar"?w.jsx("div",{className:ki.bars,children:[...Array(8)].map((r,i)=>w.jsx(An,{className:ki.bar,style:{height:`${Math.random()*60+30}%`,animationDelay:`${i*.1}s`}},i))}):t==="line"?w.jsxs(w.Fragment,{children:[w.jsxs("svg",{className:ki.lineSvg,viewBox:"0 0 100 100",preserveAspectRatio:"none",children:[w.jsx("defs",{children:w.jsxs("linearGradient",{id:"lineGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[w.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:"0.3"}),w.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:"0.05"})]})}),w.jsx("path",{className:ki.areaPath,d:"M 0 65 Q 12 45, 25 52 T 50 38 T 75 55 T 100 42 L 100 100 L 0 100 Z",fill:"url(#lineGradient)"}),w.jsx("path",{className:ki.linePath,d:"M 0 65 Q 12 45, 25 52 T 50 38 T 75 55 T 100 42",fill:"none",stroke:"var(--accent)",strokeWidth:"0.8"})]}),w.jsx("div",{className:ki.linePoints,children:[{left:"0%",bottom:"35%"},{left:"25%",bottom:"48%"},{left:"50%",bottom:"62%"},{left:"75%",bottom:"45%"},{left:"100%",bottom:"58%"}].map((r,i)=>w.jsx("div",{className:ki.linePoint,style:{left:r.left,bottom:r.bottom,animationDelay:`${i*.2}s`}},i))})]}):w.jsx(An,{className:ki.area}),w.jsx("div",{className:ki.grid,children:[...Array(5)].map((r,i)=>w.jsx("div",{className:ki.gridLine},i))})]})]}),w.jsx("div",{className:ki.xAxis,children:[...Array(8)].map((r,i)=>w.jsx(An,{className:ki.xLabel},i))})]})]})}class egt{static async getAnalytics(e){return(await ni.get("/analytics",{params:{dateFrom:e.dateFrom,dateTo:e.dateTo}})).data}}const tgt=t=>{const e=Sh({queryKey:["analytics",t],queryFn:()=>egt.getAnalytics(t),enabled:!!t.dateFrom&&!!t.dateTo,refetchInterval:6e4});return{analytics:e.data,isAnalyticsLoading:e.isLoading,isAnalyticsFetching:e.isFetching,isAnalyticsError:e.error,refetch:e.refetch}},yve=6048e5,ngt=864e5,xve=6e4,wve=36e5,dJ=Symbol.for("constructDateFrom");function Qa(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&dJ in t?t[dJ](e):t instanceof Date?new t.constructor(e):new Date(e)}function br(t,e){return Qa(e||t,t)}function Yj(t,e,n){const r=br(t,n?.in);return isNaN(e)?Qa(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function Xj(t,e,n){const r=br(t,n?.in);if(isNaN(e))return Qa(t,NaN);if(!e)return r;const i=r.getDate(),a=Qa(t,r.getTime());a.setMonth(r.getMonth()+e+1,0);const o=a.getDate();return i>=o?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}let rgt={};function t3(){return rgt}function np(t,e){const n=t3(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=br(t,e?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Bw(t,e){return np(t,{...e,weekStartsOn:1})}function bve(t,e){const n=br(t,e?.in),r=n.getFullYear(),i=Qa(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);const a=Bw(i),o=Qa(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);const s=Bw(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function hJ(t){const e=br(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Ef(t,...e){const n=Qa.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function F0(t,e){const n=br(t,e?.in);return n.setHours(0,0,0,0),n}function Zj(t,e,n){const[r,i]=Ef(n?.in,t,e),a=F0(r),o=F0(i),s=+a-hJ(a),c=+o-hJ(o);return Math.round((s-c)/ngt)}function igt(t,e){const n=bve(t,e),r=Qa(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Bw(r)}function agt(t,e,n){return Yj(t,e*7,n)}function ogt(t,e,n){return Xj(t,e*12,n)}function sgt(t,e){let n,r=e?.in;return t.forEach(i=>{!r&&typeof i=="object"&&(r=Qa.bind(null,i));const a=br(i,r);(!n||n<a||isNaN(+a))&&(n=a)}),Qa(r,n||NaN)}function cgt(t,e){let n,r=e?.in;return t.forEach(i=>{!r&&typeof i=="object"&&(r=Qa.bind(null,i));const a=br(i,r);(!n||n>a||isNaN(+a))&&(n=a)}),Qa(r,n||NaN)}function W5(t,e){const n=+br(t)-+br(e);return n<0?-1:n>0?1:n}function lgt(t,e,n){const[r,i]=Ef(n?.in,t,e);return+F0(r)==+F0(i)}function Sve(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function ugt(t){return!(!Sve(t)&&typeof t!="number"||isNaN(+br(t)))}function Cve(t,e,n){const[r,i]=Ef(n?.in,t,e),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function fgt(t,e,n){const[r,i]=Ef(n?.in,t,e);return r.getFullYear()-i.getFullYear()}function _ve(t,e,n){const[r,i]=Ef(n?.in,t,e),a=gJ(r,i),o=Math.abs(Zj(r,i));r.setDate(r.getDate()-a*o);const s=+(gJ(r,i)===-a),c=a*(o-s);return c===0?0:c}function gJ(t,e){const n=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return n<0?-1:n>0?1:n}function dgt(t){return e=>{const r=(t?Math[t]:Math.trunc)(e);return r===0?0:r}}function rm(t,e){const n=br(t,e?.in);return n.setHours(23,59,59,999),n}function Tve(t,e){const n=br(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function hgt(t,e){const n=br(t,e?.in);return+rm(n,e)==+Tve(n,e)}function ggt(t,e,n){const[r,i,a]=Ef(n?.in,t,t,e),o=W5(i,a),s=Math.abs(Cve(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=W5(i,a)===-o;hgt(r)&&s===1&&W5(r,a)===1&&(c=!1);const l=o*(s-+c);return l===0?0:l}function pgt(t,e,n){const r=_ve(t,e,n)/7;return dgt(n?.roundingMethod)(r)}function mgt(t,e,n){const[r,i]=Ef(n?.in,t,e),a=W5(r,i),o=Math.abs(fgt(r,i));r.setFullYear(1584),i.setFullYear(1584);const s=W5(r,i)===-a,c=a*(o-+s);return c===0?0:c}function vgt(t,e){const[n,r]=Ef(t,e.start,e.end);return{start:n,end:r}}function ygt(t,e){const{start:n,end:r}=vgt(e?.in,t);let i=+n>+r;const a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=1;const c=[];for(;+o<=a;)c.push(Qa(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function AP(t,e){const n=br(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function xgt(t,e){const n=br(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function Eve(t,e){const n=br(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Ove(t,e){const n=t3(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=br(t,e?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function wgt(t,e){return Ove(t,{...e,weekStartsOn:1})}const bgt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Sgt=(t,e,n)=>{let r;const i=bgt[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Q0(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const Cgt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},_gt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Tgt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Egt={date:Q0({formats:Cgt,defaultWidth:"full"}),time:Q0({formats:_gt,defaultWidth:"full"}),dateTime:Q0({formats:Tgt,defaultWidth:"full"})},Ogt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Dgt=(t,e,n,r)=>Ogt[t];function Ks(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let i;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,s=n?.width?String(n.width):o;i=t.formattingValues[s]||t.formattingValues[o]}else{const o=t.defaultWidth,s=n?.width?String(n.width):t.defaultWidth;i=t.values[s]||t.values[o]}const a=t.argumentCallback?t.argumentCallback(e):e;return i[a]}}const Mgt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Rgt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Igt={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Ngt={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Pgt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},kgt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Agt=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Lgt={ordinalNumber:Agt,era:Ks({values:Mgt,defaultWidth:"wide"}),quarter:Ks({values:Rgt,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ks({values:Igt,defaultWidth:"wide"}),day:Ks({values:Ngt,defaultWidth:"wide"}),dayPeriod:Ks({values:Pgt,defaultWidth:"wide",formattingValues:kgt,defaultFormattingWidth:"wide"})};function Ys(t){return(e,n={})=>{const r=n.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],a=e.match(i);if(!a)return null;const o=a[0],s=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(s)?$gt(s,f=>f.test(o)):Vgt(s,f=>f.test(o));let l;l=t.valueCallback?t.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;const u=e.slice(o.length);return{value:l,rest:u}}}function Vgt(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function $gt(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function Qj(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const i=r[0],a=e.match(t.parsePattern);if(!a)return null;let o=t.valueCallback?t.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;const s=e.slice(i.length);return{value:o,rest:s}}}const jgt=/^(\d+)(th|st|nd|rd)?/i,Ugt=/\d+/i,Fgt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Bgt={any:[/^b/i,/^(a|c)/i]},zgt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ggt={any:[/1/i,/2/i,/3/i,/4/i]},Wgt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Hgt={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},qgt={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Kgt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Ygt={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Xgt={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Zgt={ordinalNumber:Qj({matchPattern:jgt,parsePattern:Ugt,valueCallback:t=>parseInt(t,10)}),era:Ys({matchPatterns:Fgt,defaultMatchWidth:"wide",parsePatterns:Bgt,defaultParseWidth:"any"}),quarter:Ys({matchPatterns:zgt,defaultMatchWidth:"wide",parsePatterns:Ggt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Ys({matchPatterns:Wgt,defaultMatchWidth:"wide",parsePatterns:Hgt,defaultParseWidth:"any"}),day:Ys({matchPatterns:qgt,defaultMatchWidth:"wide",parsePatterns:Kgt,defaultParseWidth:"any"}),dayPeriod:Ys({matchPatterns:Ygt,defaultMatchWidth:"any",parsePatterns:Xgt,defaultParseWidth:"any"})},zw={code:"en-US",formatDistance:Sgt,formatLong:Egt,formatRelative:Dgt,localize:Lgt,match:Zgt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Qgt(t,e){const n=br(t,e?.in);return Zj(n,Eve(n))+1}function Dve(t,e){const n=br(t,e?.in),r=+Bw(n)-+igt(n);return Math.round(r/yve)+1}function Mve(t,e){const n=br(t,e?.in),r=n.getFullYear(),i=t3(),a=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Qa(e?.in||t,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);const s=np(o,e),c=Qa(e?.in||t,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);const l=np(c,e);return+n>=+s?r+1:+n>=+l?r:r-1}function Jgt(t,e){const n=t3(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Mve(t,e),a=Qa(e?.in||t,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),np(a,e)}function Rve(t,e){const n=br(t,e?.in),r=+np(n,e)-+Jgt(n,e);return Math.round(r/yve)+1}function Yr(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const ig={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Yr(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Yr(n+1,2)},d(t,e){return Yr(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Yr(t.getHours()%12||12,e.length)},H(t,e){return Yr(t.getHours(),e.length)},m(t,e){return Yr(t.getMinutes(),e.length)},s(t,e){return Yr(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return Yr(i,e.length)}},pv={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},pJ={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return ig.y(t,e)},Y:function(t,e,n,r){const i=Mve(t,r),a=i>0?i:1-i;if(e==="YY"){const o=a%100;return Yr(o,2)}return e==="Yo"?n.ordinalNumber(a,{unit:"year"}):Yr(a,e.length)},R:function(t,e){const n=bve(t);return Yr(n,e.length)},u:function(t,e){const n=t.getFullYear();return Yr(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Yr(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Yr(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return ig.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Yr(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const i=Rve(t,r);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):Yr(i,e.length)},I:function(t,e,n){const r=Dve(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Yr(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):ig.d(t,e)},D:function(t,e,n){const r=Qgt(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Yr(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const i=t.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(a);case"ee":return Yr(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const i=t.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(a);case"cc":return Yr(a,e.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return Yr(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let i;switch(r===12?i=pv.noon:r===0?i=pv.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let i;switch(r>=17?i=pv.evening:r>=12?i=pv.afternoon:r>=4?i=pv.morning:i=pv.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return ig.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):ig.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Yr(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Yr(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):ig.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):ig.s(t,e)},S:function(t,e){return ig.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return vJ(r);case"XXXX":case"XX":return im(r);case"XXXXX":case"XXX":default:return im(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return vJ(r);case"xxxx":case"xx":return im(r);case"xxxxx":case"xxx":default:return im(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+mJ(r,":");case"OOOO":default:return"GMT"+im(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+mJ(r,":");case"zzzz":default:return"GMT"+im(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Yr(r,e.length)},T:function(t,e,n){return Yr(+t,e.length)}};function mJ(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+e+Yr(a,2)}function vJ(t,e){return t%60===0?(t>0?"-":"+")+Yr(Math.abs(t)/60,2):im(t,e)}function im(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Yr(Math.trunc(r/60),2),a=Yr(r%60,2);return n+i+e+a}const yJ=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Ive=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},ept=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return yJ(t,e);let a;switch(r){case"P":a=e.dateTime({width:"short"});break;case"PP":a=e.dateTime({width:"medium"});break;case"PPP":a=e.dateTime({width:"long"});break;case"PPPP":default:a=e.dateTime({width:"full"});break}return a.replace("{{date}}",yJ(r,e)).replace("{{time}}",Ive(i,e))},tpt={p:Ive,P:ept},npt=/^D+$/,rpt=/^Y+$/,ipt=["D","DD","YY","YYYY"];function apt(t){return npt.test(t)}function opt(t){return rpt.test(t)}function spt(t,e,n){const r=cpt(t,e,n);if(console.warn(r),ipt.includes(t))throw new RangeError(r)}function cpt(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const lpt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,upt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,fpt=/^'([^]*?)'?$/,dpt=/''/g,hpt=/[a-zA-Z]/;function Ji(t,e,n){const r=t3(),i=n?.locale??r.locale??zw,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=br(t,n?.in);if(!ugt(s))throw new RangeError("Invalid time value");let c=e.match(upt).map(u=>{const f=u[0];if(f==="p"||f==="P"){const d=tpt[f];return d(u,i.formatLong)}return u}).join("").match(lpt).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const f=u[0];if(f==="'")return{isToken:!1,value:gpt(u)};if(pJ[f])return{isToken:!0,value:u};if(f.match(hpt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+f+"`");return{isToken:!1,value:u}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(u=>{if(!u.isToken)return u.value;const f=u.value;(!n?.useAdditionalWeekYearTokens&&opt(f)||!n?.useAdditionalDayOfYearTokens&&apt(f))&&spt(f,e,String(t));const d=pJ[f[0]];return d(s,f,i.localize,l)}).join("")}function gpt(t){const e=t.match(fpt);return e?e[1].replace(dpt,"'"):t}function ppt(t,e){const n=br(t,e?.in),r=n.getFullYear(),i=n.getMonth(),a=Qa(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function mpt(t,e){return br(t,e?.in).getMonth()}function vpt(t,e){return br(t,e?.in).getFullYear()}function ypt(t,e){return+br(t)>+br(e)}function xpt(t,e){return+br(t)<+br(e)}function xJ(t,e,n){const[r,i]=Ef(n?.in,t,e);return+np(r,n)==+np(i,n)}function wpt(t,e,n){const[r,i]=Ef(n?.in,t,e);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function bpt(t,e,n){const[r,i]=Ef(n?.in,t,e);return r.getFullYear()===i.getFullYear()}function x5(t,e,n){return Yj(t,-e,n)}function wJ(t,e){const n=()=>Qa(e?.in,NaN),i=Tpt(t);let a;if(i.date){const l=Ept(i.date,2);a=Opt(l.restDateString,l.year)}if(!a||isNaN(+a))return n();const o=+a;let s=0,c;if(i.time&&(s=Dpt(i.time),isNaN(s)))return n();if(i.timezone){if(c=Mpt(i.timezone),isNaN(c))return n()}else{const l=new Date(o+s),u=br(0,e?.in);return u.setFullYear(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()),u.setHours(l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()),u}return br(o+s+c,e?.in)}const gS={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Spt=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Cpt=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,_pt=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Tpt(t){const e={},n=t.split(gS.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],gS.timeZoneDelimiter.test(e.date)&&(e.date=t.split(gS.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const i=gS.timezone.exec(r);i?(e.time=r.replace(i[1],""),e.timezone=i[1]):e.time=r}return e}function Ept(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:t.slice((r[1]||r[2]).length)}}function Opt(t,e){if(e===null)return new Date(NaN);const n=t.match(Spt);if(!n)return new Date(NaN);const r=!!n[4],i=Yx(n[1]),a=Yx(n[2])-1,o=Yx(n[3]),s=Yx(n[4]),c=Yx(n[5])-1;if(r)return kpt(e,s,c)?Rpt(e,s,c):new Date(NaN);{const l=new Date(0);return!Npt(e,a,o)||!Ppt(e,i)?new Date(NaN):(l.setUTCFullYear(e,a,Math.max(i,o)),l)}}function Yx(t){return t?parseInt(t):1}function Dpt(t){const e=t.match(Cpt);if(!e)return NaN;const n=tR(e[1]),r=tR(e[2]),i=tR(e[3]);return Apt(n,r,i)?n*wve+r*xve+i*1e3:NaN}function tR(t){return t&&parseFloat(t.replace(",","."))||0}function Mpt(t){if(t==="Z")return 0;const e=t.match(_pt);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return Lpt(r,i)?n*(r*wve+i*xve):NaN}function Rpt(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const i=r.getUTCDay()||7,a=(e-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}const Ipt=[31,null,31,30,31,30,31,31,30,31,30,31];function Nve(t){return t%400===0||t%4===0&&t%100!==0}function Npt(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(Ipt[e]||(Nve(t)?29:28))}function Ppt(t,e){return e>=1&&e<=(Nve(t)?366:365)}function kpt(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function Apt(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function Lpt(t,e){return e>=0&&e<=59}function Vpt(t,e,n){const r=br(t,n?.in),i=r.getFullYear(),a=r.getDate(),o=Qa(t,0);o.setFullYear(i,e,15),o.setHours(0,0,0,0);const s=ppt(o);return r.setMonth(e,Math.min(a,s)),r}function $pt(t,e,n){const r=br(t,n?.in);return isNaN(+r)?Qa(t,NaN):(r.setFullYear(e),r)}function bJ(t,e,n){return Xj(t,-e,n)}const jpt=t=>{const e=new Date;let n,r;switch(t){case"1w":n=F0(x5(e,6)),r=rm(e);break;case"1m":n=F0(x5(e,29)),r=rm(e);break;case"3m":n=F0(x5(e,89)),r=rm(e);break;case"6m":n=AP(bJ(e,5)),r=rm(e);break;case"1y":n=AP(bJ(e,11)),r=rm(e);break;default:n=F0(x5(e,29)),r=rm(e)}return{dateFrom:Ji(n,"yyyy-MM-dd"),dateTo:Ji(r,"yyyy-MM-dd")}};function Xx(t,e){if(t.one!==void 0&&e===1)return t.one;const n=e%10,r=e%100;return n===1&&r!==11?t.singularNominative.replace("{{count}}",String(e)):n>=2&&n<=4&&(r<10||r>20)?t.singularGenitive.replace("{{count}}",String(e)):t.pluralGenitive.replace("{{count}}",String(e))}function Us(t){return(e,n)=>n?.addSuffix?n.comparison&&n.comparison>0?t.future?Xx(t.future,e):"через "+Xx(t.regular,e):t.past?Xx(t.past,e):Xx(t.regular,e)+" назад":Xx(t.regular,e)}const Upt={lessThanXSeconds:Us({regular:{one:"меньше секунды",singularNominative:"меньше {{count}} секунды",singularGenitive:"меньше {{count}} секунд",pluralGenitive:"меньше {{count}} секунд"},future:{one:"меньше, чем через секунду",singularNominative:"меньше, чем через {{count}} секунду",singularGenitive:"меньше, чем через {{count}} секунды",pluralGenitive:"меньше, чем через {{count}} секунд"}}),xSeconds:Us({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунды",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду назад",singularGenitive:"{{count}} секунды назад",pluralGenitive:"{{count}} секунд назад"},future:{singularNominative:"через {{count}} секунду",singularGenitive:"через {{count}} секунды",pluralGenitive:"через {{count}} секунд"}}),halfAMinute:(t,e)=>e?.addSuffix?e.comparison&&e.comparison>0?"через полминуты":"полминуты назад":"полминуты",lessThanXMinutes:Us({regular:{one:"меньше минуты",singularNominative:"меньше {{count}} минуты",singularGenitive:"меньше {{count}} минут",pluralGenitive:"меньше {{count}} минут"},future:{one:"меньше, чем через минуту",singularNominative:"меньше, чем через {{count}} минуту",singularGenitive:"меньше, чем через {{count}} минуты",pluralGenitive:"меньше, чем через {{count}} минут"}}),xMinutes:Us({regular:{singularNominative:"{{count}} минута",singularGenitive:"{{count}} минуты",pluralGenitive:"{{count}} минут"},past:{singularNominative:"{{count}} минуту назад",singularGenitive:"{{count}} минуты назад",pluralGenitive:"{{count}} минут назад"},future:{singularNominative:"через {{count}} минуту",singularGenitive:"через {{count}} минуты",pluralGenitive:"через {{count}} минут"}}),aboutXHours:Us({regular:{singularNominative:"около {{count}} часа",singularGenitive:"около {{count}} часов",pluralGenitive:"около {{count}} часов"},future:{singularNominative:"приблизительно через {{count}} час",singularGenitive:"приблизительно через {{count}} часа",pluralGenitive:"приблизительно через {{count}} часов"}}),xHours:Us({regular:{singularNominative:"{{count}} час",singularGenitive:"{{count}} часа",pluralGenitive:"{{count}} часов"}}),xDays:Us({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} дня",pluralGenitive:"{{count}} дней"}}),aboutXWeeks:Us({regular:{singularNominative:"около {{count}} недели",singularGenitive:"около {{count}} недель",pluralGenitive:"около {{count}} недель"},future:{singularNominative:"приблизительно через {{count}} неделю",singularGenitive:"приблизительно через {{count}} недели",pluralGenitive:"приблизительно через {{count}} недель"}}),xWeeks:Us({regular:{singularNominative:"{{count}} неделя",singularGenitive:"{{count}} недели",pluralGenitive:"{{count}} недель"}}),aboutXMonths:Us({regular:{singularNominative:"около {{count}} месяца",singularGenitive:"около {{count}} месяцев",pluralGenitive:"около {{count}} месяцев"},future:{singularNominative:"приблизительно через {{count}} месяц",singularGenitive:"приблизительно через {{count}} месяца",pluralGenitive:"приблизительно через {{count}} месяцев"}}),xMonths:Us({regular:{singularNominative:"{{count}} месяц",singularGenitive:"{{count}} месяца",pluralGenitive:"{{count}} месяцев"}}),aboutXYears:Us({regular:{singularNominative:"около {{count}} года",singularGenitive:"около {{count}} лет",pluralGenitive:"около {{count}} лет"},future:{singularNominative:"приблизительно через {{count}} год",singularGenitive:"приблизительно через {{count}} года",pluralGenitive:"приблизительно через {{count}} лет"}}),xYears:Us({regular:{singularNominative:"{{count}} год",singularGenitive:"{{count}} года",pluralGenitive:"{{count}} лет"}}),overXYears:Us({regular:{singularNominative:"больше {{count}} года",singularGenitive:"больше {{count}} лет",pluralGenitive:"больше {{count}} лет"},future:{singularNominative:"больше, чем через {{count}} год",singularGenitive:"больше, чем через {{count}} года",pluralGenitive:"больше, чем через {{count}} лет"}}),almostXYears:Us({regular:{singularNominative:"почти {{count}} год",singularGenitive:"почти {{count}} года",pluralGenitive:"почти {{count}} лет"},future:{singularNominative:"почти через {{count}} год",singularGenitive:"почти через {{count}} года",pluralGenitive:"почти через {{count}} лет"}})},Fpt=(t,e,n)=>Upt[t](e,n),Bpt={full:"EEEE, d MMMM y 'г.'",long:"d MMMM y 'г.'",medium:"d MMM y 'г.'",short:"dd.MM.y"},zpt={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},Gpt={any:"{{date}}, {{time}}"},Wpt={date:Q0({formats:Bpt,defaultWidth:"full"}),time:Q0({formats:zpt,defaultWidth:"full"}),dateTime:Q0({formats:Gpt,defaultWidth:"any"})},Jj=["воскресенье","понедельник","вторник","среду","четверг","пятницу","субботу"];function Hpt(t){const e=Jj[t];switch(t){case 0:return"'в прошлое "+e+" в' p";case 1:case 2:case 4:return"'в прошлый "+e+" в' p";case 3:case 5:case 6:return"'в прошлую "+e+" в' p"}}function SJ(t){const e=Jj[t];return t===2?"'во "+e+" в' p":"'в "+e+" в' p"}function qpt(t){const e=Jj[t];switch(t){case 0:return"'в следующее "+e+" в' p";case 1:case 2:case 4:return"'в следующий "+e+" в' p";case 3:case 5:case 6:return"'в следующую "+e+" в' p"}}const Kpt={lastWeek:(t,e,n)=>{const r=t.getDay();return xJ(t,e,n)?SJ(r):Hpt(r)},yesterday:"'вчера в' p",today:"'сегодня в' p",tomorrow:"'завтра в' p",nextWeek:(t,e,n)=>{const r=t.getDay();return xJ(t,e,n)?SJ(r):qpt(r)},other:"P"},Ypt=(t,e,n,r)=>{const i=Kpt[t];return typeof i=="function"?i(e,n,r):i},Xpt={narrow:["до н.э.","н.э."],abbreviated:["до н. э.","н. э."],wide:["до нашей эры","нашей эры"]},Zpt={narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},Qpt={narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","март","апр.","май","июнь","июль","авг.","сент.","окт.","нояб.","дек."],wide:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"]},Jpt={narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],wide:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"]},emt={narrow:["В","П","В","С","Ч","П","С"],short:["вс","пн","вт","ср","чт","пт","сб"],abbreviated:["вск","пнд","втр","срд","чтв","птн","суб"],wide:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"]},tmt={narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утро",afternoon:"день",evening:"вечер",night:"ночь"}},nmt={narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утра",afternoon:"дня",evening:"вечера",night:"ночи"}},rmt=(t,e)=>{const n=Number(t),r=e?.unit;let i;return r==="date"?i="-е":r==="week"||r==="minute"||r==="second"?i="-я":i="-й",n+i},imt={ordinalNumber:rmt,era:Ks({values:Xpt,defaultWidth:"wide"}),quarter:Ks({values:Zpt,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ks({values:Qpt,defaultWidth:"wide",formattingValues:Jpt,defaultFormattingWidth:"wide"}),day:Ks({values:emt,defaultWidth:"wide"}),dayPeriod:Ks({values:tmt,defaultWidth:"any",formattingValues:nmt,defaultFormattingWidth:"wide"})},amt=/^(\d+)(-?(е|я|й|ое|ье|ая|ья|ый|ой|ий|ый))?/i,omt=/\d+/i,smt={narrow:/^((до )?н\.?\s?э\.?)/i,abbreviated:/^((до )?н\.?\s?э\.?)/i,wide:/^(до нашей эры|нашей эры|наша эра)/i},cmt={any:[/^д/i,/^н/i]},lmt={narrow:/^[1234]/i,abbreviated:/^[1234](-?[ыои]?й?)? кв.?/i,wide:/^[1234](-?[ыои]?й?)? квартал/i},umt={any:[/1/i,/2/i,/3/i,/4/i]},fmt={narrow:/^[яфмаисонд]/i,abbreviated:/^(янв|фев|март?|апр|ма[йя]|июн[ья]?|июл[ья]?|авг|сент?|окт|нояб?|дек)\.?/i,wide:/^(январ[ья]|феврал[ья]|марта?|апрел[ья]|ма[йя]|июн[ья]|июл[ья]|августа?|сентябр[ья]|октябр[ья]|октябр[ья]|ноябр[ья]|декабр[ья])/i},dmt={narrow:[/^я/i,/^ф/i,/^м/i,/^а/i,/^м/i,/^и/i,/^и/i,/^а/i,/^с/i,/^о/i,/^н/i,/^я/i],any:[/^я/i,/^ф/i,/^мар/i,/^ап/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^ав/i,/^с/i,/^о/i,/^н/i,/^д/i]},hmt={narrow:/^[впсч]/i,short:/^(вс|во|пн|по|вт|ср|чт|че|пт|пя|сб|су)\.?/i,abbreviated:/^(вск|вос|пнд|пон|втр|вто|срд|сре|чтв|чет|птн|пят|суб).?/i,wide:/^(воскресень[ея]|понедельника?|вторника?|сред[аы]|четверга?|пятниц[аы]|суббот[аы])/i},gmt={narrow:[/^в/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^в[ос]/i,/^п[он]/i,/^в/i,/^ср/i,/^ч/i,/^п[ят]/i,/^с[уб]/i]},pmt={narrow:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,abbreviated:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,wide:/^([дп]п|полночь|полдень|утр[оа]|день|дня|вечера?|ноч[ьи])/i},mmt={any:{am:/^дп/i,pm:/^пп/i,midnight:/^полн/i,noon:/^полд/i,morning:/^у/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},vmt={ordinalNumber:Qj({matchPattern:amt,parsePattern:omt,valueCallback:t=>parseInt(t,10)}),era:Ys({matchPatterns:smt,defaultMatchWidth:"wide",parsePatterns:cmt,defaultParseWidth:"any"}),quarter:Ys({matchPatterns:lmt,defaultMatchWidth:"wide",parsePatterns:umt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Ys({matchPatterns:fmt,defaultMatchWidth:"wide",parsePatterns:dmt,defaultParseWidth:"any"}),day:Ys({matchPatterns:hmt,defaultMatchWidth:"wide",parsePatterns:gmt,defaultParseWidth:"any"}),dayPeriod:Ys({matchPatterns:pmt,defaultMatchWidth:"wide",parsePatterns:mmt,defaultParseWidth:"any"})},eU={code:"ru",formatDistance:Fpt,formatLong:Wpt,formatRelative:Ypt,localize:imt,match:vmt,options:{weekStartsOn:1,firstWeekContainsDate:1}},ymt={lessThanXSeconds:{one:"dưới 1 giây",other:"dưới {{count}} giây"},xSeconds:{one:"1 giây",other:"{{count}} giây"},halfAMinute:"nửa phút",lessThanXMinutes:{one:"dưới 1 phút",other:"dưới {{count}} phút"},xMinutes:{one:"1 phút",other:"{{count}} phút"},aboutXHours:{one:"khoảng 1 giờ",other:"khoảng {{count}} giờ"},xHours:{one:"1 giờ",other:"{{count}} giờ"},xDays:{one:"1 ngày",other:"{{count}} ngày"},aboutXWeeks:{one:"khoảng 1 tuần",other:"khoảng {{count}} tuần"},xWeeks:{one:"1 tuần",other:"{{count}} tuần"},aboutXMonths:{one:"khoảng 1 tháng",other:"khoảng {{count}} tháng"},xMonths:{one:"1 tháng",other:"{{count}} tháng"},aboutXYears:{one:"khoảng 1 năm",other:"khoảng {{count}} năm"},xYears:{one:"1 năm",other:"{{count}} năm"},overXYears:{one:"hơn 1 năm",other:"hơn {{count}} năm"},almostXYears:{one:"gần 1 năm",other:"gần {{count}} năm"}},xmt=(t,e,n)=>{let r;const i=ymt[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+" nữa":r+" trước":r},wmt={full:"EEEE, 'ngày' d MMMM 'năm' y",long:"'ngày' d MMMM 'năm' y",medium:"d MMM 'năm' y",short:"dd/MM/y"},bmt={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Smt={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Cmt={date:Q0({formats:wmt,defaultWidth:"full"}),time:Q0({formats:bmt,defaultWidth:"full"}),dateTime:Q0({formats:Smt,defaultWidth:"full"})},_mt={lastWeek:"eeee 'tuần trước vào lúc' p",yesterday:"'hôm qua vào lúc' p",today:"'hôm nay vào lúc' p",tomorrow:"'ngày mai vào lúc' p",nextWeek:"eeee 'tới vào lúc' p",other:"P"},Tmt=(t,e,n,r)=>_mt[t],Emt={narrow:["TCN","SCN"],abbreviated:["trước CN","sau CN"],wide:["trước Công Nguyên","sau Công Nguyên"]},Omt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["Quý 1","Quý 2","Quý 3","Quý 4"]},Dmt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["quý I","quý II","quý III","quý IV"]},Mmt={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["Thg 1","Thg 2","Thg 3","Thg 4","Thg 5","Thg 6","Thg 7","Thg 8","Thg 9","Thg 10","Thg 11","Thg 12"],wide:["Tháng Một","Tháng Hai","Tháng Ba","Tháng Tư","Tháng Năm","Tháng Sáu","Tháng Bảy","Tháng Tám","Tháng Chín","Tháng Mười","Tháng Mười Một","Tháng Mười Hai"]},Rmt={narrow:["01","02","03","04","05","06","07","08","09","10","11","12"],abbreviated:["thg 1","thg 2","thg 3","thg 4","thg 5","thg 6","thg 7","thg 8","thg 9","thg 10","thg 11","thg 12"],wide:["tháng 01","tháng 02","tháng 03","tháng 04","tháng 05","tháng 06","tháng 07","tháng 08","tháng 09","tháng 10","tháng 11","tháng 12"]},Imt={narrow:["CN","T2","T3","T4","T5","T6","T7"],short:["CN","Th 2","Th 3","Th 4","Th 5","Th 6","Th 7"],abbreviated:["CN","Thứ 2","Thứ 3","Thứ 4","Thứ 5","Thứ 6","Thứ 7"],wide:["Chủ Nhật","Thứ Hai","Thứ Ba","Thứ Tư","Thứ Năm","Thứ Sáu","Thứ Bảy"]},Nmt={narrow:{am:"am",pm:"pm",midnight:"nửa đêm",noon:"tr",morning:"sg",afternoon:"ch",evening:"tối",night:"đêm"},abbreviated:{am:"AM",pm:"PM",midnight:"nửa đêm",noon:"trưa",morning:"sáng",afternoon:"chiều",evening:"tối",night:"đêm"},wide:{am:"SA",pm:"CH",midnight:"nửa đêm",noon:"trưa",morning:"sáng",afternoon:"chiều",evening:"tối",night:"đêm"}},Pmt={narrow:{am:"am",pm:"pm",midnight:"nửa đêm",noon:"tr",morning:"sg",afternoon:"ch",evening:"tối",night:"đêm"},abbreviated:{am:"AM",pm:"PM",midnight:"nửa đêm",noon:"trưa",morning:"sáng",afternoon:"chiều",evening:"tối",night:"đêm"},wide:{am:"SA",pm:"CH",midnight:"nửa đêm",noon:"giữa trưa",morning:"vào buổi sáng",afternoon:"vào buổi chiều",evening:"vào buổi tối",night:"vào ban đêm"}},kmt=(t,e)=>{const n=Number(t),r=e?.unit;if(r==="quarter")switch(n){case 1:return"I";case 2:return"II";case 3:return"III";case 4:return"IV"}else if(r==="day")switch(n){case 1:return"thứ 2";case 2:return"thứ 3";case 3:return"thứ 4";case 4:return"thứ 5";case 5:return"thứ 6";case 6:return"thứ 7";case 7:return"chủ nhật"}else{if(r==="week")return n===1?"thứ nhất":"thứ "+n;if(r==="dayOfYear")return n===1?"đầu tiên":"thứ "+n}return String(n)},Amt={ordinalNumber:kmt,era:Ks({values:Emt,defaultWidth:"wide"}),quarter:Ks({values:Omt,defaultWidth:"wide",formattingValues:Dmt,defaultFormattingWidth:"wide",argumentCallback:t=>t-1}),month:Ks({values:Mmt,defaultWidth:"wide",formattingValues:Rmt,defaultFormattingWidth:"wide"}),day:Ks({values:Imt,defaultWidth:"wide"}),dayPeriod:Ks({values:Nmt,defaultWidth:"wide",formattingValues:Pmt,defaultFormattingWidth:"wide"})},Lmt=/^(\d+)/i,Vmt=/\d+/i,$mt={narrow:/^(tcn|scn)/i,abbreviated:/^(trước CN|sau CN)/i,wide:/^(trước Công Nguyên|sau Công Nguyên)/i},jmt={any:[/^t/i,/^s/i]},Umt={narrow:/^([1234]|i{1,3}v?)/i,abbreviated:/^q([1234]|i{1,3}v?)/i,wide:/^quý ([1234]|i{1,3}v?)/i},Fmt={any:[/(1|i)$/i,/(2|ii)$/i,/(3|iii)$/i,/(4|iv)$/i]},Bmt={narrow:/^(0?[2-9]|10|11|12|0?1)/i,abbreviated:/^thg[ _]?(0?[1-9](?!\d)|10|11|12)/i,wide:/^tháng ?(Một|Hai|Ba|Tư|Năm|Sáu|Bảy|Tám|Chín|Mười|Mười ?Một|Mười ?Hai|0?[1-9](?!\d)|10|11|12)/i},zmt={narrow:[/0?1$/i,/0?2/i,/3/,/4/,/5/,/6/,/7/,/8/,/9/,/10/,/11/,/12/],abbreviated:[/^thg[ _]?0?1(?!\d)/i,/^thg[ _]?0?2/i,/^thg[ _]?0?3/i,/^thg[ _]?0?4/i,/^thg[ _]?0?5/i,/^thg[ _]?0?6/i,/^thg[ _]?0?7/i,/^thg[ _]?0?8/i,/^thg[ _]?0?9/i,/^thg[ _]?10/i,/^thg[ _]?11/i,/^thg[ _]?12/i],wide:[/^tháng ?(Một|0?1(?!\d))/i,/^tháng ?(Hai|0?2)/i,/^tháng ?(Ba|0?3)/i,/^tháng ?(Tư|0?4)/i,/^tháng ?(Năm|0?5)/i,/^tháng ?(Sáu|0?6)/i,/^tháng ?(Bảy|0?7)/i,/^tháng ?(Tám|0?8)/i,/^tháng ?(Chín|0?9)/i,/^tháng ?(Mười|10)/i,/^tháng ?(Mười ?Một|11)/i,/^tháng ?(Mười ?Hai|12)/i]},Gmt={narrow:/^(CN|T2|T3|T4|T5|T6|T7)/i,short:/^(CN|Th ?2|Th ?3|Th ?4|Th ?5|Th ?6|Th ?7)/i,abbreviated:/^(CN|Th ?2|Th ?3|Th ?4|Th ?5|Th ?6|Th ?7)/i,wide:/^(Chủ ?Nhật|Chúa ?Nhật|thứ ?Hai|thứ ?Ba|thứ ?Tư|thứ ?Năm|thứ ?Sáu|thứ ?Bảy)/i},Wmt={narrow:[/CN/i,/2/i,/3/i,/4/i,/5/i,/6/i,/7/i],short:[/CN/i,/2/i,/3/i,/4/i,/5/i,/6/i,/7/i],abbreviated:[/CN/i,/2/i,/3/i,/4/i,/5/i,/6/i,/7/i],wide:[/(Chủ|Chúa) ?Nhật/i,/Hai/i,/Ba/i,/Tư/i,/Năm/i,/Sáu/i,/Bảy/i]},Hmt={narrow:/^(a|p|nửa đêm|trưa|(giờ) (sáng|chiều|tối|đêm))/i,abbreviated:/^(am|pm|nửa đêm|trưa|(giờ) (sáng|chiều|tối|đêm))/i,wide:/^(ch[^i]*|sa|nửa đêm|trưa|(giờ) (sáng|chiều|tối|đêm))/i},qmt={any:{am:/^(a|sa)/i,pm:/^(p|ch[^i]*)/i,midnight:/nửa đêm/i,noon:/trưa/i,morning:/sáng/i,afternoon:/chiều/i,evening:/tối/i,night:/^đêm/i}},Kmt={ordinalNumber:Qj({matchPattern:Lmt,parsePattern:Vmt,valueCallback:t=>parseInt(t,10)}),era:Ys({matchPatterns:$mt,defaultMatchWidth:"wide",parsePatterns:jmt,defaultParseWidth:"any"}),quarter:Ys({matchPatterns:Umt,defaultMatchWidth:"wide",parsePatterns:Fmt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Ys({matchPatterns:Bmt,defaultMatchWidth:"wide",parsePatterns:zmt,defaultParseWidth:"wide"}),day:Ys({matchPatterns:Gmt,defaultMatchWidth:"wide",parsePatterns:Wmt,defaultParseWidth:"wide"}),dayPeriod:Ys({matchPatterns:Hmt,defaultMatchWidth:"wide",parsePatterns:qmt,defaultParseWidth:"any"})},Ymt={code:"vi",formatDistance:xmt,formatLong:Cmt,formatRelative:Tmt,localize:Amt,match:Kmt,options:{weekStartsOn:1,firstWeekContainsDate:1}},n3=t=>{if(!t)return"Нет данных";try{let e;if(typeof t=="string"?e=new Date(t):e=t,isNaN(e.getTime()))throw new Error("Invalid date");return Ji(e,"dd.MM.yyyy HH:mm",{locale:eU})}catch{return"Некорректная дата"}},uy=t=>{if(!t)return"";try{let e;if(typeof t=="string"?e=new Date(t):e=t,isNaN(e.getTime()))throw new Error("Invalid date");return Ji(e,"dd.MM.yy",{locale:eU})}catch{return""}},tU=(t,e)=>t?e?`${uy(t)} - ${uy(e)}`:uy(t):"Выберите период",CJ=t=>{if(!t||t.length!==8)return"Нет данных";try{const e=t.substring(0,4),n=t.substring(4,6);return`${t.substring(6,8)}.${n}.${e}`}catch{return"Некорректная дата"}},Xmt=t=>{if(!t)return"";try{const e=t.substring(0,6),n=e.substring(0,2)||"00",r=e.substring(2,4)||"00";return`${n}:${r}`}catch{return""}},nU=t=>t/(1024*1024*1024),Zmt=t=>t/(1024*1024*1024*1024),_J=t=>{const e=Zmt(t);return e>=1?{value:e,unit:"TB",decimalPlaces:2}:{value:nU(t),unit:"GB",decimalPlaces:0}},Qmt=t=>t?t.map(e=>({month:uy(e.date),studies:e.count})):[],Jmt=t=>t?t.map(e=>({date:uy(e.date),pacs:e.count})):[],e1t=t=>t?t.map(e=>({date:uy(e.date),storage:Number(nU(e.count).toFixed(2))})):[],t1t=t=>t?.reduce((e,n)=>e+n.count,0)||0,n1t=t=>t?.reduce((e,n)=>e+n.count,0)||0,r1t=t=>{if(!t||t.length===0)return 0;const e=t.reduce((n,r)=>n+r.count,0);return nU(e)},i1t=t=>{if(!t)return{currentStorage:0,totalStorage:0,storagePercentage:0,currentStorageUnit:"GB",totalStorageUnit:"GB",currentDecimalPlaces:0,totalDecimalPlaces:0};const e=_J(t.used),n=_J(t.total);let r=0;return t.total>0&&(r=t.used/t.total*100),{currentStorage:e.value,totalStorage:n.value,currentStorageUnit:e.unit,totalStorageUnit:n.unit,currentDecimalPlaces:e.decimalPlaces,totalDecimalPlaces:n.decimalPlaces,storagePercentage:r}};function a1t(){const{t,i18n:e}=Hn("analytics"),[n,r]=D.useState("1m"),i=D.useMemo(()=>jpt(n),[n]),{analytics:a,isAnalyticsLoading:o,isAnalyticsError:s,refetch:c}=tgt(i),l=Qmt(a?.charts?.studies),u=Jmt(a?.charts?.pacsTransfers),f=e1t(a?.charts?.storageCapacity),d=D.useMemo(()=>({totalStudies:t1t(a?.charts?.studies),totalPacsTransfers:n1t(a?.charts?.pacsTransfers),storageGrowth:r1t(a?.charts?.storageCapacity),...i1t(a?.charts.storageDiskUsage)}),[a]),h=S=>S>=1e3?`${(S/1e3).toFixed(1)}K`:(S>=1,S.toFixed(1)),m=S=>S>=1e3?`${(S/1e3).toFixed(0)}K`:S.toString(),p={studies:{label:t("charts.studies.label"),color:"var(--primary)"}},y={pacs:{label:t("charts.pacs.label"),color:"var(--accent)"}},x={storage:{label:t("charts.storage.label"),color:"var(--positive)"}};return s?w.jsx("div",{className:nn.errorContainer,children:w.jsx(e3,{variant:"card",description:t("errors.description"),onRetry:c})}):w.jsxs("div",{className:nn.page,children:[w.jsxs("header",{className:nn.header,children:[w.jsxs("div",{children:[w.jsx("h1",{className:nn.title,children:t("title")}),w.jsx("p",{className:nn.description,children:t("description")})]}),w.jsx("div",{className:"grid grid-cols-2 gap-4"}),w.jsx("div",{className:nn.header__actions,children:w.jsx("div",{className:nn.compact,children:w.jsxs(F5,{value:n,onValueChange:r,defaultValue:"1m",children:[w.jsxs(z5,{className:nn.select,children:[w.jsx(c$e,{className:nn.icon}),w.jsx(B5,{placeholder:t("period.placeholder")})]}),w.jsxs(G5,{children:[w.jsx(tf,{value:"1w",children:t("period.1w")}),w.jsx(tf,{value:"1m",children:t("period.1m")}),w.jsx(tf,{value:"3m",children:t("period.3m")}),w.jsx(tf,{value:"6m",children:t("period.6m")}),w.jsx(tf,{value:"1y",children:t("period.1y")})]})]})})})]}),w.jsxs("section",{className:nn.kpis,children:[w.jsxs(Oc,{className:nn.kpiCard,children:[w.jsxs(Jf,{className:nn.kpiHeader,children:[w.jsx("div",{className:nn.kpiIcon,"data-accent":"primary",children:w.jsx(f$e,{size:18})}),w.jsx(pg,{className:nn.kpiTitle,children:t("kpi.studies.title")}),w.jsx(Jp,{className:nn.kpiDesc,children:t("kpi.studies.description")})]}),w.jsx(Yu,{className:nn.kpiValue,children:o?w.jsx(An,{className:"h-[38px] w-32"}):w.jsx(Kx,{value:d.totalStudies,locale:e.language,delay:0,duration:1})})]}),w.jsxs(Oc,{className:nn.kpiCard,children:[w.jsxs(Jf,{className:nn.kpiHeader,children:[w.jsx("div",{className:nn.kpiIcon,"data-accent":"accent",children:w.jsx(Tse,{size:18})}),w.jsx(pg,{className:nn.kpiTitle,children:t("kpi.pacs.title")}),w.jsx(Jp,{className:nn.kpiDesc,children:t("kpi.pacs.description")})]}),w.jsx(Yu,{className:nn.kpiValue,children:o?w.jsx(An,{className:"h-[38px] w-32"}):w.jsx(Kx,{value:d.totalPacsTransfers,locale:e.language,delay:.15,duration:1.3})})]}),w.jsxs(Oc,{className:nn.kpiCard,children:[w.jsxs(Jf,{className:nn.kpiHeader,children:[w.jsx("div",{className:nn.kpiIcon,"data-accent":"positive",children:w.jsx(j6,{size:18})}),w.jsx(pg,{className:nn.kpiTitle,children:t("kpi.storage.title")}),w.jsx(Jp,{className:nn.kpiDesc,children:t("kpi.storage.description")})]}),w.jsx(Yu,{className:nn.kpiValue,children:o?w.jsx(An,{className:"h-[38px] w-32"}):w.jsxs(w.Fragment,{children:[w.jsx("div",{className:nn.valueWrapper,children:w.jsx(Kx,{value:d.currentStorage,locale:e.language,delay:.15,duration:1,decimalPlaces:d.currentDecimalPlaces,suffix:` ${d.currentStorageUnit}`})}),w.jsxs("div",{className:nn.storageSubtext,children:[t("kpi.storage.of")," "," ",w.jsx(Kx,{value:d.totalStorage,locale:e.language,delay:.25,duration:1,decimalPlaces:d.totalDecimalPlaces,suffix:` ${d.totalStorageUnit}`})," (",w.jsx(Kx,{value:d.storagePercentage,locale:e.language,delay:.35,duration:1,decimalPlaces:1,suffix:"%"}),")"]})]})})]})]}),w.jsx(kP,{className:nn.separator}),w.jsxs("div",{className:nn.charts,children:[o?w.jsx(eR,{type:"bar"}):w.jsxs(Oc,{className:nn.chartCard,children:[w.jsx(Jf,{className:nn.chartHeader,children:w.jsxs("div",{className:nn.chartHeader__title,children:[w.jsx(pg,{children:t("charts.studies.title")}),w.jsx(Jp,{children:t("charts.studies.description")})]})}),w.jsx(Yu,{className:nn.chartBody,children:w.jsx(ZM,{config:p,className:nn.chartContainer,children:w.jsx(hC,{width:"100%",height:320,children:w.jsxs(w0t,{data:l,barCategoryGap:"25%",children:[w.jsx(vC,{strokeDasharray:"3 3",vertical:!1}),w.jsx(yC,{dataKey:"month",tickLine:!1,axisLine:!1,tickMargin:8}),w.jsx(xC,{width:40,tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:m}),w.jsx(QM,{content:w.jsx(JM,{indicator:"dot"})}),w.jsx(y1e,{dataKey:"studies",radius:[10,10,6,6],fill:"var(--color-studies)"})]})})})})]}),o?w.jsx(eR,{type:"line",showLegend:!0}):w.jsxs(Oc,{className:nn.chartCard,children:[w.jsxs(Jf,{className:nn.chartHeader,children:[w.jsxs("div",{className:nn.chartHeader__title,children:[w.jsx(pg,{children:t("charts.pacs.title")}),w.jsx(Jp,{children:t("charts.pacs.description")})]}),w.jsx(ght,{className:nn.legend})]}),w.jsx(Yu,{className:nn.chartBody,children:w.jsx(ZM,{config:y,className:nn.chartContainer,children:w.jsx(hC,{width:"100%",height:320,children:w.jsxs(lJ,{data:u,children:[w.jsx("defs",{children:w.jsxs("linearGradient",{id:"pacsGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[w.jsx("stop",{offset:"0%",stopColor:"var(--color-pacs)",stopOpacity:.35}),w.jsx("stop",{offset:"90%",stopColor:"var(--color-pacs)",stopOpacity:0})]})}),w.jsx(vC,{strokeDasharray:"3 3",vertical:!1}),w.jsx(yC,{dataKey:"date",tickLine:!1,axisLine:!1,tickMargin:8}),w.jsx(xC,{width:40,tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:m}),w.jsx(QM,{content:w.jsx(JM,{indicator:"line"})}),w.jsx(CP,{type:"monotone",dataKey:"pacs",stroke:"var(--color-pacs)",fill:"url(#pacsGradient)",strokeWidth:2.25,dot:!1,activeDot:{r:4}})]})})})})]}),o?w.jsx(eR,{type:"area",fullWidth:!0}):w.jsxs(Oc,{className:`${nn.chartCard} ${nn.chartCard__full}`,children:[w.jsxs(Jf,{className:nn.chartHeader,children:[w.jsxs("div",{className:nn.chartHeader__title,children:[w.jsx(pg,{children:t("charts.storage.title")}),w.jsx(Jp,{children:t("charts.storage.description")})]}),w.jsxs("div",{className:nn.chartMetric,children:[w.jsx("div",{className:nn.metricIcon,"data-trend":"positive",children:w.jsx(eUe,{size:16})}),w.jsxs("div",{className:nn.metricContent,children:[w.jsx("div",{className:nn.metricLabel,children:t("charts.storage.periodGrowth")}),w.jsx("div",{className:nn.metricValue,children:w.jsx("span",{className:nn.metricNumber,children:o?w.jsx(An,{className:"h-4 w-16"}):`+${d.storageGrowth.toFixed(1)} GB`})})]})]})]}),w.jsx(Yu,{className:nn.chartBody,children:w.jsx("div",{className:nn.storageWrap,children:w.jsx(ZM,{config:x,className:`${nn.chartContainer} ${nn.storageInner}`,children:w.jsx(hC,{width:"100%",height:"100%",children:w.jsxs(lJ,{data:f,children:[w.jsx("defs",{children:w.jsxs("linearGradient",{id:"storageGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[w.jsx("stop",{offset:"5%",stopColor:"var(--color-storage)",stopOpacity:.35}),w.jsx("stop",{offset:"95%",stopColor:"var(--color-storage)",stopOpacity:0})]})}),w.jsx(vC,{strokeDasharray:"3 3",vertical:!1}),w.jsx(yC,{dataKey:"date",tickLine:!1,axisLine:!1,tickMargin:8}),w.jsx(xC,{width:56,tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:h}),w.jsx(QM,{content:w.jsx(JM,{indicator:"line"})}),w.jsx(CP,{type:"monotone",dataKey:"storage",stroke:"var(--color-storage)",fill:"url(#storageGradient)",strokeWidth:2.25,dot:!1,activeDot:{r:4}})]})})})})})]})]})]})}const o1t="_container_16a2o_1",s1t="_errorContainer_16a2o_8",c1t="_headerSection_16a2o_15",l1t="_headerActions_16a2o_28",u1t="_title_16a2o_40",f1t="_description_16a2o_47",d1t="_badgeContainer_16a2o_53",h1t="_section_16a2o_67",g1t="_sectionHeader_16a2o_73",p1t="_sectionIcon_16a2o_79",m1t="_sectionTitle_16a2o_90",v1t="_cards_16a2o_97",y1t="_deviceCard_16a2o_113",x1t="_camiCard_16a2o_122",w1t="_externalCard_16a2o_127",b1t="_cardHeader_16a2o_132",S1t="_cardTitleContainer_16a2o_136",C1t="_cardTitle_16a2o_136",_1t="_icon_16a2o_151",T1t="_dropdownButton_16a2o_157",E1t="_moreIcon_16a2o_162",O1t="_cardContent_16a2o_167",D1t="_aeTitle_16a2o_174",M1t="_calendarIcon_16a2o_191",R1t="_lastImageSection_16a2o_198",I1t="_dateTimeInfo_16a2o_204",N1t="_dateTimeLabel_16a2o_208",P1t="_dateTimeValue_16a2o_213",Ht={container:o1t,errorContainer:s1t,headerSection:c1t,headerActions:l1t,title:u1t,description:f1t,badgeContainer:d1t,section:h1t,sectionHeader:g1t,sectionIcon:p1t,sectionTitle:m1t,cards:v1t,deviceCard:y1t,camiCard:x1t,externalCard:w1t,cardHeader:b1t,cardTitleContainer:S1t,cardTitle:C1t,icon:_1t,dropdownButton:T1t,moreIcon:E1t,cardContent:O1t,aeTitle:D1t,calendarIcon:M1t,lastImageSection:R1t,dateTimeInfo:I1t,dateTimeLabel:N1t,dateTimeValue:P1t};var Pve="AlertDialog",[k1t]=Uc(Pve,[ose]),Nh=ose(),kve=t=>{const{__scopeAlertDialog:e,...n}=t,r=Nh(e);return w.jsx(QA,{...r,...n,modal:!0})};kve.displayName=Pve;var A1t="AlertDialogTrigger",Ave=D.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Nh(n);return w.jsx(YVe,{...i,...r,ref:e})});Ave.displayName=A1t;var L1t="AlertDialogPortal",Lve=t=>{const{__scopeAlertDialog:e,...n}=t,r=Nh(e);return w.jsx(JA,{...r,...n})};Lve.displayName=L1t;var V1t="AlertDialogOverlay",Vve=D.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Nh(n);return w.jsx(eL,{...i,...r,ref:e})});Vve.displayName=V1t;var fy="AlertDialogContent",[$1t,j1t]=k1t(fy),U1t=Moe("AlertDialogContent"),$ve=D.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,a=Nh(n),o=D.useRef(null),s=$n(e,o),c=D.useRef(null);return w.jsx(WVe,{contentName:fy,titleName:jve,docsSlug:"alert-dialog",children:w.jsx($1t,{scope:n,cancelRef:c,children:w.jsxs(tL,{role:"alertdialog",...a,...i,ref:s,onOpenAutoFocus:Et(i.onOpenAutoFocus,l=>{l.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:l=>l.preventDefault(),onInteractOutside:l=>l.preventDefault(),children:[w.jsx(U1t,{children:r}),w.jsx(B1t,{contentRef:o})]})})})});$ve.displayName=fy;var jve="AlertDialogTitle",Uve=D.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Nh(n);return w.jsx(Sse,{...i,...r,ref:e})});Uve.displayName=jve;var Fve="AlertDialogDescription",Bve=D.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Nh(n);return w.jsx(Cse,{...i,...r,ref:e})});Bve.displayName=Fve;var F1t="AlertDialogAction",zve=D.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Nh(n);return w.jsx(nL,{...i,...r,ref:e})});zve.displayName=F1t;var Gve="AlertDialogCancel",Wve=D.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=j1t(Gve,n),a=Nh(n),o=$n(e,i);return w.jsx(nL,{...a,...r,ref:o})});Wve.displayName=Gve;var B1t=({contentRef:t})=>{const e=`\`${fy}\` requires a description for the component to be accessible for screen reader users.

You can add a description to the \`${fy}\` by passing a \`${Fve}\` 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 \`${fy}\`. 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 D.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},z1t=kve,G1t=Ave,W1t=Lve,H1t=Vve,q1t=$ve,K1t=zve,Y1t=Wve,X1t=Uve,Z1t=Bve;function yE({...t}){return w.jsx(z1t,{"data-slot":"alert-dialog",...t})}function rU({...t}){return w.jsx(G1t,{"data-slot":"alert-dialog-trigger",...t})}function Q1t({...t}){return w.jsx(W1t,{"data-slot":"alert-dialog-portal",...t})}function J1t({className:t,...e}){return w.jsx(H1t,{"data-slot":"alert-dialog-overlay",className:rt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function xE({className:t,...e}){return w.jsxs(Q1t,{children:[w.jsx(J1t,{}),w.jsx(q1t,{"data-slot":"alert-dialog-content",className:rt("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...e})]})}function wE({className:t,...e}){return w.jsx("div",{"data-slot":"alert-dialog-header",className:rt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function bE({className:t,...e}){return w.jsx("div",{"data-slot":"alert-dialog-footer",className:rt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function SE({className:t,...e}){return w.jsx(X1t,{"data-slot":"alert-dialog-title",className:rt("text-lg font-semibold",t),...e})}function CE({className:t,...e}){return w.jsx(Z1t,{"data-slot":"alert-dialog-description",className:rt("text-muted-foreground text-sm",t),...e})}function iU({className:t,...e}){return w.jsx(K1t,{className:rt(ww(),t),...e})}function _E({className:t,...e}){return w.jsx(Y1t,{className:rt(ww({variant:"outline"}),t),...e})}class TE{static async getDevices(){return(await ni.get("/modalities")).data}static async createDevice(e){return(await ni.put("/modalities",e)).data}static async updateDevice(e){await ni.patch("/modalities",e)}static async deleteDevice(e){await ni.delete(`/modalities/${e}`)}}const aU=()=>{const t=Sh({queryKey:["modalities"],queryFn:TE.getDevices,refetchInterval:6e5,placeholderData:IOe}),e=t.data?.find(a=>a.name==="CAMI"),n=t.data?.filter(a=>a.name!=="CAMI"&&a.isSource!==!1)||[],r=t.data?.filter(a=>a.name!=="CAMI"&&a.isSource===!1)||[],i=n.map(a=>a.aetitle);return{devices:t.data||[],aetitles:t.data?.map(a=>a.aetitle)||[],regularAetitles:i,camiDevice:e,regularDevices:n,externalDevices:r,isDeviceLoading:t.isLoading,isDeviceError:t.isError,isDeviceFetching:t.isFetching,refetch:t.refetch}},evt=()=>{const{t}=Hn("devices"),e=$c(),n=jc({mutationFn:r=>TE.createDevice(r),onSuccess:r=>{e.invalidateQueries({queryKey:["modalities"]}),Br.success(t("notifications.create_success",{name:r.name}))},onError:r=>{console.error("Error creating device:",r),Br.error(t("notifications.create_error"))}});return{createDevice:n.mutate,createDeviceAsync:n.mutateAsync,isCreating:n.isPending,isSuccess:n.isSuccess,isError:n.isError,error:n.error}},Hve=()=>{const{t}=Hn("devices"),e=$c(),n=jc({mutationFn:({data:r})=>TE.updateDevice(r),onSuccess:()=>{e.invalidateQueries({queryKey:["modalities"]}),Br.success(t("notifications.update_success"))},onError:r=>{console.error("Error updating device:",r),Br.error(t("notifications.update_error"))}});return{updateDeviceAsync:n.mutateAsync,isUpdating:n.isPending}},tvt=()=>{const{t}=Hn("devices"),e=$c(),n=jc({mutationFn:r=>TE.deleteDevice(r),onSuccess:(r,i)=>{e.invalidateQueries({queryKey:["modalities"]}),Br.success(t("notifications.delete_success",{aetitle:i}))},onError:r=>{console.error("Error deleting device:",r),Br.error(t("notifications.delete_error"))}});return{deleteDevice:n.mutate,isDeleting:n.isPending}},nvt=({children:t,deviceName:e,aetitle:n})=>{const{t:r}=Hn("devices"),{deleteDevice:i,isDeleting:a}=tvt(),[o,s]=D.useState(!1),c=()=>{i(n,{onSuccess:()=>s(!1)})};return w.jsxs(yE,{open:o,onOpenChange:s,children:[w.jsx(rU,{asChild:!0,children:t}),w.jsxs(xE,{children:[w.jsxs(wE,{children:[w.jsx(SE,{children:r("alert.delete.title")}),w.jsx(CE,{children:w.jsx(KTe,{i18nKey:"alert.delete.description",t:r,values:{name:e,aetitle:n},components:{1:w.jsx("b",{})}})})]}),w.jsxs(bE,{children:[w.jsx(_E,{disabled:a,className:"cursor-pointer",children:r("alert.delete.cancel")}),w.jsx(iU,{onClick:l=>{l.preventDefault(),c()},disabled:a,className:"bg-destructive text-destructive-foreground cursor-pointer hover:bg-destructive/90",children:r(a?"alert.delete.loading":"alert.delete.confirm")})]})]})]})},rvt="_dialogContent_dywr5_1",ivt="_form_dywr5_5",avt="_grid_dywr5_12",ovt="_actions_dywr5_18",pS={dialogContent:rvt,form:ivt,grid:avt,actions:ovt};function LP({className:t,...e}){return w.jsx("textarea",{"data-slot":"textarea",className:rt("border-input placeholder:text-muted-foreground 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:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...e})}function svt(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const cvt={},w5={};function Cm(t,e){try{const r=(cvt[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in w5?w5[r]:TJ(r,r.split(":"))}catch{if(t in w5)return w5[t];const n=t?.match(lvt);return n?TJ(t,n.slice(1)):NaN}}const lvt=/([+-]\d\d):?(\d\d)?/;function TJ(t,e){const n=+(e[0]||0),r=+(e[1]||0),i=+(e[2]||0)/60;return w5[t]=n*60+r>0?n*60+r+i:n*60-r-i}class cd extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Cm(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),qve(this),VP(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new cd(...n,e):new cd(Date.now(),e)}withTimeZone(e){return new cd(+this,e)}getTimezoneOffset(){const e=-Cm(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),VP(this),+this}[Symbol.for("constructDateFrom")](e){return new cd(+new Date(e),this.timeZone)}}const EJ=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!EJ.test(t))return;const e=t.replace(EJ,"$1UTC");cd.prototype[e]&&(t.startsWith("get")?cd.prototype[t]=function(){return this.internal[e]()}:(cd.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),uvt(this),+this},cd.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),VP(this),+this}))});function VP(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Cm(t.timeZone,t)*60))}function uvt(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),qve(t)}function qve(t){const e=Cm(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const i=-new Date(+t).getTimezoneOffset(),a=-new Date(+r).getTimezoneOffset(),o=i-a,s=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();o&&s&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+o);const c=i-n;c&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+c);const l=new Date(+t);l.setUTCSeconds(0);const u=i>0?l.getSeconds():(l.getSeconds()-60)%60,f=Math.round(-(Cm(t.timeZone,t)*60))%60;(f||u)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+f),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+f+u));const d=Cm(t.timeZone,t),h=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+t).getTimezoneOffset()-h,y=h!==n,x=p-c;if(y&&x){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+x);const S=Cm(t.timeZone,t),C=S>0?Math.floor(S):Math.ceil(S),_=h-C;_&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+_),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_))}}class xs extends cd{static tz(e,...n){return n.length?new xs(...n,e):new xs(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),i=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,i]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,i]=this.tzComponents();return`${e} GMT${n}${r}${i} (${svt(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[n,r,i]}withTimeZone(e){return new xs(+this,e)}[Symbol.for("constructDateFrom")](e){return new xs(+new Date(e),this.timeZone)}}const OJ=5,fvt=4;function dvt(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,i=e.addDays(t,-r+1),a=e.addDays(i,OJ*7-1);return e.getMonth(t)===e.getMonth(a)?OJ:fvt}function Kve(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function hvt(t,e){const n=Kve(t,e),r=dvt(t,e);return e.addDays(n,r*7-1)}class Dl{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?xs.tz(this.options.timeZone):new this.Date,this.newDate=(r,i,a)=>this.overrides?.newDate?this.overrides.newDate(r,i,a):this.options.timeZone?new xs(r,i,a,this.options.timeZone):new Date(r,i,a),this.addDays=(r,i)=>this.overrides?.addDays?this.overrides.addDays(r,i):Yj(r,i),this.addMonths=(r,i)=>this.overrides?.addMonths?this.overrides.addMonths(r,i):Xj(r,i),this.addWeeks=(r,i)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,i):agt(r,i),this.addYears=(r,i)=>this.overrides?.addYears?this.overrides.addYears(r,i):ogt(r,i),this.differenceInCalendarDays=(r,i)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,i):Zj(r,i),this.differenceInCalendarMonths=(r,i)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,i):Cve(r,i),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):ygt(r),this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):hvt(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):wgt(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Tve(r),this.endOfWeek=(r,i)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,i):Ove(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):xgt(r),this.format=(r,i,a)=>{const o=this.overrides?.format?this.overrides.format(r,i,this.options):Ji(r,i,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):Dve(r),this.getMonth=(r,i)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):mpt(r,this.options),this.getYear=(r,i)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):vpt(r,this.options),this.getWeek=(r,i)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):Rve(r,this.options),this.isAfter=(r,i)=>this.overrides?.isAfter?this.overrides.isAfter(r,i):ypt(r,i),this.isBefore=(r,i)=>this.overrides?.isBefore?this.overrides.isBefore(r,i):xpt(r,i),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):Sve(r),this.isSameDay=(r,i)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,i):lgt(r,i),this.isSameMonth=(r,i)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,i):wpt(r,i),this.isSameYear=(r,i)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,i):bpt(r,i),this.max=r=>this.overrides?.max?this.overrides.max(r):sgt(r),this.min=r=>this.overrides?.min?this.overrides.min(r):cgt(r),this.setMonth=(r,i)=>this.overrides?.setMonth?this.overrides.setMonth(r,i):Vpt(r,i),this.setYear=(r,i)=>this.overrides?.setYear?this.overrides.setYear(r,i):$pt(r,i),this.startOfBroadcastWeek=(r,i)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Kve(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):F0(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Bw(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):AP(r),this.startOfWeek=(r,i)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):np(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):Eve(r),this.options={locale:zw,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let i=0;i<10;i++)r[i.toString()]=n.format(i);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&Dl.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&Dl.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:"long",year:"numeric",timeZone:r,numberingSystem:i}).format(e)}catch{}const o=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,o)}}Dl.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Pd=new Dl;class Yve{constructor(e,n,r=Pd){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class gvt{constructor(e,n){this.date=e,this.weeks=n}}class pvt{constructor(e,n){this.days=n,this.weekNumber=e}}function mvt(t){return Ce.createElement("button",{...t})}function vvt(t){return Ce.createElement("span",{...t})}function yvt(t){const{size:e=24,orientation:n="left",className:r}=t;return Ce.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&Ce.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Ce.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Ce.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Ce.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function xvt(t){const{day:e,modifiers:n,...r}=t;return Ce.createElement("td",{...r})}function wvt(t){const{day:e,modifiers:n,...r}=t,i=Ce.useRef(null);return Ce.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),Ce.createElement("button",{ref:i,...r})}var on;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(on||(on={}));var qi;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(qi||(qi={}));var of;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(of||(of={}));var ll;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(ll||(ll={}));function bvt(t){const{options:e,className:n,components:r,classNames:i,...a}=t,o=[i[on.Dropdown],n].join(" "),s=e?.find(({value:c})=>c===a.value);return Ce.createElement("span",{"data-disabled":a.disabled,className:i[on.DropdownRoot]},Ce.createElement(r.Select,{className:o,...a},e?.map(({value:c,label:l,disabled:u})=>Ce.createElement(r.Option,{key:c,value:c,disabled:u},l))),Ce.createElement("span",{className:i[on.CaptionLabel],"aria-hidden":!0},s?.label,Ce.createElement(r.Chevron,{orientation:"down",size:18,className:i[on.Chevron]})))}function Svt(t){return Ce.createElement("div",{...t})}function Cvt(t){return Ce.createElement("div",{...t})}function _vt(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ce.createElement("div",{...r},t.children)}function Tvt(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ce.createElement("div",{...r})}function Evt(t){return Ce.createElement("table",{...t})}function Ovt(t){return Ce.createElement("div",{...t})}const Xve=D.createContext(void 0);function r3(){const t=D.useContext(Xve);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function Dvt(t){const{components:e}=r3();return Ce.createElement(e.Dropdown,{...t})}function Mvt(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:i,...a}=t,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=r3(),u=D.useCallback(d=>{i&&n?.(d)},[i,n]),f=D.useCallback(d=>{r&&e?.(d)},[r,e]);return Ce.createElement("nav",{...a},Ce.createElement(o.PreviousMonthButton,{type:"button",className:s[on.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:f},Ce.createElement(o.Chevron,{disabled:r?void 0:!0,className:s[on.Chevron],orientation:"left"})),Ce.createElement(o.NextMonthButton,{type:"button",className:s[on.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:u},Ce.createElement(o.Chevron,{disabled:i?void 0:!0,orientation:"right",className:s[on.Chevron]})))}function Rvt(t){const{components:e}=r3();return Ce.createElement(e.Button,{...t})}function Ivt(t){return Ce.createElement("option",{...t})}function Nvt(t){const{components:e}=r3();return Ce.createElement(e.Button,{...t})}function Pvt(t){const{rootRef:e,...n}=t;return Ce.createElement("div",{...n,ref:e})}function kvt(t){return Ce.createElement("select",{...t})}function Avt(t){const{week:e,...n}=t;return Ce.createElement("tr",{...n})}function Lvt(t){return Ce.createElement("th",{...t})}function Vvt(t){return Ce.createElement("thead",{"aria-hidden":!0},Ce.createElement("tr",{...t}))}function $vt(t){const{week:e,...n}=t;return Ce.createElement("th",{...n})}function jvt(t){return Ce.createElement("th",{...t})}function Uvt(t){return Ce.createElement("tbody",{...t})}function Fvt(t){const{components:e}=r3();return Ce.createElement(e.Dropdown,{...t})}const Bvt=Object.freeze(Object.defineProperty({__proto__:null,Button:mvt,CaptionLabel:vvt,Chevron:yvt,Day:xvt,DayButton:wvt,Dropdown:bvt,DropdownNav:Svt,Footer:Cvt,Month:_vt,MonthCaption:Tvt,MonthGrid:Evt,Months:Ovt,MonthsDropdown:Dvt,Nav:Mvt,NextMonthButton:Rvt,Option:Ivt,PreviousMonthButton:Nvt,Root:Pvt,Select:kvt,Week:Avt,WeekNumber:$vt,WeekNumberHeader:jvt,Weekday:Lvt,Weekdays:Vvt,Weeks:Uvt,YearsDropdown:Fvt},Symbol.toStringTag,{value:"Module"}));function B0(t,e,n=!1,r=Pd){let{from:i,to:a}=t;const{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(e,i)>=(n?1:0)&&o(a,e)>=(n?1:0)):!n&&a?s(a,e):!n&&i?s(i,e):!1}function Zve(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function oU(t){return!!(t&&typeof t=="object"&&"from"in t)}function Qve(t){return!!(t&&typeof t=="object"&&"after"in t)}function Jve(t){return!!(t&&typeof t=="object"&&"before"in t)}function eye(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function tye(t,e){return Array.isArray(t)&&t.every(e.isDate)}function z0(t,e,n=Pd){const r=Array.isArray(e)?e:[e],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(s=>{if(typeof s=="boolean")return s;if(n.isDate(s))return i(t,s);if(tye(s,n))return s.includes(t);if(oU(s))return B0(s,t,!1,n);if(eye(s))return Array.isArray(s.dayOfWeek)?s.dayOfWeek.includes(t.getDay()):s.dayOfWeek===t.getDay();if(Zve(s)){const c=a(s.before,t),l=a(s.after,t),u=c>0,f=l<0;return o(s.before,s.after)?f&&u:u||f}return Qve(s)?a(t,s.after)>0:Jve(s)?a(s.before,t)>0:typeof s=="function"?s(t):!1})}function zvt(t,e,n,r,i){const{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u}=e,{isSameDay:f,isSameMonth:d,startOfMonth:h,isBefore:m,endOfMonth:p,isAfter:y}=i,x=n&&h(n),S=r&&p(r),C={[qi.focused]:[],[qi.outside]:[],[qi.disabled]:[],[qi.hidden]:[],[qi.today]:[]},_={};for(const T of t){const{date:O,displayMonth:M}=T,I=!!(M&&!d(O,M)),V=!!(x&&m(O,x)),k=!!(S&&y(O,S)),L=!!(a&&z0(O,a,i)),$=!!(o&&z0(O,o,i))||V||k||!l&&!c&&I||l&&c===!1&&I,W=f(O,u??i.today());I&&C.outside.push(T),L&&C.disabled.push(T),$&&C.hidden.push(T),W&&C.today.push(T),s&&Object.keys(s).forEach(G=>{const oe=s?.[G];oe&&z0(O,oe,i)&&(_[G]?_[G].push(T):_[G]=[T])})}return T=>{const O={[qi.focused]:!1,[qi.disabled]:!1,[qi.hidden]:!1,[qi.outside]:!1,[qi.today]:!1},M={};for(const I in C){const V=C[I];O[I]=V.some(k=>k===T)}for(const I in _)M[I]=_[I].some(V=>V===T);return{...O,...M}}}function Gvt(t,e,n={}){return Object.entries(t).filter(([,i])=>i===!0).reduce((i,[a])=>(n[a]?i.push(n[a]):e[qi[a]]?i.push(e[qi[a]]):e[of[a]]&&i.push(e[of[a]]),i),[e[on.Day]])}function Wvt(t){return{...Bvt,...t}}function Hvt(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function sU(){const t={};for(const e in on)t[on[e]]=`rdp-${on[e]}`;for(const e in qi)t[qi[e]]=`rdp-${qi[e]}`;for(const e in of)t[of[e]]=`rdp-${of[e]}`;for(const e in ll)t[ll[e]]=`rdp-${ll[e]}`;return t}function nye(t,e,n){return(n??new Dl(e)).formatMonthYear(t)}const qvt=nye;function Kvt(t,e,n){return(n??new Dl(e)).format(t,"d")}function Yvt(t,e=Pd){return e.format(t,"LLLL")}function Xvt(t,e,n){return(n??new Dl(e)).format(t,"cccccc")}function Zvt(t,e=Pd){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Qvt(){return""}function rye(t,e=Pd){return e.format(t,"yyyy")}const Jvt=rye,eyt=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:nye,formatDay:Kvt,formatMonthCaption:qvt,formatMonthDropdown:Yvt,formatWeekNumber:Zvt,formatWeekNumberHeader:Qvt,formatWeekdayName:Xvt,formatYearCaption:Jvt,formatYearDropdown:rye},Symbol.toStringTag,{value:"Module"}));function tyt(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...eyt,...t}}function nyt(t,e,n,r,i){const{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(t),end:s(t)}).map(d=>{const h=r.formatMonthDropdown(d,i),m=l(d),p=e&&d<a(e)||n&&d>a(n)||!1;return{value:m,label:h,disabled:p}})}function ryt(t,e={},n={}){let r={...e?.[on.Day]};return Object.entries(t).filter(([,i])=>i===!0).forEach(([i])=>{r={...r,...n?.[i]}}),r}function iyt(t,e,n){const r=t.today(),i=e?t.startOfISOWeek(r):t.startOfWeek(r),a=[];for(let o=0;o<7;o++){const s=t.addDays(i,o);a.push(s)}return a}function ayt(t,e,n,r,i=!1){if(!t||!e)return;const{startOfYear:a,endOfYear:o,addYears:s,getYear:c,isBefore:l,isSameYear:u}=r,f=a(t),d=o(e),h=[];let m=f;for(;l(m,d)||u(m,d);)h.push(m),m=s(m,1);return i&&h.reverse(),h.map(p=>{const y=n.formatYearDropdown(p,r);return{value:c(p),label:y,disabled:!1}})}function iye(t,e,n,r){let i=(r??new Dl(n)).format(t,"PPPP");return e.today&&(i=`Today, ${i}`),e.selected&&(i=`${i}, selected`),i}const oyt=iye;function aye(t,e,n){return(n??new Dl(e)).formatMonthYear(t)}const syt=aye;function cyt(t,e,n,r){let i=(r??new Dl(n)).format(t,"PPPP");return e?.today&&(i=`Today, ${i}`),i}function lyt(t){return"Choose the Month"}function uyt(){return""}function fyt(t){return"Go to the Next Month"}function dyt(t){return"Go to the Previous Month"}function hyt(t,e,n){return(n??new Dl(e)).format(t,"cccc")}function gyt(t,e){return`Week ${t}`}function pyt(t){return"Week Number"}function myt(t){return"Choose the Year"}const vyt=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:syt,labelDay:oyt,labelDayButton:iye,labelGrid:aye,labelGridcell:cyt,labelMonthDropdown:lyt,labelNav:uyt,labelNext:fyt,labelPrevious:dyt,labelWeekNumber:gyt,labelWeekNumberHeader:pyt,labelWeekday:hyt,labelYearDropdown:myt},Symbol.toStringTag,{value:"Module"})),i3=t=>t instanceof HTMLElement?t:null,nR=t=>[...t.querySelectorAll("[data-animated-month]")??[]],yyt=t=>i3(t.querySelector("[data-animated-month]")),rR=t=>i3(t.querySelector("[data-animated-caption]")),iR=t=>i3(t.querySelector("[data-animated-weeks]")),xyt=t=>i3(t.querySelector("[data-animated-nav]")),wyt=t=>i3(t.querySelector("[data-animated-weekdays]"));function byt(t,e,{classNames:n,months:r,focused:i,dateLib:a}){const o=D.useRef(null),s=D.useRef(r),c=D.useRef(!1);D.useLayoutEffect(()=>{const l=s.current;if(s.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;const u=a.isSameMonth(r[0].date,l[0].date),f=a.isAfter(r[0].date,l[0].date),d=f?n[ll.caption_after_enter]:n[ll.caption_before_enter],h=f?n[ll.weeks_after_enter]:n[ll.weeks_before_enter],m=o.current,p=t.current.cloneNode(!0);if(p instanceof HTMLElement?(nR(p).forEach(C=>{if(!(C instanceof HTMLElement))return;const _=yyt(C);_&&C.contains(_)&&C.removeChild(_);const T=rR(C);T&&T.classList.remove(d);const O=iR(C);O&&O.classList.remove(h)}),o.current=p):o.current=null,c.current||u||i)return;const y=m instanceof HTMLElement?nR(m):[],x=nR(t.current);if(x?.every(S=>S instanceof HTMLElement)&&y&&y.every(S=>S instanceof HTMLElement)){c.current=!0,t.current.style.isolation="isolate";const S=xyt(t.current);S&&(S.style.zIndex="1"),x.forEach((C,_)=>{const T=y[_];if(!T)return;C.style.position="relative",C.style.overflow="hidden";const O=rR(C);O&&O.classList.add(d);const M=iR(C);M&&M.classList.add(h);const I=()=>{c.current=!1,t.current&&(t.current.style.isolation=""),S&&(S.style.zIndex=""),O&&O.classList.remove(d),M&&M.classList.remove(h),C.style.position="",C.style.overflow="",C.contains(T)&&C.removeChild(T)};T.style.pointerEvents="none",T.style.position="absolute",T.style.overflow="hidden",T.setAttribute("aria-hidden","true");const V=wyt(T);V&&(V.style.opacity="0");const k=rR(T);k&&(k.classList.add(f?n[ll.caption_before_exit]:n[ll.caption_after_exit]),k.addEventListener("animationend",I));const L=iR(T);L&&L.classList.add(f?n[ll.weeks_before_exit]:n[ll.weeks_after_exit]),C.insertBefore(T,C.firstChild)})}})}function Syt(t,e,n,r){const i=t[0],a=t[t.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:f,endOfBroadcastWeek:d,endOfISOWeek:h,endOfMonth:m,endOfWeek:p,isAfter:y,startOfBroadcastWeek:x,startOfISOWeek:S,startOfWeek:C}=r,_=c?x(i,r):o?S(i):C(i),T=c?d(a):o?h(m(a)):p(m(a)),O=u(T,_),M=f(a,i)+1,I=[];for(let L=0;L<=O;L++){const $=l(_,L);if(e&&y($,e))break;I.push($)}const k=(c?35:42)*M;if(s&&I.length<k){const L=k-I.length;for(let $=0;$<L;$++){const W=l(I[I.length-1],1);I.push(W)}}return I}function Cyt(t){const e=[];return t.reduce((n,r)=>{const i=r.weeks.reduce((a,o)=>a.concat(o.days.slice()),e.slice());return n.concat(i.slice())},e.slice())}function _yt(t,e,n,r){const{numberOfMonths:i=1}=n,a=[];for(let o=0;o<i;o++){const s=r.addMonths(t,o);if(e&&s>e)break;a.push(s)}return a}function DJ(t,e,n,r){const{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=t;let c=i||a||o;const{differenceInCalendarMonths:l,addMonths:u,startOfMonth:f}=r;if(n&&l(n,c)<s-1){const d=-1*(s-1);c=u(n,d)}return e&&l(c,e)<0&&(c=e),f(c)}function Tyt(t,e,n,r){const{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:f,startOfISOWeek:d,startOfWeek:h}=r,m=t.reduce((p,y)=>{const x=n.broadcastCalendar?f(y,r):n.ISOWeek?d(y):h(y),S=n.broadcastCalendar?a(y):n.ISOWeek?o(s(y)):c(s(y)),C=e.filter(M=>M>=x&&M<=S),_=n.broadcastCalendar?35:42;if(n.fixedWeeks&&C.length<_){const M=e.filter(I=>{const V=_-C.length;return I>S&&I<=i(S,V)});C.push(...M)}const T=C.reduce((M,I)=>{const V=n.ISOWeek?l(I):u(I),k=M.find($=>$.weekNumber===V),L=new Yve(I,y,r);return k?k.days.push(L):M.push(new pvt(V,[L])),M},[]),O=new gvt(y,T);return p.push(O),p},[]);return n.reverseMonths?m.reverse():m}function Eyt(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,newDate:u,today:f}=e,{fromYear:d,toYear:h,fromMonth:m,toMonth:p}=t;!n&&m&&(n=m),!n&&d&&(n=e.newDate(d,0,1)),!r&&p&&(r=p),!r&&h&&(r=u(h,11,31));const y=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=o(n):d?n=u(d,0,1):!n&&y&&(n=i(c(t.today??f(),-100))),r?r=s(r):h?r=u(h,11,31):!r&&y&&(r=l(t.today??f())),[n&&a(n),r&&a(r)]}function Oyt(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(t);if(!e)return s(u,l);if(!(c(e,t)<a))return s(u,l)}function Dyt(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(t);if(!e)return s(u,-l);if(!(c(u,e)<=0))return s(u,-l)}function Myt(t){const e=[];return t.reduce((n,r)=>n.concat(r.weeks.slice()),e.slice())}function EE(t,e){const[n,r]=D.useState(t);return[e===void 0?n:e,r]}function Ryt(t,e){const[n,r]=Eyt(t,e),{startOfMonth:i,endOfMonth:a}=e,o=DJ(t,n,r,e),[s,c]=EE(o,t.month?o:void 0);D.useEffect(()=>{const O=DJ(t,n,r,e);c(O)},[t.timeZone]);const l=_yt(s,r,t,e),u=Syt(l,t.endMonth?a(t.endMonth):void 0,t,e),f=Tyt(l,u,t,e),d=Myt(f),h=Cyt(f),m=Dyt(s,n,t,e),p=Oyt(s,r,t,e),{disableNavigation:y,onMonthChange:x}=t,S=O=>d.some(M=>M.days.some(I=>I.isEqualTo(O))),C=O=>{if(y)return;let M=i(O);n&&M<i(n)&&(M=i(n)),r&&M>i(r)&&(M=i(r)),c(M),x?.(M)};return{months:f,weeks:d,days:h,navStart:n,navEnd:r,previousMonth:m,nextMonth:p,goToMonth:C,goToDay:O=>{S(O)||C(O.date)}}}var Xf;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(Xf||(Xf={}));function MJ(t){return!t[qi.disabled]&&!t[qi.hidden]&&!t[qi.outside]}function Iyt(t,e,n,r){let i,a=-1;for(const o of t){const s=e(o);MJ(s)&&(s[qi.focused]&&a<Xf.FocusedModifier?(i=o,a=Xf.FocusedModifier):r?.isEqualTo(o)&&a<Xf.LastFocused?(i=o,a=Xf.LastFocused):n(o.date)&&a<Xf.Selected?(i=o,a=Xf.Selected):s[qi.today]&&a<Xf.Today&&(i=o,a=Xf.Today))}return i||(i=t.find(o=>MJ(e(o)))),i}function Nyt(t,e,n,r,i,a,o){const{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:f,addYears:d,endOfBroadcastWeek:h,endOfISOWeek:m,endOfWeek:p,max:y,min:x,startOfBroadcastWeek:S,startOfISOWeek:C,startOfWeek:_}=o;let O={day:l,week:f,month:u,year:d,startOfWeek:M=>c?S(M,o):s?C(M):_(M),endOfWeek:M=>c?h(M):s?m(M):p(M)}[t](n,e==="after"?1:-1);return e==="before"&&r?O=y([r,O]):e==="after"&&i&&(O=x([i,O])),O}function oye(t,e,n,r,i,a,o,s=0){if(s>365)return;const c=Nyt(t,e,n.date,r,i,a,o),l=!!(a.disabled&&z0(c,a.disabled,o)),u=!!(a.hidden&&z0(c,a.hidden,o)),f=c,d=new Yve(c,f,o);return!l&&!u?d:oye(t,e,d,r,i,a,o,s+1)}function Pyt(t,e,n,r,i){const{autoFocus:a}=t,[o,s]=D.useState(),c=Iyt(e.days,n,r||(()=>!1),o),[l,u]=D.useState(a?c:void 0);return{isFocusTarget:p=>!!c?.isEqualTo(p),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(p,y)=>{if(!l)return;const x=oye(p,y,l,e.navStart,e.navEnd,t,i);x&&(e.goToDay(x),u(x))}}}function kyt(t,e){const{selected:n,required:r,onSelect:i}=t,[a,o]=EE(n,i?n:void 0),s=i?n:a,{isSameDay:c}=e,l=h=>s?.some(m=>c(m,h))??!1,{min:u,max:f}=t;return{selected:s,select:(h,m,p)=>{let y=[...s??[]];if(l(h)){if(s?.length===u||r&&s?.length===1)return;y=s?.filter(x=>!c(x,h))}else s?.length===f?y=[h]:y=[...y,h];return i||o(y),i?.(y,h,m,p),y},isSelected:l}}function Ayt(t,e,n=0,r=0,i=!1,a=Pd){const{from:o,to:s}=e||{},{isSameDay:c,isAfter:l,isBefore:u}=a;let f;if(!o&&!s)f={from:t,to:n>0?void 0:t};else if(o&&!s)c(o,t)?n===0?f={from:o,to:t}:i?f={from:o,to:void 0}:f=void 0:u(t,o)?f={from:t,to:o}:f={from:o,to:t};else if(o&&s)if(c(o,t)&&c(s,t))i?f={from:o,to:s}:f=void 0;else if(c(o,t))f={from:o,to:n>0?void 0:t};else if(c(s,t))f={from:t,to:n>0?void 0:t};else if(u(t,o))f={from:t,to:s};else if(l(t,o))f={from:o,to:t};else if(l(t,s))f={from:o,to:t};else throw new Error("Invalid range");if(f?.from&&f?.to){const d=a.differenceInCalendarDays(f.to,f.from);r>0&&d>r?f={from:t,to:void 0}:n>1&&d<n&&(f={from:t,to:void 0})}return f}function Lyt(t,e,n=Pd){const r=Array.isArray(e)?e:[e];let i=t.from;const a=n.differenceInCalendarDays(t.to,t.from),o=Math.min(a,6);for(let s=0;s<=o;s++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function RJ(t,e,n=Pd){return B0(t,e.from,!1,n)||B0(t,e.to,!1,n)||B0(e,t.from,!1,n)||B0(e,t.to,!1,n)}function Vyt(t,e,n=Pd){const r=Array.isArray(e)?e:[e];if(r.filter(s=>typeof s!="function").some(s=>typeof s=="boolean"?s:n.isDate(s)?B0(t,s,!1,n):tye(s,n)?s.some(c=>B0(t,c,!1,n)):oU(s)?s.from&&s.to?RJ(t,{from:s.from,to:s.to},n):!1:eye(s)?Lyt(t,s.dayOfWeek,n):Zve(s)?n.isAfter(s.before,s.after)?RJ(t,{from:n.addDays(s.after,1),to:n.addDays(s.before,-1)},n):z0(t.from,s,n)||z0(t.to,s,n):Qve(s)||Jve(s)?z0(t.from,s,n)||z0(t.to,s,n):!1))return!0;const o=r.filter(s=>typeof s=="function");if(o.length){let s=t.from;const c=n.differenceInCalendarDays(t.to,t.from);for(let l=0;l<=c;l++){if(o.some(u=>u(s)))return!0;s=n.addDays(s,1)}}return!1}function $yt(t,e){const{disabled:n,excludeDisabled:r,selected:i,required:a,onSelect:o}=t,[s,c]=EE(i,o?i:void 0),l=o?i:s;return{selected:l,select:(d,h,m)=>{const{min:p,max:y}=t,x=d?Ayt(d,l,p,y,a,e):void 0;return r&&n&&x?.from&&x.to&&Vyt({from:x.from,to:x.to},n,e)&&(x.from=d,x.to=void 0),o||c(x),o?.(x,d,h,m),x},isSelected:d=>l&&B0(l,d,!1,e)}}function jyt(t,e){const{selected:n,required:r,onSelect:i}=t,[a,o]=EE(n,i?n:void 0),s=i?n:a,{isSameDay:c}=e;return{selected:s,select:(f,d,h)=>{let m=f;return!r&&s&&s&&c(f,s)&&(m=void 0),i||o(m),i?.(m,f,d,h),m},isSelected:f=>s?c(s,f):!1}}function Uyt(t,e){const n=jyt(t,e),r=kyt(t,e),i=$yt(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return i;default:return}}function Fyt(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new xs(e.today,e.timeZone)),e.month&&(e.month=new xs(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new xs(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new xs(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new xs(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new xs(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(ct=>new xs(ct,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new xs(e.selected.from,e.timeZone):void 0,to:e.selected.to?new xs(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:i,dateLib:a,locale:o,classNames:s}=D.useMemo(()=>{const ct={...zw,...e.locale};return{dateLib:new Dl({locale:ct,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:Wvt(e.components),formatters:tyt(e.formatters),labels:{...vyt,...e.labels},locale:ct,classNames:{...sU(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:c,mode:l,navLayout:u,numberOfMonths:f=1,onDayBlur:d,onDayClick:h,onDayFocus:m,onDayKeyDown:p,onDayMouseEnter:y,onDayMouseLeave:x,onNextClick:S,onPrevClick:C,showWeekNumber:_,styles:T}=e,{formatCaption:O,formatDay:M,formatMonthDropdown:I,formatWeekNumber:V,formatWeekNumberHeader:k,formatWeekdayName:L,formatYearDropdown:$}=r,W=Ryt(e,a),{days:G,months:oe,navStart:U,navEnd:Y,previousMonth:J,nextMonth:ne,goToMonth:F}=W,ae=zvt(G,e,U,Y,a),{isSelected:re,select:te,selected:ye}=Uyt(e,a)??{},{blur:we,focused:Oe,isFocusTarget:Te,moveFocus:Me,setFocused:be}=Pyt(e,W,ae,re??(()=>!1),a),{labelDayButton:Ye,labelGridcell:ft,labelGrid:je,labelMonthDropdown:It,labelNav:Rt,labelPrevious:cn,labelNext:ln,labelWeekday:en,labelWeekNumber:tr,labelWeekNumberHeader:Ke,labelYearDropdown:ue}=i,B=D.useMemo(()=>iyt(a,e.ISOWeek),[a,e.ISOWeek]),K=l!==void 0||h!==void 0,fe=D.useCallback(()=>{J&&(F(J),C?.(J))},[J,F,C]),ie=D.useCallback(()=>{ne&&(F(ne),S?.(ne))},[F,ne,S]),pe=D.useCallback((ct,kt)=>jt=>{jt.preventDefault(),jt.stopPropagation(),be(ct),te?.(ct.date,kt,jt),h?.(ct.date,kt,jt)},[te,h,be]),Re=D.useCallback((ct,kt)=>jt=>{be(ct),m?.(ct.date,kt,jt)},[m,be]),et=D.useCallback((ct,kt)=>jt=>{we(),d?.(ct.date,kt,jt)},[we,d]),wt=D.useCallback((ct,kt)=>jt=>{const gn={ArrowLeft:[jt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[jt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[jt.shiftKey?"year":"week","after"],ArrowUp:[jt.shiftKey?"year":"week","before"],PageUp:[jt.shiftKey?"year":"month","before"],PageDown:[jt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(gn[jt.key]){jt.preventDefault(),jt.stopPropagation();const[Kn,rn]=gn[jt.key];Me(Kn,rn)}p?.(ct.date,kt,jt)},[Me,p,e.dir]),Pt=D.useCallback((ct,kt)=>jt=>{y?.(ct.date,kt,jt)},[y]),Ln=D.useCallback((ct,kt)=>jt=>{x?.(ct.date,kt,jt)},[x]),Sn=D.useCallback(ct=>kt=>{const jt=Number(kt.target.value),gn=a.setMonth(a.startOfMonth(ct),jt);F(gn)},[a,F]),Sr=D.useCallback(ct=>kt=>{const jt=Number(kt.target.value),gn=a.setYear(a.startOfMonth(ct),jt);F(gn)},[a,F]),{className:hn,style:kn}=D.useMemo(()=>({className:[s[on.Root],e.className].filter(Boolean).join(" "),style:{...T?.[on.Root],...e.style}}),[s,e.className,e.style,T]),Mn=Hvt(e),Ae=D.useRef(null);byt(Ae,!!e.animate,{classNames:s,months:oe,focused:Oe,dateLib:a});const at={dayPickerProps:e,selected:ye,select:te,isSelected:re,months:oe,nextMonth:ne,previousMonth:J,goToMonth:F,getModifiers:ae,components:n,classNames:s,styles:T,labels:i,formatters:r};return Ce.createElement(Xve.Provider,{value:at},Ce.createElement(n.Root,{rootRef:e.animate?Ae:void 0,className:hn,style:kn,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...Mn},Ce.createElement(n.Months,{className:s[on.Months],style:T?.[on.Months]},!e.hideNavigation&&!u&&Ce.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:s[on.Nav],style:T?.[on.Nav],"aria-label":Rt(),onPreviousClick:fe,onNextClick:ie,previousMonth:J,nextMonth:ne}),oe.map((ct,kt)=>Ce.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:s[on.Month],style:T?.[on.Month],key:kt,displayIndex:kt,calendarMonth:ct},u==="around"&&!e.hideNavigation&&kt===0&&Ce.createElement(n.PreviousMonthButton,{type:"button",className:s[on.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":cn(J),onClick:fe,"data-animated-button":e.animate?"true":void 0},Ce.createElement(n.Chevron,{disabled:J?void 0:!0,className:s[on.Chevron],orientation:e.dir==="rtl"?"right":"left"})),Ce.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:s[on.MonthCaption],style:T?.[on.MonthCaption],calendarMonth:ct,displayIndex:kt},c?.startsWith("dropdown")?Ce.createElement(n.DropdownNav,{className:s[on.Dropdowns],style:T?.[on.Dropdowns]},(()=>{const jt=c==="dropdown"||c==="dropdown-months"?Ce.createElement(n.MonthsDropdown,{key:"month",className:s[on.MonthsDropdown],"aria-label":It(),classNames:s,components:n,disabled:!!e.disableNavigation,onChange:Sn(ct.date),options:nyt(ct.date,U,Y,r,a),style:T?.[on.Dropdown],value:a.getMonth(ct.date)}):Ce.createElement("span",{key:"month"},I(ct.date,a)),gn=c==="dropdown"||c==="dropdown-years"?Ce.createElement(n.YearsDropdown,{key:"year",className:s[on.YearsDropdown],"aria-label":ue(a.options),classNames:s,components:n,disabled:!!e.disableNavigation,onChange:Sr(ct.date),options:ayt(U,Y,r,a,!!e.reverseYears),style:T?.[on.Dropdown],value:a.getYear(ct.date)}):Ce.createElement("span",{key:"year"},$(ct.date,a));return a.getMonthYearOrder()==="year-first"?[gn,jt]:[jt,gn]})(),Ce.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},O(ct.date,a.options,a))):Ce.createElement(n.CaptionLabel,{className:s[on.CaptionLabel],role:"status","aria-live":"polite"},O(ct.date,a.options,a))),u==="around"&&!e.hideNavigation&&kt===f-1&&Ce.createElement(n.NextMonthButton,{type:"button",className:s[on.NextMonthButton],tabIndex:ne?void 0:-1,"aria-disabled":ne?void 0:!0,"aria-label":ln(ne),onClick:ie,"data-animated-button":e.animate?"true":void 0},Ce.createElement(n.Chevron,{disabled:ne?void 0:!0,className:s[on.Chevron],orientation:e.dir==="rtl"?"left":"right"})),kt===f-1&&u==="after"&&!e.hideNavigation&&Ce.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:s[on.Nav],style:T?.[on.Nav],"aria-label":Rt(),onPreviousClick:fe,onNextClick:ie,previousMonth:J,nextMonth:ne}),Ce.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":l==="multiple"||l==="range","aria-label":je(ct.date,a.options,a)||void 0,className:s[on.MonthGrid],style:T?.[on.MonthGrid]},!e.hideWeekdays&&Ce.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:s[on.Weekdays],style:T?.[on.Weekdays]},_&&Ce.createElement(n.WeekNumberHeader,{"aria-label":Ke(a.options),className:s[on.WeekNumberHeader],style:T?.[on.WeekNumberHeader],scope:"col"},k()),B.map(jt=>Ce.createElement(n.Weekday,{"aria-label":en(jt,a.options,a),className:s[on.Weekday],key:String(jt),style:T?.[on.Weekday],scope:"col"},L(jt,a.options,a)))),Ce.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:s[on.Weeks],style:T?.[on.Weeks]},ct.weeks.map(jt=>Ce.createElement(n.Week,{className:s[on.Week],key:jt.weekNumber,style:T?.[on.Week],week:jt},_&&Ce.createElement(n.WeekNumber,{week:jt,style:T?.[on.WeekNumber],"aria-label":tr(jt.weekNumber,{locale:o}),className:s[on.WeekNumber],scope:"row",role:"rowheader"},V(jt.weekNumber,a)),jt.days.map(gn=>{const{date:Kn}=gn,rn=ae(gn);if(rn[qi.focused]=!rn.hidden&&!!Oe?.isEqualTo(gn),rn[of.selected]=re?.(Kn)||rn.selected,oU(ye)){const{from:pr,to:wi}=ye;rn[of.range_start]=!!(pr&&wi&&a.isSameDay(Kn,pr)),rn[of.range_end]=!!(pr&&wi&&a.isSameDay(Kn,wi)),rn[of.range_middle]=B0(ye,Kn,!0,a)}const Xt=ryt(rn,T,e.modifiersStyles),Un=Gvt(rn,s,e.modifiersClassNames),Bn=!K&&!rn.hidden?ft(Kn,rn,a.options,a):void 0;return Ce.createElement(n.Day,{key:`${a.format(Kn,"yyyy-MM-dd")}_${a.format(gn.displayMonth,"yyyy-MM")}`,day:gn,modifiers:rn,className:Un.join(" "),style:Xt,role:"gridcell","aria-selected":rn.selected||void 0,"aria-label":Bn,"data-day":a.format(Kn,"yyyy-MM-dd"),"data-month":gn.outside?a.format(Kn,"yyyy-MM"):void 0,"data-selected":rn.selected||void 0,"data-disabled":rn.disabled||void 0,"data-hidden":rn.hidden||void 0,"data-outside":gn.outside||void 0,"data-focused":rn.focused||void 0,"data-today":rn.today||void 0},!rn.hidden&&K?Ce.createElement(n.DayButton,{className:s[on.DayButton],style:T?.[on.DayButton],type:"button",day:gn,modifiers:rn,disabled:rn.disabled||void 0,tabIndex:Te(gn)?0:-1,"aria-label":Ye(Kn,rn,a.options,a),onClick:pe(gn,rn),onBlur:et(gn,rn),onFocus:Re(gn,rn),onKeyDown:wt(gn,rn),onMouseEnter:Pt(gn,rn),onMouseLeave:Ln(gn,rn)},M(Kn,a.options,a)):!rn.hidden&&M(gn.date,a.options,a))})))))))),e.footer&&Ce.createElement(n.Footer,{className:s[on.Footer],style:T?.[on.Footer],role:"status","aria-live":"polite"},e.footer)))}function $g({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:i="ghost",formatters:a,components:o,locale:s,...c}){const l=sU();return w.jsx(Fyt,{showOutsideDays:n,locale:s,className:rt("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:u=>{const f=Ji(u,"MMM",{locale:s});return f.charAt(0).toUpperCase()+f.slice(1)},formatCaption:u=>{const f=Ji(u,"LLLL yyyy",{locale:s});return f.charAt(0).toUpperCase()+f.slice(1)},...a},classNames:{root:rt("w-fit",l.root),months:rt("flex gap-4 flex-col md:flex-row relative",l.months),month:rt("flex flex-col w-full gap-4",l.month),nav:rt("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",l.nav),button_previous:rt(ww({variant:i}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",l.button_previous),button_next:rt(ww({variant:i}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",l.button_next),month_caption:rt("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",l.month_caption),dropdowns:rt("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",l.dropdowns),dropdown_root:rt("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",l.dropdown_root),dropdown:rt("absolute bg-popover inset-0 opacity-0",l.dropdown),caption_label:rt("select-none font-medium",r==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",l.caption_label),table:"w-full border-collapse",weekdays:rt("flex",l.weekdays),weekday:rt("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",l.weekday),week:rt("flex w-full mt-2",l.week),week_number_header:rt("select-none w-(--cell-size)",l.week_number_header),week_number:rt("text-[0.8rem] select-none text-muted-foreground",l.week_number),day:rt("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",l.day),range_start:rt("rounded-l-md bg-accent",l.range_start),range_middle:rt("rounded-none",l.range_middle),range_end:rt("rounded-r-md bg-accent",l.range_end),today:rt("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",l.today),outside:rt("text-muted-foreground aria-selected:text-muted-foreground",l.outside),disabled:rt("text-muted-foreground opacity-50",l.disabled),hidden:rt("invisible",l.hidden),...e},components:{Root:({className:u,rootRef:f,...d})=>w.jsx("div",{"data-slot":"calendar",ref:f,className:rt(u),...d}),Chevron:({className:u,orientation:f,...d})=>f==="left"?w.jsx(aL,{className:rt("size-4",u),...d}):f==="right"?w.jsx(qg,{className:rt("size-4",u),...d}):w.jsx(iL,{className:rt("size-4",u),...d}),DayButton:Byt,WeekNumber:({children:u,...f})=>w.jsx("td",{...f,children:w.jsx("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:u})}),...o},...c})}function Byt({className:t,day:e,modifiers:n,...r}){const i=sU(),a=D.useRef(null);return D.useEffect(()=>{n.focused&&a.current?.focus()},[n.focused]),w.jsx(bt,{ref:a,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:rt("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",i.day,t),...r})}var OE="Popover",[sye]=Uc(OE,[vp]),a3=vp(),[zyt,Cp]=sye(OE),cye=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=t,s=a3(e),c=D.useRef(null),[l,u]=D.useState(!1),[f,d]=xd({prop:r,defaultProp:i??!1,onChange:a,caller:OE});return w.jsx(y8,{...s,children:w.jsx(zyt,{scope:e,contentId:No(),triggerRef:c,open:f,onOpenChange:d,onOpenToggle:D.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:l,onCustomAnchorAdd:D.useCallback(()=>u(!0),[]),onCustomAnchorRemove:D.useCallback(()=>u(!1),[]),modal:o,children:n})})};cye.displayName=OE;var lye="PopoverAnchor",Gyt=D.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Cp(lye,n),a=a3(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return D.useEffect(()=>(o(),()=>s()),[o,s]),w.jsx(kb,{...a,...r,ref:e})});Gyt.displayName=lye;var uye="PopoverTrigger",fye=D.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Cp(uye,n),a=a3(n),o=$n(e,i.triggerRef),s=w.jsx(Yt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":mye(i.open),...r,ref:o,onClick:Et(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:w.jsx(kb,{asChild:!0,...a,children:s})});fye.displayName=uye;var cU="PopoverPortal",[Wyt,Hyt]=sye(cU,{forceMount:void 0}),dye=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,a=Cp(cU,e);return w.jsx(Wyt,{scope:e,forceMount:n,children:w.jsx(Lo,{present:n||a.open,children:w.jsx(f2,{asChild:!0,container:i,children:r})})})};dye.displayName=cU;var jy="PopoverContent",hye=D.forwardRef((t,e)=>{const n=Hyt(jy,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,a=Cp(jy,t.__scopePopover);return w.jsx(Lo,{present:r||a.open,children:a.modal?w.jsx(Kyt,{...i,ref:e}):w.jsx(Yyt,{...i,ref:e})})});hye.displayName=jy;var qyt=Hg("PopoverContent.RemoveScroll"),Kyt=D.forwardRef((t,e)=>{const n=Cp(jy,t.__scopePopover),r=D.useRef(null),i=$n(e,r),a=D.useRef(!1);return D.useEffect(()=>{const o=r.current;if(o)return L6(o)},[]),w.jsx(mb,{as:qyt,allowPinchZoom:!0,children:w.jsx(gye,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Et(t.onCloseAutoFocus,o=>{o.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Et(t.onPointerDownOutside,o=>{const s=o.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0,l=s.button===2||c;a.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:Et(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Yyt=D.forwardRef((t,e)=>{const n=Cp(jy,t.__scopePopover),r=D.useRef(!1),i=D.useRef(!1);return w.jsx(gye,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{t.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||n.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:a=>{t.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;n.triggerRef.current?.contains(o)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),gye=D.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...f}=t,d=Cp(jy,n),h=a3(n);return k6(),w.jsx(pb,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:w.jsx(u2,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>d.onOpenChange(!1),children:w.jsx(x8,{"data-state":mye(d.open),role:"dialog",id:d.contentId,...h,...f,ref:e,style:{...f.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)"}})})})}),pye="PopoverClose",Xyt=D.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Cp(pye,n);return w.jsx(Yt.button,{type:"button",...r,ref:e,onClick:Et(t.onClick,()=>i.onOpenChange(!1))})});Xyt.displayName=pye;var Zyt="PopoverArrow",Qyt=D.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=a3(n);return w.jsx(w8,{...i,...r,ref:e})});Qyt.displayName=Zyt;function mye(t){return t?"open":"closed"}var Jyt=cye,e2t=fye,t2t=dye,n2t=hye;function bl({...t}){return w.jsx(Jyt,{"data-slot":"popover",...t})}function Sl({...t}){return w.jsx(e2t,{"data-slot":"popover-trigger",...t})}function Cl({className:t,align:e="center",sideOffset:n=4,...r}){return w.jsx(t2t,{children:w.jsx(n2t,{"data-slot":"popover-content",align:e,sideOffset:n,className:rt("bg-popover text-popover-foreground 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 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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...r})})}const o3=()=>{const{i18n:t}=Hn();return(()=>{switch(t.language){case"ru":return eU;case"en":return zw;case"vi":return Ymt;default:return zw}})()},r2t=m2({commissioning_date:oy().optional(),warranty_date:oy().optional(),last_service_date:oy().optional(),note:Ra().optional()}),i2t=({open:t,onOpenChange:e,device:n})=>{const{t:r}=Hn("devices"),i=o3(),{updateDeviceAsync:a,isUpdating:o}=Hve(),s=c2({resolver:v2(r2t),defaultValues:{note:""}});D.useEffect(()=>{if(t&&n){const u=f=>f?new Date(f):void 0;s.reset({note:n.info?.note||"",commissioning_date:u(n.info?.commissioning_date),warranty_date:u(n.info?.warranty_date),last_service_date:u(n.info?.last_service_date)})}},[t,n,s]);const c=async u=>{try{const f=d=>d?Ji(d,"yyyy-MM-dd"):"";await a({data:{name:n.name,aetitle:n.aetitle,info:{note:u.note||"",commissioning_date:f(u.commissioning_date),warranty_date:f(u.warranty_date),last_service_date:f(u.last_service_date)}}}),l()}catch(f){console.error(f)}},l=()=>{e(!1)};return w.jsx(dp,{open:t,onOpenChange:l,children:w.jsxs(hp,{className:pS.dialogContent,children:[w.jsxs(gp,{children:[w.jsx(pp,{children:r("note_modal.title")}),w.jsx(z6,{children:r("note_modal.description",{name:n.name,aetitle:n.aetitle})})]}),w.jsx(l2,{...s,children:w.jsxs("form",{className:pS.form,onSubmit:s.handleSubmit(c),children:[w.jsxs("div",{className:pS.grid,children:[w.jsx(xn,{control:s.control,name:"commissioning_date",render:({field:u})=>w.jsxs(wn,{className:"flex flex-col",children:[w.jsx(ir,{children:r("note_modal.fields.commissioning_date")}),w.jsxs(bl,{children:[w.jsx(Sl,{asChild:!0,children:w.jsx(bn,{children:w.jsxs(bt,{variant:"outline",className:rt("w-full pl-3 text-left font-normal",!u.value&&"text-muted-foreground"),children:[u.value?Ji(u.value,"PPP",{locale:i}):w.jsx("span",{children:r("note_modal.placeholders.select_date")}),w.jsx(K0,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),w.jsx(Cl,{className:"w-auto p-0",align:"start",children:w.jsx($g,{mode:"single",selected:u.value,onSelect:u.onChange,disabled:f=>f>new Date||f<new Date("1900-01-01"),locale:i,captionLayout:"dropdown"})})]}),w.jsx(Ig,{})]})}),w.jsx(xn,{control:s.control,name:"warranty_date",render:({field:u})=>w.jsxs(wn,{className:"flex flex-col",children:[w.jsx(ir,{children:r("note_modal.fields.warranty_date")}),w.jsxs(bl,{children:[w.jsx(Sl,{asChild:!0,children:w.jsx(bn,{children:w.jsxs(bt,{variant:"outline",className:rt("w-full pl-3 text-left font-normal",!u.value&&"text-muted-foreground"),children:[u.value?Ji(u.value,"PPP",{locale:i}):w.jsx("span",{children:r("note_modal.placeholders.select_date")}),w.jsx(K0,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),w.jsx(Cl,{className:"w-auto p-0",align:"start",children:w.jsx($g,{mode:"single",selected:u.value,onSelect:u.onChange,locale:i,captionLayout:"dropdown"})})]}),w.jsx(Ig,{})]})}),w.jsx(xn,{control:s.control,name:"last_service_date",render:({field:u})=>w.jsxs(wn,{className:"flex flex-col",children:[w.jsx(ir,{children:r("note_modal.fields.last_maintenance_date")}),w.jsxs(bl,{children:[w.jsx(Sl,{asChild:!0,children:w.jsx(bn,{children:w.jsxs(bt,{variant:"outline",className:rt("w-full pl-3 text-left font-normal",!u.value&&"text-muted-foreground"),children:[u.value?Ji(u.value,"PPP",{locale:i}):w.jsx("span",{children:r("note_modal.placeholders.select_date")}),w.jsx(K0,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),w.jsx(Cl,{className:"w-auto p-0",align:"start",children:w.jsx($g,{mode:"single",selected:u.value,onSelect:u.onChange,disabled:f=>f>new Date,locale:i,captionLayout:"dropdown"})})]}),w.jsx(Ig,{})]})})]}),w.jsx(xn,{control:s.control,name:"note",render:({field:u})=>w.jsxs(wn,{children:[w.jsx(ir,{children:r("note_modal.fields.notes")}),w.jsx(bn,{children:w.jsx(LP,{placeholder:r("note_modal.placeholders.notes_input"),className:"min-h-[150px]",...u})}),w.jsx(Ig,{})]})}),w.jsxs("div",{className:pS.actions,children:[w.jsx(bt,{type:"button",variant:"outline",onClick:l,children:r("settings_modal.buttons.cancel")}),w.jsxs(bt,{disabled:o,type:"submit",children:[o?w.jsx(U6,{className:"h-4 w-4 animate-spin"}):w.jsx(F6,{className:"h-4 w-4"}),r("settings_modal.buttons.save")]})]})]})})]})})},aR=({device:t,variant:e="external",onEdit:n})=>{const r=Yg(h=>h.user),{t:i}=Hn("devices"),a=Sf(),[o,s]=D.useState(!1),c=(h,m)=>{if(!r?.is_admin){h.preventDefault(),Br.error(i("no_access"),{position:"top-center"});return}m()};let l=lL,u=Ht.deviceCard;e==="cami"?(l=B6,u=`${Ht.deviceCard} ${Ht.camiCard}`):e==="default"&&(l=oL,u=`${Ht.deviceCard} ${Ht.externalCard}`);const f=i(e==="cami"?"card.last_study.cami":"card.last_study.default"),d=()=>{const h=new URLSearchParams({aetitle:t.aetitle});a(`${ws.STUDIES}?${h.toString()}`)};return w.jsxs(w.Fragment,{children:[w.jsxs(Oc,{className:u,children:[w.jsx(Jf,{className:Ht.cardHeader,children:w.jsxs("div",{className:Ht.cardTitleContainer,children:[w.jsxs(pg,{className:Ht.cardTitle,children:[w.jsx(l,{className:Ht.icon}),t.name]}),w.jsxs(_8,{children:[w.jsx(T8,{asChild:!0,children:w.jsx(bt,{variant:"ghost",size:"icon",className:Ht.dropdownButton,children:w.jsx(Dse,{className:Ht.moreIcon})})}),w.jsxs(E8,{align:"end",children:[e=="default"&&w.jsxs(w.Fragment,{children:[w.jsxs(Qu,{className:"group cursor-pointer",onClick:d,children:[w.jsx(j$e,{className:"mr-2 h-4 w-4 text-muted-foreground group-focus:text-accent-foreground"}),i("card.view_studies")]}),w.jsx(PN,{})]}),w.jsxs(Qu,{className:"group cursor-pointer",onClick:h=>c(h,()=>n?.(t)),children:[w.jsx(sL,{className:"mr-2 h-4 w-4 text-muted-foreground group-focus:text-accent-foreground"}),i("card.edit")]}),w.jsxs(Qu,{className:"group cursor-pointer",onClick:h=>c(h,()=>s(!0)),children:[w.jsx(Sje,{className:"mr-2 h-4 w-4 text-muted-foreground group-focus:text-accent-foreground"}),i("card.note")]}),e!="cami"&&w.jsxs(w.Fragment,{children:[w.jsx(PN,{}),r?.is_admin?w.jsx(nvt,{deviceName:t.name,aetitle:t.aetitle,children:w.jsxs(Qu,{onSelect:h=>h.preventDefault(),className:"cursor-pointer text-destructive focus:text-destructive focus:bg-destructive/10 dark:focus:bg-destructive/20",children:[w.jsx(Sw,{className:"mr-2 h-4 w-4"}),i("card.delete")]})}):w.jsxs(Qu,{onClick:h=>c(h,()=>{}),className:"cursor-pointer text-destructive focus:text-destructive focus:bg-destructive/10 dark:focus:bg-destructive/20",children:[w.jsx(Sw,{className:"mr-2 h-4 w-4"}),i("card.delete")]})]})]})]})]})}),w.jsxs(Yu,{className:Ht.cardContent,children:[w.jsxs("div",{className:Ht.aeTitle,children:[w.jsx("span",{children:i("card.ae_title")}),w.jsx("p",{children:t.aetitle})]}),e!=="external"&&w.jsxs("div",{className:Ht.lastImageSection,children:[w.jsx(K0,{className:Ht.calendarIcon}),w.jsxs("div",{className:Ht.dateTimeInfo,children:[w.jsx("p",{className:Ht.dateTimeLabel,children:f}),w.jsx("p",{className:Ht.dateTimeValue,children:n3(t.lastStudyDate)})]})]})]})]}),w.jsx(i2t,{open:o,onOpenChange:s,device:t})]})},Fp=({variant:t="default"})=>{let e=Ht.deviceCard,n=lL;return t==="cami"?(n=B6,e=`${Ht.deviceCard} ${Ht.camiCard}`):t==="default"&&(n=oL,e=`${Ht.deviceCard} ${Ht.externalCard}`),w.jsxs(Oc,{className:e,style:{minHeight:"240px"},children:[w.jsx(Jf,{className:Ht.cardHeader,children:w.jsxs("div",{className:Ht.cardTitleContainer,children:[w.jsxs("div",{className:Ht.cardTitle,children:[w.jsx(n,{className:Ht.icon,style:{opacity:.3}}),w.jsx(An,{className:"h-5 w-32"})]}),w.jsx(An,{className:"h-8 w-8 rounded-md"})]})}),w.jsxs(Yu,{className:Ht.cardContent,children:[w.jsxs("div",{className:Ht.aeTitle,children:[w.jsx(An,{className:"h-4 w-20 mb-1"}),w.jsx(An,{className:"h-6 w-full",style:{marginTop:"4px"}})]}),w.jsxs("div",{className:Ht.lastImageSection,children:[w.jsx(An,{className:"h-4 w-4 rounded-sm flex-shrink-0 mt-0.5"}),w.jsxs("div",{className:Ht.dateTimeInfo,children:[w.jsx(An,{className:"h-4 w-28 mb-1"}),w.jsx(An,{className:"h-3 w-40",style:{marginTop:"4px"}})]})]})]})]})},a2t=()=>w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:Ht.section,children:[w.jsxs("div",{className:rt(Ht.sectionHeader,"mt-1"),children:[w.jsx(An,{className:"h-5 w-5 rounded-sm"}),w.jsx(An,{className:"h-6 w-40"})]}),w.jsx("div",{className:Ht.cards,children:w.jsx(Fp,{variant:"cami"})})]}),w.jsxs("div",{className:Ht.section,children:[w.jsxs("div",{className:Ht.sectionHeader,children:[w.jsx(An,{className:"h-5 w-5 rounded-sm"}),w.jsx(An,{className:"h-6 w-48"})]}),w.jsxs("div",{className:Ht.cards,children:[w.jsx(Fp,{variant:"default"}),w.jsx(Fp,{variant:"default"}),w.jsx(Fp,{variant:"default"})]})]}),w.jsxs("div",{className:Ht.section,children:[w.jsxs("div",{className:Ht.sectionHeader,children:[w.jsx(An,{className:"h-5 w-5 rounded-sm"}),w.jsx(An,{className:"h-6 w-52"})]}),w.jsxs("div",{className:Ht.cards,children:[w.jsx(Fp,{variant:"external"}),w.jsx(Fp,{variant:"external"}),w.jsx(Fp,{variant:"external"})]})]})]}),o2t="_container_1kpij_1",s2t={container:o2t},lU=()=>{const[t,e]=D.useState(!1);D.useEffect(()=>{const r=()=>{window.scrollY>300?e(!0):e(!1)};return window.addEventListener("scroll",r,{passive:!0}),()=>{window.removeEventListener("scroll",r)}},[]);const n=()=>{window.scrollTo({top:0,behavior:"smooth"})};return w.jsx(yd,{children:t&&w.jsx(ho.div,{className:s2t.container,initial:{opacity:0,y:100},animate:{opacity:1,y:0},exit:{opacity:0,y:100},transition:{type:"spring",stiffness:260,damping:20},children:w.jsx(ho.div,{animate:{y:[0,-4,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},children:w.jsx(bt,{onClick:n,"aria-label":"Прокрутить к началу страницы",children:w.jsx(o$e,{})})})})})},c2t="_content_223y1_1",l2t="_header_223y1_13",u2t="_form_223y1_25",f2t="_scrollArea_223y1_34",d2t="_formContent_223y1_43",h2t="_section_223y1_50",g2t="_sectionTitle_223y1_56",p2t="_gridSection_223y1_68",m2t="_switchItem_223y1_79",v2t="_switchLabel_223y1_93",y2t="_footer_223y1_113",Rn={content:c2t,header:l2t,form:u2t,scrollArea:f2t,formContent:d2t,section:h2t,sectionTitle:g2t,gridSection:p2t,switchItem:m2t,switchLabel:v2t,footer:y2t};var DE="Switch",[x2t]=Uc(DE),[w2t,b2t]=x2t(DE),vye=D.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c="on",onCheckedChange:l,form:u,...f}=t,[d,h]=D.useState(null),m=$n(e,C=>h(C)),p=D.useRef(!1),y=d?u||!!d.closest("form"):!0,[x,S]=xd({prop:i,defaultProp:a??!1,onChange:l,caller:DE});return w.jsxs(w2t,{scope:n,checked:x,disabled:s,children:[w.jsx(Yt.button,{type:"button",role:"switch","aria-checked":x,"aria-required":o,"data-state":bye(x),"data-disabled":s?"":void 0,disabled:s,value:c,...f,ref:m,onClick:Et(t.onClick,C=>{S(_=>!_),y&&(p.current=C.isPropagationStopped(),p.current||C.stopPropagation())})}),y&&w.jsx(wye,{control:d,bubbles:!p.current,name:r,value:c,checked:x,required:o,disabled:s,form:u,style:{transform:"translateX(-100%)"}})]})});vye.displayName=DE;var yye="SwitchThumb",xye=D.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=b2t(yye,n);return w.jsx(Yt.span,{"data-state":bye(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});xye.displayName=yye;var S2t="SwitchBubbleInput",wye=D.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...i},a)=>{const o=D.useRef(null),s=$n(o,a),c=qj(n),l=a$(e);return D.useEffect(()=>{const u=o.current;if(!u)return;const f=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&h){const m=new Event("click",{bubbles:r});h.call(u,n),u.dispatchEvent(m)}},[c,n,r]),w.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});wye.displayName=S2t;function bye(t){return t?"checked":"unchecked"}var C2t=vye,_2t=xye;function au({className:t,...e}){return w.jsx(C2t,{"data-slot":"switch",className:rt("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:w.jsx(_2t,{"data-slot":"switch-thumb",className:rt("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function T2t(t,e){return D.useReducer((n,r)=>e[n][r]??n,t)}var uU="ScrollArea",[Sye]=Uc(uU),[E2t,Du]=Sye(uU),Cye=D.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:a=600,...o}=t,[s,c]=D.useState(null),[l,u]=D.useState(null),[f,d]=D.useState(null),[h,m]=D.useState(null),[p,y]=D.useState(null),[x,S]=D.useState(0),[C,_]=D.useState(0),[T,O]=D.useState(!1),[M,I]=D.useState(!1),V=$n(e,L=>c(L)),k=h8(i);return w.jsx(E2t,{scope:n,type:r,dir:k,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:f,onContentChange:d,scrollbarX:h,onScrollbarXChange:m,scrollbarXEnabled:T,onScrollbarXEnabledChange:O,scrollbarY:p,onScrollbarYChange:y,scrollbarYEnabled:M,onScrollbarYEnabledChange:I,onCornerWidthChange:S,onCornerHeightChange:_,children:w.jsx(Yt.div,{dir:k,...o,ref:V,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":C+"px",...t.style}})})});Cye.displayName=uU;var _ye="ScrollAreaViewport",Tye=D.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:i,...a}=t,o=Du(_ye,n),s=D.useRef(null),c=$n(e,s,o.onViewportChange);return w.jsxs(w.Fragment,{children:[w.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}),w.jsx(Yt.div,{"data-radix-scroll-area-viewport":"",...a,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:w.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Tye.displayName=_ye;var kd="ScrollAreaScrollbar",Eye=D.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Du(kd,t.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=t.orientation==="horizontal";return D.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type==="hover"?w.jsx(O2t,{...r,ref:e,forceMount:n}):i.type==="scroll"?w.jsx(D2t,{...r,ref:e,forceMount:n}):i.type==="auto"?w.jsx(Oye,{...r,ref:e,forceMount:n}):i.type==="always"?w.jsx(fU,{...r,ref:e}):null});Eye.displayName=kd;var O2t=D.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Du(kd,t.__scopeScrollArea),[a,o]=D.useState(!1);return D.useEffect(()=>{const s=i.scrollArea;let c=0;if(s){const l=()=>{window.clearTimeout(c),o(!0)},u=()=>{c=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return s.addEventListener("pointerenter",l),s.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),s.removeEventListener("pointerenter",l),s.removeEventListener("pointerleave",u)}}},[i.scrollArea,i.scrollHideDelay]),w.jsx(Lo,{present:n||a,children:w.jsx(Oye,{"data-state":a?"visible":"hidden",...r,ref:e})})}),D2t=D.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Du(kd,t.__scopeScrollArea),a=t.orientation==="horizontal",o=RE(()=>c("SCROLL_END"),100),[s,c]=T2t("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 D.useEffect(()=>{if(s==="idle"){const l=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,i.scrollHideDelay,c]),D.useEffect(()=>{const l=i.viewport,u=a?"scrollLeft":"scrollTop";if(l){let f=l[u];const d=()=>{const h=l[u];f!==h&&(c("SCROLL"),o()),f=h};return l.addEventListener("scroll",d),()=>l.removeEventListener("scroll",d)}},[i.viewport,a,c,o]),w.jsx(Lo,{present:n||s!=="hidden",children:w.jsx(fU,{"data-state":s==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Et(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Et(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Oye=D.forwardRef((t,e)=>{const n=Du(kd,t.__scopeScrollArea),{forceMount:r,...i}=t,[a,o]=D.useState(!1),s=t.orientation==="horizontal",c=RE(()=>{if(n.viewport){const l=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?l:u)}},10);return Uy(n.viewport,c),Uy(n.content,c),w.jsx(Lo,{present:r||a,children:w.jsx(fU,{"data-state":a?"visible":"hidden",...i,ref:e})})}),fU=D.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,i=Du(kd,t.__scopeScrollArea),a=D.useRef(null),o=D.useRef(0),[s,c]=D.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Nye(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:d=>a.current=d,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:d=>o.current=d};function f(d,h){return k2t(d,o.current,s,h)}return n==="horizontal"?w.jsx(M2t,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&a.current){const d=i.viewport.scrollLeft,h=IJ(d,s,i.dir);a.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:d=>{i.viewport&&(i.viewport.scrollLeft=d)},onDragScroll:d=>{i.viewport&&(i.viewport.scrollLeft=f(d,i.dir))}}):n==="vertical"?w.jsx(R2t,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&a.current){const d=i.viewport.scrollTop,h=IJ(d,s);a.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:d=>{i.viewport&&(i.viewport.scrollTop=d)},onDragScroll:d=>{i.viewport&&(i.viewport.scrollTop=f(d))}}):null}),M2t=D.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,a=Du(kd,t.__scopeScrollArea),[o,s]=D.useState(),c=D.useRef(null),l=$n(e,c,a.onScrollbarXChange);return D.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),w.jsx(Mye,{"data-orientation":"horizontal",...i,ref:l,sizes:n,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ME(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(a.viewport){const d=a.viewport.scrollLeft+u.deltaX;t.onWheelScroll(d),kye(d,f)&&u.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:ET(o.paddingLeft),paddingEnd:ET(o.paddingRight)}})}})}),R2t=D.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,a=Du(kd,t.__scopeScrollArea),[o,s]=D.useState(),c=D.useRef(null),l=$n(e,c,a.onScrollbarYChange);return D.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),w.jsx(Mye,{"data-orientation":"vertical",...i,ref:l,sizes:n,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ME(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(a.viewport){const d=a.viewport.scrollTop+u.deltaY;t.onWheelScroll(d),kye(d,f)&&u.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:ET(o.paddingTop),paddingEnd:ET(o.paddingBottom)}})}})}),[I2t,Dye]=Sye(kd),Mye=D.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:f,...d}=t,h=Du(kd,n),[m,p]=D.useState(null),y=$n(e,V=>p(V)),x=D.useRef(null),S=D.useRef(""),C=h.viewport,_=r.content-r.viewport,T=es(u),O=es(c),M=RE(f,10);function I(V){if(x.current){const k=V.clientX-x.current.left,L=V.clientY-x.current.top;l({x:k,y:L})}}return D.useEffect(()=>{const V=k=>{const L=k.target;m?.contains(L)&&T(k,_)};return document.addEventListener("wheel",V,{passive:!1}),()=>document.removeEventListener("wheel",V,{passive:!1})},[C,m,_,T]),D.useEffect(O,[r,O]),Uy(m,M),Uy(h.content,M),w.jsx(I2t,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:es(a),onThumbPointerUp:es(o),onThumbPositionChange:O,onThumbPointerDown:es(s),children:w.jsx(Yt.div,{...d,ref:y,style:{position:"absolute",...d.style},onPointerDown:Et(t.onPointerDown,V=>{V.button===0&&(V.target.setPointerCapture(V.pointerId),x.current=m.getBoundingClientRect(),S.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),I(V))}),onPointerMove:Et(t.onPointerMove,I),onPointerUp:Et(t.onPointerUp,V=>{const k=V.target;k.hasPointerCapture(V.pointerId)&&k.releasePointerCapture(V.pointerId),document.body.style.webkitUserSelect=S.current,h.viewport&&(h.viewport.style.scrollBehavior=""),x.current=null})})})}),TT="ScrollAreaThumb",Rye=D.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Dye(TT,t.__scopeScrollArea);return w.jsx(Lo,{present:n||i.hasThumb,children:w.jsx(N2t,{ref:e,...r})})}),N2t=D.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,a=Du(TT,n),o=Dye(TT,n),{onThumbPositionChange:s}=o,c=$n(e,f=>o.onThumbChange(f)),l=D.useRef(void 0),u=RE(()=>{l.current&&(l.current(),l.current=void 0)},100);return D.useEffect(()=>{const f=a.viewport;if(f){const d=()=>{if(u(),!l.current){const h=A2t(f,s);l.current=h,s()}};return s(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[a.viewport,u,s]),w.jsx(Yt.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Et(t.onPointerDownCapture,f=>{const h=f.target.getBoundingClientRect(),m=f.clientX-h.left,p=f.clientY-h.top;o.onThumbPointerDown({x:m,y:p})}),onPointerUp:Et(t.onPointerUp,o.onThumbPointerUp)})});Rye.displayName=TT;var dU="ScrollAreaCorner",Iye=D.forwardRef((t,e)=>{const n=Du(dU,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?w.jsx(P2t,{...t,ref:e}):null});Iye.displayName=dU;var P2t=D.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=Du(dU,n),[a,o]=D.useState(0),[s,c]=D.useState(0),l=!!(a&&s);return Uy(i.scrollbarX,()=>{const u=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(u),c(u)}),Uy(i.scrollbarY,()=>{const u=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(u),o(u)}),l?w.jsx(Yt.div,{...r,ref:e,style:{width:a,height:s,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function ET(t){return t?parseInt(t,10):0}function Nye(t,e){const n=t/e;return isNaN(n)?0:n}function ME(t){const e=Nye(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function k2t(t,e,n,r="ltr"){const i=ME(n),a=i/2,o=e||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,f=r==="ltr"?[0,u]:[u*-1,0];return Pye([c,l],f)(t)}function IJ(t,e,n="ltr"){const r=ME(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=e.scrollbar.size-i,o=e.content-e.viewport,s=a-r,c=n==="ltr"?[0,o]:[o*-1,0],l=DP(t,c);return Pye([0,o],[0,s])(l)}function Pye(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 kye(t,e){return t>0&&t<e}var A2t=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function i(){const a={left:t.scrollLeft,top:t.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&e(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function RE(t,e){const n=es(t),r=D.useRef(0);return D.useEffect(()=>()=>window.clearTimeout(r.current),[]),D.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Uy(t,e){const n=es(e);ko(()=>{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 L2t=Cye,V2t=Tye,$2t=Iye;function Aye({className:t,children:e,...n}){return w.jsxs(L2t,{"data-slot":"scroll-area",className:rt("relative",t),...n,children:[w.jsx(V2t,{"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}),w.jsx(j2t,{}),w.jsx($2t,{})]})}function j2t({className:t,orientation:e="vertical",...n}){return w.jsx(Eye,{"data-slot":"scroll-area-scrollbar",orientation:e,className:rt("flex touch-none p-px transition-colors select-none",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",t),...n,children:w.jsx(Rye,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}var NJ=1,U2t=.9,F2t=.8,B2t=.17,oR=.1,sR=.999,z2t=.9999,G2t=.99,W2t=/[\\\/_+.#"@\[\(\{&]/,H2t=/[\\\/_+.#"@\[\(\{&]/g,q2t=/[\s-]/,Lye=/[\s-]/g;function $P(t,e,n,r,i,a,o){if(a===e.length)return i===t.length?NJ:G2t;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,f,d,h,m;l>=0;)f=$P(t,e,n,r,l+1,a+1,o),f>u&&(l===i?f*=NJ:W2t.test(t.charAt(l-1))?(f*=F2t,h=t.slice(i,l-1).match(H2t),h&&i>0&&(f*=Math.pow(sR,h.length))):q2t.test(t.charAt(l-1))?(f*=U2t,m=t.slice(i,l-1).match(Lye),m&&i>0&&(f*=Math.pow(sR,m.length))):(f*=B2t,i>0&&(f*=Math.pow(sR,l-i))),t.charAt(l)!==e.charAt(a)&&(f*=z2t)),(f<oR&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(d=$P(t,e,n,r,l+1,a+2,o),d*oR>f&&(f=d*oR)),f>u&&(u=f),l=n.indexOf(c,l+1);return o[s]=u,u}function PJ(t){return t.toLowerCase().replace(Lye," ")}function K2t(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,$P(t,e,PJ(t),PJ(e),0,0,{})}var Zx='[cmdk-group=""]',cR='[cmdk-group-items=""]',Y2t='[cmdk-group-heading=""]',Vye='[cmdk-item=""]',kJ=`${Vye}:not([aria-disabled="true"])`,jP="cmdk-item-select",Pv="data-value",X2t=(t,e,n)=>K2t(t,e,n),$ye=D.createContext(void 0),s3=()=>D.useContext($ye),jye=D.createContext(void 0),hU=()=>D.useContext(jye),Uye=D.createContext(void 0),Fye=D.forwardRef((t,e)=>{let n=kv(()=>{var re,te;return{search:"",value:(te=(re=t.value)!=null?re:t.defaultValue)!=null?te:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=kv(()=>new Set),i=kv(()=>new Map),a=kv(()=>new Map),o=kv(()=>new Set),s=Bye(t),{label:c,children:l,value:u,onValueChange:f,filter:d,shouldFilter:h,loop:m,disablePointerSelection:p=!1,vimBindings:y=!0,...x}=t,S=No(),C=No(),_=No(),T=D.useRef(null),O=sxt();a1(()=>{if(u!==void 0){let re=u.trim();n.current.value=re,M.emit()}},[u]),a1(()=>{O(6,W)},[]);let M=D.useMemo(()=>({subscribe:re=>(o.current.add(re),()=>o.current.delete(re)),snapshot:()=>n.current,setState:(re,te,ye)=>{var we,Oe,Te,Me;if(!Object.is(n.current[re],te)){if(n.current[re]=te,re==="search")$(),k(),O(1,L);else if(re==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let be=document.getElementById(_);be?be.focus():(we=document.getElementById(S))==null||we.focus()}if(O(7,()=>{var be;n.current.selectedItemId=(be=G())==null?void 0:be.id,M.emit()}),ye||O(5,W),((Oe=s.current)==null?void 0:Oe.value)!==void 0){let be=te??"";(Me=(Te=s.current).onValueChange)==null||Me.call(Te,be);return}}M.emit()}},emit:()=>{o.current.forEach(re=>re())}}),[]),I=D.useMemo(()=>({value:(re,te,ye)=>{var we;te!==((we=a.current.get(re))==null?void 0:we.value)&&(a.current.set(re,{value:te,keywords:ye}),n.current.filtered.items.set(re,V(te,ye)),O(2,()=>{k(),M.emit()}))},item:(re,te)=>(r.current.add(re),te&&(i.current.has(te)?i.current.get(te).add(re):i.current.set(te,new Set([re]))),O(3,()=>{$(),k(),n.current.value||L(),M.emit()}),()=>{a.current.delete(re),r.current.delete(re),n.current.filtered.items.delete(re);let ye=G();O(4,()=>{$(),ye?.getAttribute("id")===re&&L(),M.emit()})}),group:re=>(i.current.has(re)||i.current.set(re,new Set),()=>{a.current.delete(re),i.current.delete(re)}),filter:()=>s.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:S,inputId:_,labelId:C,listInnerRef:T}),[]);function V(re,te){var ye,we;let Oe=(we=(ye=s.current)==null?void 0:ye.filter)!=null?we:X2t;return re?Oe(re,n.current.search,te):0}function k(){if(!n.current.search||s.current.shouldFilter===!1)return;let re=n.current.filtered.items,te=[];n.current.filtered.groups.forEach(we=>{let Oe=i.current.get(we),Te=0;Oe.forEach(Me=>{let be=re.get(Me);Te=Math.max(be,Te)}),te.push([we,Te])});let ye=T.current;oe().sort((we,Oe)=>{var Te,Me;let be=we.getAttribute("id"),Ye=Oe.getAttribute("id");return((Te=re.get(Ye))!=null?Te:0)-((Me=re.get(be))!=null?Me:0)}).forEach(we=>{let Oe=we.closest(cR);Oe?Oe.appendChild(we.parentElement===Oe?we:we.closest(`${cR} > *`)):ye.appendChild(we.parentElement===ye?we:we.closest(`${cR} > *`))}),te.sort((we,Oe)=>Oe[1]-we[1]).forEach(we=>{var Oe;let Te=(Oe=T.current)==null?void 0:Oe.querySelector(`${Zx}[${Pv}="${encodeURIComponent(we[0])}"]`);Te?.parentElement.appendChild(Te)})}function L(){let re=oe().find(ye=>ye.getAttribute("aria-disabled")!=="true"),te=re?.getAttribute(Pv);M.setState("value",te||void 0)}function $(){var re,te,ye,we;if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let Oe=0;for(let Te of r.current){let Me=(te=(re=a.current.get(Te))==null?void 0:re.value)!=null?te:"",be=(we=(ye=a.current.get(Te))==null?void 0:ye.keywords)!=null?we:[],Ye=V(Me,be);n.current.filtered.items.set(Te,Ye),Ye>0&&Oe++}for(let[Te,Me]of i.current)for(let be of Me)if(n.current.filtered.items.get(be)>0){n.current.filtered.groups.add(Te);break}n.current.filtered.count=Oe}function W(){var re,te,ye;let we=G();we&&(((re=we.parentElement)==null?void 0:re.firstChild)===we&&((ye=(te=we.closest(Zx))==null?void 0:te.querySelector(Y2t))==null||ye.scrollIntoView({block:"nearest"})),we.scrollIntoView({block:"nearest"}))}function G(){var re;return(re=T.current)==null?void 0:re.querySelector(`${Vye}[aria-selected="true"]`)}function oe(){var re;return Array.from(((re=T.current)==null?void 0:re.querySelectorAll(kJ))||[])}function U(re){let te=oe()[re];te&&M.setState("value",te.getAttribute(Pv))}function Y(re){var te;let ye=G(),we=oe(),Oe=we.findIndex(Me=>Me===ye),Te=we[Oe+re];(te=s.current)!=null&&te.loop&&(Te=Oe+re<0?we[we.length-1]:Oe+re===we.length?we[0]:we[Oe+re]),Te&&M.setState("value",Te.getAttribute(Pv))}function J(re){let te=G(),ye=te?.closest(Zx),we;for(;ye&&!we;)ye=re>0?axt(ye,Zx):oxt(ye,Zx),we=ye?.querySelector(kJ);we?M.setState("value",we.getAttribute(Pv)):Y(re)}let ne=()=>U(oe().length-1),F=re=>{re.preventDefault(),re.metaKey?ne():re.altKey?J(1):Y(1)},ae=re=>{re.preventDefault(),re.metaKey?U(0):re.altKey?J(-1):Y(-1)};return D.createElement(Yt.div,{ref:e,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:re=>{var te;(te=x.onKeyDown)==null||te.call(x,re);let ye=re.nativeEvent.isComposing||re.keyCode===229;if(!(re.defaultPrevented||ye))switch(re.key){case"n":case"j":{y&&re.ctrlKey&&F(re);break}case"ArrowDown":{F(re);break}case"p":case"k":{y&&re.ctrlKey&&ae(re);break}case"ArrowUp":{ae(re);break}case"Home":{re.preventDefault(),U(0);break}case"End":{re.preventDefault(),ne();break}case"Enter":{re.preventDefault();let we=G();if(we){let Oe=new Event(jP);we.dispatchEvent(Oe)}}}}},D.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:lxt},c),IE(t,re=>D.createElement(jye.Provider,{value:M},D.createElement($ye.Provider,{value:I},re))))}),Z2t=D.forwardRef((t,e)=>{var n,r;let i=No(),a=D.useRef(null),o=D.useContext(Uye),s=s3(),c=Bye(t),l=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:o?.forceMount;a1(()=>{if(!l)return s.item(i,o?.id)},[l]);let u=zye(i,a,[t.value,t.children,a],t.keywords),f=hU(),d=rp(O=>O.value&&O.value===u.current),h=rp(O=>l||s.filter()===!1?!0:O.search?O.filtered.items.get(i)>0:!0);D.useEffect(()=>{let O=a.current;if(!(!O||t.disabled))return O.addEventListener(jP,m),()=>O.removeEventListener(jP,m)},[h,t.onSelect,t.disabled]);function m(){var O,M;p(),(M=(O=c.current).onSelect)==null||M.call(O,u.current)}function p(){f.setState("value",u.current,!0)}if(!h)return null;let{disabled:y,value:x,onSelect:S,forceMount:C,keywords:_,...T}=t;return D.createElement(Yt.div,{ref:uh(a,e),...T,id:i,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!d,"data-disabled":!!y,"data-selected":!!d,onPointerMove:y||s.getDisablePointerSelection()?void 0:p,onClick:y?void 0:m},t.children)}),Q2t=D.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...a}=t,o=No(),s=D.useRef(null),c=D.useRef(null),l=No(),u=s3(),f=rp(h=>i||u.filter()===!1?!0:h.search?h.filtered.groups.has(o):!0);a1(()=>u.group(o),[]),zye(o,s,[t.value,t.heading,c]);let d=D.useMemo(()=>({id:o,forceMount:i}),[i]);return D.createElement(Yt.div,{ref:uh(s,e),...a,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&D.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:l},n),IE(t,h=>D.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?l:void 0},D.createElement(Uye.Provider,{value:d},h))))}),J2t=D.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=D.useRef(null),a=rp(o=>!o.search);return!n&&!a?null:D.createElement(Yt.div,{ref:uh(i,e),...r,"cmdk-separator":"",role:"separator"})}),ext=D.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,a=hU(),o=rp(l=>l.search),s=rp(l=>l.selectedItemId),c=s3();return D.useEffect(()=>{t.value!=null&&a.setState("search",t.value)},[t.value]),D.createElement(Yt.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:"text",value:i?t.value:o,onChange:l=>{i||a.setState("search",l.target.value),n?.(l.target.value)}})}),txt=D.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,a=D.useRef(null),o=D.useRef(null),s=rp(l=>l.selectedItemId),c=s3();return D.useEffect(()=>{if(o.current&&a.current){let l=o.current,u=a.current,f,d=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let h=l.offsetHeight;u.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return d.observe(l),()=>{cancelAnimationFrame(f),d.unobserve(l)}}},[]),D.createElement(Yt.div,{ref:uh(a,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},IE(t,l=>D.createElement("div",{ref:uh(o,c.listInnerRef),"cmdk-list-sizer":""},l)))}),nxt=D.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=t;return D.createElement(QA,{open:n,onOpenChange:r},D.createElement(JA,{container:o},D.createElement(eL,{"cmdk-overlay":"",className:i}),D.createElement(tL,{"aria-label":t.label,"cmdk-dialog":"",className:a},D.createElement(Fye,{ref:e,...s}))))}),rxt=D.forwardRef((t,e)=>rp(n=>n.filtered.count===0)?D.createElement(Yt.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),ixt=D.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...a}=t;return D.createElement(Yt.div,{ref:e,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},IE(t,o=>D.createElement("div",{"aria-hidden":!0},o)))}),R2=Object.assign(Fye,{List:txt,Item:Z2t,Input:ext,Group:Q2t,Separator:J2t,Dialog:nxt,Empty:rxt,Loading:ixt});function axt(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function oxt(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function Bye(t){let e=D.useRef(t);return a1(()=>{e.current=t}),e}var a1=typeof window>"u"?D.useEffect:D.useLayoutEffect;function kv(t){let e=D.useRef();return e.current===void 0&&(e.current=t()),e}function rp(t){let e=hU(),n=()=>t(e.snapshot());return D.useSyncExternalStore(e.subscribe,n,n)}function zye(t,e,n,r=[]){let i=D.useRef(),a=s3();return a1(()=>{var o;let s=(()=>{var l;for(let u of n){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(l=u.current.textContent)==null?void 0:l.trim():i.current}})(),c=r.map(l=>l.trim());a.value(t,s,c),(o=e.current)==null||o.setAttribute(Pv,s),i.current=s}),i}var sxt=()=>{let[t,e]=D.useState(),n=kv(()=>new Map);return a1(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function cxt(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function IE({asChild:t,children:e},n){return t&&D.isValidElement(e)?D.cloneElement(cxt(e),{ref:e.ref},n(e.props.children)):n(e)}var lxt={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function uxt({className:t,...e}){return w.jsx(R2,{"data-slot":"command",className:rt("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...e})}function fxt({className:t,...e}){return w.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[w.jsx(d2,{className:"size-4 shrink-0 opacity-50"}),w.jsx(R2.Input,{"data-slot":"command-input",className:rt("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),...e})]})}function dxt({className:t,...e}){return w.jsx(R2.List,{"data-slot":"command-list",className:rt("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...e})}function hxt({...t}){return w.jsx(R2.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function gxt({className:t,...e}){return w.jsx(R2.Group,{"data-slot":"command-group",className:rt("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),...e})}function pxt({className:t,...e}){return w.jsx(R2.Item,{"data-slot":"command-item",className:rt("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...e})}const gU=(t,e,n)=>{D.useEffect(()=>{if(!t)return;const r=(i,a="")=>{for(const o in i)if(i[o]?.message){const s=i[o].message,c=a==="customer."?"":a;Br.error(`${c}${s}`,{position:"top-right"})}else typeof i[o]=="object"&&r(i[o],`${a?`${a} `:""}`)};r(e),n(!1)},[t,e,n])},mxt="_mappingContainer_118xh_1",vxt="_mappingRow_118xh_10",AJ={mappingContainer:mxt,mappingRow:vxt},LJ=({control:t,name:e,label:n,description:r,placeholderKey:i,placeholderValue:a})=>{const{t:o}=Hn("devices"),{fields:s,append:c,remove:l}=vLe({control:t,name:e});return w.jsxs("div",{className:AJ.mappingContainer,children:[w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsx(ir,{children:n}),w.jsx(x0,{children:r})]}),w.jsx("div",{className:"flex flex-col gap-2",children:s.map((u,f)=>w.jsxs("div",{className:AJ.mappingRow,children:[w.jsx(xn,{control:t,name:`${e}.${f}.key`,render:({field:d})=>w.jsx(wn,{children:w.jsx(bn,{children:w.jsx(Ar,{placeholder:i,...d})})})}),w.jsx(xn,{control:t,name:`${e}.${f}.value`,render:({field:d})=>w.jsx(wn,{children:w.jsx(bn,{children:w.jsx(Ar,{placeholder:a,...d})})})}),w.jsx(bt,{variant:"ghost",size:"icon",type:"button",onClick:()=>l(f),className:"mt-[2px]",children:w.jsx(Sw,{className:"h-4 w-4 text-destructive"})})]},u.id))}),w.jsxs(bt,{variant:"outline",size:"sm",className:"w-fit mt-2",type:"button",onClick:()=>c({key:"",value:""}),children:[w.jsx(bw,{className:"mr-2 h-4 w-4"})," ",o("settings_modal.buttons.add_rule")]})]})},yxt=t=>{const e=Dr.object({key:Dr.string().min(1,t("settings_modal.validation.key_required")),value:Dr.string().min(1,t("settings_modal.validation.value_required"))});return Dr.object({name:Dr.string().min(1,t("settings_modal.validation.name_required")),host:Dr.string().min(1,t("settings_modal.validation.host_required")),port:Dr.number().int().min(1).max(65535),aetitle:Dr.string().min(1,t("settings_modal.validation.aet_required")),isSource:Dr.boolean(),pacsaetitle:Dr.string().optional(),autoroute:Dr.array(Dr.string()).optional(),encoding:Dr.string().optional(),translit:Dr.boolean(),translitLang:Dr.string().optional(),uppercase:Dr.boolean(),wlEncoding:Dr.string().optional(),modalityTag:Dr.string().optional(),generateStudyUID:Dr.boolean(),ignoreActionName:Dr.boolean(),wlFullName:Dr.boolean(),wlShortName2:Dr.boolean(),createStepID:Dr.boolean(),fillEmptyStudyDate:Dr.boolean(),mergeByAccessionNumber:Dr.boolean(),property_separator:Dr.string(),roundSRValues:Dr.number().int().min(0),electronSR:Dr.boolean(),accessionWorkaround:Dr.string(),snilsAsId:Dr.boolean(),srTags:Dr.array(e).optional(),saveTags:Dr.array(e).optional()})},lR={name:"",host:"",port:104,aetitle:"",isSource:!1,pacsaetitle:"",autoroute:[],encoding:"",translit:!1,translitLang:"ru",uppercase:!1,wlEncoding:"",modalityTag:"",generateStudyUID:!1,ignoreActionName:!1,wlFullName:!1,wlShortName2:!1,createStepID:!0,fillEmptyStudyDate:!1,mergeByAccessionNumber:!0,property_separator:`
`,roundSRValues:1,electronSR:!1,accessionWorkaround:"",snilsAsId:!1,srTags:[],saveTags:[]},xxt=({isOpen:t,onClose:e,devices:n,initialData:r})=>{const{t:i}=Hn("devices"),{createDeviceAsync:a,isCreating:o}=evt(),{updateDeviceAsync:s,isUpdating:c}=Hve(),l=!!r,u=o||c,f=yxt(i),d=c2({resolver:v2(f),defaultValues:lR,mode:"onBlur"}),{isDirty:h,dirtyFields:m}=d.formState;D.useEffect(()=>{if(t)if(r){const _=Object.entries(r.srTags||{}).map(([O,M])=>({key:O,value:M})),T=Object.entries(r.saveTags||{}).map(([O,M])=>({key:O,value:M}));d.reset({...lR,...r,srTags:_,saveTags:T,pacsaetitle:r.pacsaetitle||"",autoroute:r.autoroute||[],encoding:r.encoding||"",wlEncoding:r.wlEncoding||"",modalityTag:r.modalityTag||"",translitLang:r.translitLang||"ru"})}else d.reset(lR)},[t,r,d]);const[p,y]=D.useState(!1),{errors:x}=d.formState;gU(p,x,y);const S=async _=>{const T=O=>O?.reduce((M,I)=>({...M,[I.key]:I.value}),{})||{};try{if(l){const O={};Object.keys(m).forEach(M=>{M==="srTags"||M==="saveTags"||(O[M]=_[M])}),m.srTags&&(O.srTags=T(_.srTags)),m.saveTags&&(O.saveTags=T(_.saveTags)),O.name=_.name,O.aetitle=_.aetitle,await s({data:O})}else{const O={..._,additionalTags:[],lastStudyDate:null,srTags:T(_.srTags),saveTags:T(_.saveTags)};await a(O)}d.reset(),e()}catch(O){console.log("Ошибка при создании:",O)}},C=d.handleSubmit(S,()=>{y(!0)});return w.jsx(dp,{open:t,onOpenChange:e,children:w.jsxs(hp,{className:Rn.content,children:[w.jsx(gp,{className:Rn.header,children:w.jsx(pp,{children:l?i("settings_modal.edit_title",{name:r.name}):i("settings_modal.create_title")})}),w.jsx(l2,{...d,children:w.jsxs("form",{onSubmit:C,className:Rn.form,children:[w.jsx(Aye,{className:Rn.scrollArea,children:w.jsxs("div",{className:Rn.formContent,children:[w.jsxs("div",{className:Rn.section,children:[w.jsxs("div",{className:Rn.sectionTitle,children:[w.jsx(wje,{className:"w-5 h-5 text-primary"}),i("settings_modal.sections.main")]}),w.jsxs("div",{className:Rn.gridSection,children:[w.jsx(xn,{control:d.control,name:"name",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.fields.name")}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:i("settings_modal.placeholders.name"),..._,disabled:l})})]})}),w.jsx(xn,{control:d.control,name:"aetitle",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.fields.aetitle")}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:i("settings_modal.placeholders.aetitle"),..._})})]})}),w.jsx(xn,{control:d.control,name:"host",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.fields.host")}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:i("settings_modal.placeholders.host"),..._})})]})}),w.jsx(xn,{control:d.control,name:"port",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.fields.port")}),w.jsx(bn,{children:w.jsx(Ar,{type:"number",placeholder:i("settings_modal.placeholders.port"),..._,onChange:T=>_.onChange(Number(T.target.value))})})]})})]}),w.jsxs("div",{className:Rn.gridSection,children:[w.jsx(xn,{control:d.control,name:"pacsaetitle",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.fields.pacsaetitle")}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:i("settings_modal.placeholders.pacsaetitle"),..._})}),w.jsx(x0,{children:i("settings_modal.descriptions.pacsaetitle")})]})}),w.jsx(xn,{control:d.control,name:"autoroute",render:({field:_})=>w.jsxs(wn,{className:"flex flex-col",children:[w.jsx(ir,{children:i("settings_modal.fields.autoroute")}),w.jsxs(bl,{modal:!0,children:[w.jsx(Sl,{asChild:!0,children:w.jsx(bn,{children:w.jsxs(bt,{variant:"outline",role:"combobox",className:rt("w-full justify-between",!_.value?.length&&"text-muted-foreground"),children:[_.value&&_.value.length>0?i("settings_modal.autoroute.selected",{count:_.value.length}):i("settings_modal.placeholders.autoroute"),w.jsx(Ese,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),w.jsx(Cl,{className:"w-[400px] p-0",align:"start",children:w.jsxs(uxt,{children:[w.jsx(fxt,{placeholder:i("settings_modal.placeholders.search")}),w.jsxs(dxt,{className:"max-h-[400px] overflow-y-auto",children:[w.jsx(hxt,{children:i("settings_modal.autoroute.empty")}),w.jsx(gxt,{children:n.map(T=>{const O=_.value?.includes(T.aetitle);return w.jsxs(pxt,{value:T.name,onSelect:()=>{const M=_.value||[];let I;O?I=M.filter(V=>V!==T.aetitle):I=[...M,T.aetitle],_.onChange(I)},children:[w.jsx($6,{className:rt("mr-2 h-4 w-4",O?"opacity-100":"opacity-0")}),w.jsxs("div",{className:"flex flex-col",children:[w.jsx("span",{children:T.name}),w.jsx("span",{className:"text-xs text-muted-foreground",children:T.aetitle})]})]},T.name)})})]})]})})]}),w.jsx(x0,{children:i("settings_modal.descriptions.autoroute")})]})})]}),w.jsx(xn,{control:d.control,name:"isSource",render:({field:_})=>w.jsxs(wn,{className:Rn.switchItem,children:[w.jsx("div",{className:Rn.switchLabel,children:w.jsx("span",{className:"label",children:i("settings_modal.switch.isSource")})}),w.jsx(bn,{children:w.jsx(au,{checked:_.value,onCheckedChange:_.onChange})})]})})]}),w.jsxs("div",{className:Rn.section,children:[w.jsxs("div",{className:Rn.sectionTitle,children:[w.jsx(nUe,{className:"w-5 h-5 text-primary"}),i("settings_modal.sections.encoding")]}),w.jsxs("div",{className:Rn.gridSection,children:[w.jsx(xn,{control:d.control,name:"encoding",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.fields.encoding")}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:i("settings_modal.placeholders.encoding"),..._})})]})}),w.jsx(xn,{control:d.control,name:"translitLang",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.fields.translitLang")}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:i("settings_modal.placeholders.translitLang"),..._})})]})})]}),w.jsxs("div",{className:Rn.gridSection,children:[w.jsx(xn,{control:d.control,name:"translit",render:({field:_})=>w.jsxs(wn,{className:Rn.switchItem,children:[w.jsxs("div",{className:Rn.switchLabel,children:[w.jsx("span",{className:"label",children:i("settings_modal.switch.translit")}),w.jsx("span",{className:"desc",children:i("settings_modal.switch.translit_desc")})]}),w.jsx(bn,{children:w.jsx(au,{checked:_.value,onCheckedChange:_.onChange})})]})}),w.jsx(xn,{control:d.control,name:"uppercase",render:({field:_})=>w.jsxs(wn,{className:Rn.switchItem,children:[w.jsxs("div",{className:Rn.switchLabel,children:[w.jsx("span",{className:"label",children:i("settings_modal.switch.uppercase")}),w.jsx("span",{className:"desc",children:i("settings_modal.switch.uppercase_desc")})]}),w.jsx(bn,{children:w.jsx(au,{checked:_.value,onCheckedChange:_.onChange})})]})})]})]}),w.jsxs("div",{className:Rn.section,children:[w.jsxs("div",{className:Rn.sectionTitle,children:[w.jsx(Ise,{className:"w-5 h-5 text-primary"}),i("settings_modal.sections.worklist")]}),w.jsxs("div",{className:Rn.gridSection,children:[w.jsx(xn,{control:d.control,name:"wlEncoding",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.fields.wlEncoding")}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:i("settings_modal.placeholders.wlEncoding"),..._})}),w.jsx(x0,{children:i("settings_modal.descriptions.wlEncoding")})]})}),w.jsx(xn,{control:d.control,name:"modalityTag",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.fields.modalityTag")}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:i("settings_modal.placeholders.modalityTag"),..._})}),w.jsx(x0,{children:i("settings_modal.descriptions.modalityTag")})]})})]}),w.jsxs("div",{className:Rn.gridSection,children:[w.jsx(xn,{control:d.control,name:"generateStudyUID",render:({field:_})=>w.jsxs(wn,{className:Rn.switchItem,children:[w.jsxs("div",{className:Rn.switchLabel,children:[w.jsx("span",{className:"label",children:i("settings_modal.switch.generateStudyUID")}),w.jsx("span",{className:"desc",children:i("settings_modal.switch.generateStudyUID_desc")})]}),w.jsx(bn,{children:w.jsx(au,{checked:_.value,onCheckedChange:_.onChange})})]})}),w.jsx(xn,{control:d.control,name:"ignoreActionName",render:({field:_})=>w.jsxs(wn,{className:Rn.switchItem,children:[w.jsxs("div",{className:Rn.switchLabel,children:[w.jsx("span",{className:"label",children:i("settings_modal.switch.ignoreActionName")}),w.jsx("span",{className:"desc",children:i("settings_modal.switch.ignoreActionName_desc")})]}),w.jsx(bn,{children:w.jsx(au,{checked:_.value,onCheckedChange:_.onChange})})]})}),w.jsx(xn,{control:d.control,name:"wlFullName",render:({field:_})=>w.jsxs(wn,{className:Rn.switchItem,children:[w.jsxs("div",{className:Rn.switchLabel,children:[w.jsx("span",{className:"label",children:i("settings_modal.switch.wlFullName")}),w.jsx("span",{className:"desc",children:i("settings_modal.switch.wlFullName_desc")})]}),w.jsx(bn,{children:w.jsx(au,{checked:_.value,onCheckedChange:_.onChange})})]})}),w.jsx(xn,{control:d.control,name:"wlShortName2",render:({field:_})=>w.jsxs(wn,{className:Rn.switchItem,children:[w.jsxs("div",{className:Rn.switchLabel,children:[w.jsx("span",{className:"label",children:i("settings_modal.switch.wlShortName2")}),w.jsx("span",{className:"desc",children:i("settings_modal.switch.wlShortName2_desc")})]}),w.jsx(bn,{children:w.jsx(au,{checked:_.value,onCheckedChange:_.onChange})})]})})]})]}),w.jsxs("div",{className:Rn.section,children:[w.jsxs("div",{className:Rn.sectionTitle,children:[w.jsx(Gje,{className:"w-5 h-5 text-primary"}),i("settings_modal.sections.logic")]}),w.jsxs("div",{className:Rn.gridSection,children:[w.jsx(xn,{control:d.control,name:"roundSRValues",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.fields.roundSRValues")}),w.jsx(bn,{children:w.jsx(Ar,{type:"number",placeholder:i("settings_modal.placeholders.roundSRValues"),..._,onChange:T=>_.onChange(Number(T.target.value))})}),w.jsx(x0,{children:i("settings_modal.descriptions.roundSRValues")})]})}),w.jsx(xn,{control:d.control,name:"property_separator",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.fields.property_separator")}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:i("settings_modal.placeholders.property_separator"),..._})}),w.jsx(x0,{children:i("settings_modal.descriptions.property_separator")})]})})]}),w.jsxs("div",{className:Rn.gridSection,children:[w.jsx(xn,{control:d.control,name:"mergeByAccessionNumber",render:({field:_})=>w.jsxs(wn,{className:Rn.switchItem,children:[w.jsxs("div",{className:Rn.switchLabel,children:[w.jsx("span",{className:"label",children:i("settings_modal.switch.mergeByAccessionNumber")}),w.jsx("span",{className:"desc",children:i("settings_modal.switch.mergeByAccessionNumber_desc")})]}),w.jsx(bn,{children:w.jsx(au,{checked:_.value,onCheckedChange:_.onChange})})]})}),w.jsx(xn,{control:d.control,name:"snilsAsId",render:({field:_})=>w.jsxs(wn,{className:Rn.switchItem,children:[w.jsxs("div",{className:Rn.switchLabel,children:[w.jsx("span",{className:"label",children:i("settings_modal.switch.snilsAsId")}),w.jsx("span",{className:"desc",children:i("settings_modal.switch.snilsAsId_desc")})]}),w.jsx(bn,{children:w.jsx(au,{checked:_.value,onCheckedChange:_.onChange})})]})}),w.jsx(xn,{control:d.control,name:"fillEmptyStudyDate",render:({field:_})=>w.jsxs(wn,{className:Rn.switchItem,children:[w.jsxs("div",{className:Rn.switchLabel,children:[w.jsx("span",{className:"label",children:i("settings_modal.switch.fillEmptyStudyDate")}),w.jsx("span",{className:"desc",children:i("settings_modal.switch.fillEmptyStudyDate_desc")})]}),w.jsx(bn,{children:w.jsx(au,{checked:_.value,onCheckedChange:_.onChange})})]})}),w.jsx(xn,{control:d.control,name:"electronSR",render:({field:_})=>w.jsxs(wn,{className:Rn.switchItem,children:[w.jsxs("div",{className:Rn.switchLabel,children:[w.jsx("span",{className:"label",children:i("settings_modal.switch.electronSR")}),w.jsx("span",{className:"desc",children:i("settings_modal.switch.electronSR_desc")})]}),w.jsx(bn,{children:w.jsx(au,{checked:_.value,onCheckedChange:_.onChange})})]})}),w.jsx(xn,{control:d.control,name:"accessionWorkaround",render:({field:_})=>w.jsxs(wn,{children:[w.jsx(ir,{children:i("settings_modal.switch.accessionWorkaround")}),w.jsx(bn,{children:w.jsx(Ar,{type:"string",..._})}),w.jsx(x0,{children:i("settings_modal.switch.accessionWorkaround_desc")})]})})]})]}),w.jsxs("div",{className:Rn.section,children:[w.jsxs("div",{className:Rn.sectionTitle,children:[w.jsx(I$e,{className:"w-5 h-5 text-primary"}),i("settings_modal.sections.mapping")]}),w.jsx(LJ,{control:d.control,name:"srTags",label:i("settings_modal.mapping.srTags"),description:i("settings_modal.mapping.srTags_desc"),placeholderKey:i("settings_modal.placeholders.mapping_key"),placeholderValue:i("settings_modal.placeholders.mapping_value")}),w.jsx(LJ,{control:d.control,name:"saveTags",label:i("settings_modal.mapping.saveTags"),description:i("settings_modal.mapping.saveTags_desc"),placeholderKey:"0010,0010",placeholderValue:"patient_name"})]})]})}),w.jsxs("div",{className:Rn.footer,children:[w.jsx(bt,{variant:"outline",type:"button",onClick:e,children:i("settings_modal.buttons.cancel")}),w.jsxs(bt,{type:"submit",disabled:u||l&&!h,children:[u?w.jsx(U6,{className:"mr-2 h-4 w-4 animate-spin"}):l?w.jsx(sL,{className:"mr-2 h-4 w-4"}):w.jsx(F6,{className:"mr-2 h-4 w-4"}),i(l?"settings_modal.buttons.update":"settings_modal.buttons.save")]})]})]})})]})})},wxt=()=>{const t=Yg(y=>y.user),{t:e}=Hn("devices"),{devices:n=[],camiDevice:r,regularDevices:i,externalDevices:a,isDeviceLoading:o,isDeviceError:s,refetch:c}=aU(),[l,u]=D.useState(!1),[f,d]=D.useState(null),h=()=>{if(!t?.is_admin){Br.error(e("no_access"),{position:"top-center"});return}d(null),u(!0)},m=y=>{d(y),u(!0)},p=()=>{u(!1),setTimeout(()=>d(null),300)};return s?w.jsx("div",{className:Ht.errorContainer,children:w.jsx(e3,{variant:"card",description:e("errors.description"),onRetry:c})}):w.jsxs("div",{className:Ht.container,children:[w.jsxs("div",{className:Ht.headerSection,children:[w.jsxs("div",{children:[w.jsx("h1",{className:Ht.title,children:e("title")}),w.jsx("p",{className:Ht.description,children:e("description")})]}),w.jsxs("div",{className:Ht.headerActions,children:[w.jsx("div",{className:Ht.badgeContainer,children:w.jsxs("span",{children:[e("total_devices")," ",o?"...":n.length]})}),w.jsxs(bt,{onClick:h,children:[w.jsx(bw,{className:"h-4 w-4"}),e("create_button")]})]})]}),o?w.jsx(a2t,{}):w.jsxs(w.Fragment,{children:[r&&w.jsxs("div",{className:Ht.section,children:[w.jsxs("div",{className:Ht.sectionHeader,children:[w.jsx(B6,{className:Ht.sectionIcon}),w.jsx("h2",{className:Ht.sectionTitle,children:e("sections.cami")})]}),w.jsx("div",{className:Ht.cards,children:w.jsx(aR,{device:r,variant:"cami",onEdit:m})})]}),i.length>0&&w.jsxs("div",{className:Ht.section,children:[w.jsxs("div",{className:Ht.sectionHeader,children:[w.jsx(oL,{className:Ht.sectionIcon}),w.jsx("h2",{className:Ht.sectionTitle,children:e("sections.medical")})]}),w.jsx("div",{className:Ht.cards,children:i.map(y=>w.jsx(aR,{device:y,variant:"default",onEdit:m},y.name))})]}),a.length>0&&w.jsxs("div",{className:Ht.section,children:[w.jsxs("div",{className:Ht.sectionHeader,children:[w.jsx(lL,{className:Ht.sectionIcon}),w.jsx("h2",{className:Ht.sectionTitle,children:e("sections.external")})]}),w.jsx("div",{className:Ht.cards,children:a.map(y=>w.jsx(aR,{device:y,variant:"external",onEdit:m},y.name))})]}),w.jsx(lU,{})]}),w.jsx(xxt,{isOpen:l,onClose:p,devices:n,initialData:f})]})},bxt="_container_1mfr6_1",Sxt="_errorContainer_1mfr6_8",Cxt="_headerSection_1mfr6_15",_xt="_title_1mfr6_22",Txt="_description_1mfr6_29",Ext="_filterContent_1mfr6_41",Oxt="_searchWrapper_1mfr6_47",Dxt="_searchIcon_1mfr6_52",Mxt="_searchInput_1mfr6_63",Rxt="_searchActionWrapper_1mfr6_75",Ixt="_searchButton_1mfr6_85",Nxt="_filtersContainer_1mfr6_109",Pxt="_dateButton_1mfr6_114",kxt="_dateIcon_1mfr6_129",Axt="_datePopover_1mfr6_134",Lxt="_filterButton_1mfr6_138",Vxt="_outline_1mfr6_145",$xt="_filterIcon_1mfr6_160",jxt="_exportWrapper_1mfr6_180",Uxt="_exportButton_1mfr6_184",Fxt="_popoverContent_1mfr6_196",Bxt="_wide_1mfr6_202",zxt="_popoverSpace_1mfr6_206",Gxt="_popoverTitle_1mfr6_212",Wxt="_checkboxWrapper_1mfr6_218",Hxt="_checkboxLabel_1mfr6_224",qxt="_loading_1mfr6_230",qr={container:bxt,errorContainer:Sxt,headerSection:Cxt,title:_xt,description:Txt,filterContent:Ext,searchWrapper:Oxt,searchIcon:Dxt,searchInput:Mxt,searchActionWrapper:Rxt,searchButton:Ixt,filtersContainer:Nxt,dateButton:Pxt,dateIcon:kxt,datePopover:Axt,filterButton:Lxt,outline:Vxt,filterIcon:$xt,exportWrapper:jxt,exportButton:Uxt,popoverContent:Fxt,wide:Bxt,popoverSpace:zxt,popoverTitle:Gxt,checkboxWrapper:Wxt,checkboxLabel:Hxt,loading:qxt};var NE="Checkbox",[Kxt]=Uc(NE),[Yxt,pU]=Kxt(NE);function Xxt(t){const{__scopeCheckbox:e,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u="on",internal_do_not_use_render:f}=t,[d,h]=xd({prop:n,defaultProp:i??!1,onChange:c,caller:NE}),[m,p]=D.useState(null),[y,x]=D.useState(null),S=D.useRef(!1),C=m?!!o||!!m.closest("form"):!0,_={checked:d,disabled:a,setChecked:h,control:m,setControl:p,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:S,required:l,defaultChecked:jg(i)?!1:i,isFormControl:C,bubbleInput:y,setBubbleInput:x};return w.jsx(Yxt,{scope:e,..._,children:Zxt(f)?f(_):r})}var Gye="CheckboxTrigger",Wye=D.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...r},i)=>{const{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:f,hasConsumerStoppedPropagationRef:d,isFormControl:h,bubbleInput:m}=pU(Gye,t),p=$n(i,u),y=D.useRef(c);return D.useEffect(()=>{const x=a?.form;if(x){const S=()=>f(y.current);return x.addEventListener("reset",S),()=>x.removeEventListener("reset",S)}},[a,f]),w.jsx(Yt.button,{type:"button",role:"checkbox","aria-checked":jg(c)?"mixed":c,"aria-required":l,"data-state":Zye(c),"data-disabled":s?"":void 0,disabled:s,value:o,...r,ref:p,onKeyDown:Et(e,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Et(n,x=>{f(S=>jg(S)?!0:!S),m&&h&&(d.current=x.isPropagationStopped(),d.current||x.stopPropagation())})})});Wye.displayName=Gye;var Hye=D.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...f}=t;return w.jsx(Xxt,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:d})=>w.jsxs(w.Fragment,{children:[w.jsx(Wye,{...f,ref:e,__scopeCheckbox:n}),d&&w.jsx(Xye,{__scopeCheckbox:n})]})})});Hye.displayName=NE;var qye="CheckboxIndicator",Kye=D.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...i}=t,a=pU(qye,n);return w.jsx(Lo,{present:r||jg(a.checked)||a.checked===!0,children:w.jsx(Yt.span,{"data-state":Zye(a.checked),"data-disabled":a.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});Kye.displayName=qye;var Yye="CheckboxBubbleInput",Xye=D.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:f,bubbleInput:d,setBubbleInput:h}=pU(Yye,t),m=$n(n,h),p=qj(a),y=a$(r);D.useEffect(()=>{const S=d;if(!S)return;const C=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(C,"checked").set,O=!i.current;if(p!==a&&T){const M=new Event("click",{bubbles:O});S.indeterminate=jg(a),T.call(S,jg(a)?!1:a),S.dispatchEvent(M)}},[d,p,a,i]);const x=D.useRef(jg(a)?!1:a);return w.jsx(Yt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:s,disabled:c,name:l,value:u,form:f,...e,tabIndex:-1,ref:m,style:{...e.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Xye.displayName=Yye;function Zxt(t){return typeof t=="function"}function jg(t){return t==="indeterminate"}function Zye(t){return jg(t)?"indeterminate":t?"checked":"unchecked"}function Am({className:t,...e}){return w.jsx(Hye,{"data-slot":"checkbox",className:rt("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:w.jsx(Kye,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:w.jsx($6,{className:"size-3.5"})})})}const Qxt="_emptyState_1nb69_1",Jxt="_icon_1nb69_9",VJ={emptyState:Qxt,icon:Jxt},Qye=({onReset:t,title:e,description:n,button:r})=>{const{t:i}=Hn(""),a=e||i("empty_state.default_title"),o=n||i("empty_state.default_description"),s=r||i("empty_state.reset_button");return w.jsxs("div",{className:VJ.emptyState,children:[w.jsx(Uje,{className:VJ.icon}),w.jsx("h3",{children:a}),w.jsx("p",{children:o}),t&&w.jsx(bt,{onClick:t,children:s})]})};function PE({className:t,...e}){return w.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:w.jsx("table",{"data-slot":"table",className:rt("w-full caption-bottom text-sm",t),...e})})}function kE({className:t,...e}){return w.jsx("thead",{"data-slot":"table-header",className:rt("[&_tr]:border-b",t),...e})}function AE({className:t,...e}){return w.jsx("tbody",{"data-slot":"table-body",className:rt("[&_tr:last-child]:border-0",t),...e})}function ip({className:t,...e}){return w.jsx("tr",{"data-slot":"table-row",className:rt("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...e})}function Ts({className:t,...e}){return w.jsx("th",{"data-slot":"table-head",className:rt("text-foreground h-10 px-2 text-[15px] text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function Es({className:t,...e}){return w.jsx("td",{"data-slot":"table-cell",className:rt("p-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}const e5t=()=>{const t=(e,n)=>Math.floor(Math.random()*(n-e+1)+e);return w.jsxs(PE,{children:[w.jsx(kE,{children:w.jsxs(ip,{children:[w.jsx(Ts,{className:"w-[50px] pl-4",children:w.jsx(An,{className:"h-4 w-4 rounded"})}),w.jsx(Ts,{className:"w-[50%] pl-5",children:w.jsx(An,{className:"h-4 w-24"})}),w.jsx(Ts,{className:"w-[30%]",children:w.jsx(An,{className:"h-4 w-20"})}),w.jsx(Ts,{className:"w-[20%]",children:w.jsx(An,{className:"h-4 w-28"})})]})}),w.jsx(AE,{children:[...Array(20)].map((e,n)=>w.jsxs(ip,{style:{animationDelay:`${n*.05}s`},children:[w.jsx(Es,{className:"pl-4",children:w.jsx(An,{className:"h-4 w-4 rounded"})}),w.jsx(Es,{className:"pl-5",children:w.jsx("div",{className:"h-4 flex items-center",children:w.jsx(An,{className:"h-4",style:{width:`${t(60,90)}%`,maxWidth:"500px"}})})}),w.jsx(Es,{children:w.jsx("div",{className:"h-4 flex items-center",children:w.jsx(An,{className:"h-4",style:{width:`${t(50,80)}%`,maxWidth:"200px"}})})}),w.jsx(Es,{children:w.jsx(An,{className:"h-4 w-24"})})]},n))})]})},t5t={ru:{day:["день","дня","дней"],week:["неделя","недели","недель"],month:["месяц","месяца","месяцев"],year:["год","года","лет"]},en:{day:["day","days"],week:["week","weeks"],month:["month","months"],year:["year","years"]},vi:{day:["ngày"],week:["tuần"],month:["tháng"],year:["tuổi"]}};function mv(t,e,n){const r=t5t[n][e];if(n==="ru"){const i=t%10,a=t%100;return a>4&&a<20?r[2]:i<5&&i>0?i===1?r[0]:r[1]:r[2]}return n==="en"?t===1?r[0]:r[1]:n==="vi"?r[0]:""}function Jye(t){if(!t||!t.includes("^"))return t||"Не указан";const e=t.split("^").filter(Boolean),n=e[0]||"",r=e[1]||"",i=e[2]||"",a=r?` ${r.charAt(0)}.`:"",o=i?` ${i.charAt(0)}.`:"";return`${n}${a}${o}`}function mU(t){const e=go.language?go.language.split("-")[0]:"ru",n=["ru","en","vi"].includes(e)?e:"ru";if(!t)return"";const r=new Date(t),i=new Date;if(isNaN(r.getTime()))return"";const a=_ve(i,r),o=pgt(i,r),s=ggt(i,r),c=mgt(i,r);if(s<1)return o<1?`${a} ${mv(a,"day",n)}`:`${o} ${mv(o,"week",n)}`;if(c<1)return`${s} ${mv(s,"month",n)}`;if(c<3){const l=s%12,u=`${c} ${mv(c,"year",n)}`;if(l===0)return u;const f=`${l} ${mv(l,"month",n)}`;return`${u} ${f}`}return`${c} ${mv(c,"year",n)}`}class n5t{static async getStudies(e){return(await ni.get("/studies",{params:{from_date:e.from_date,till_date:e.till_date,patient:e.patient,patient_id:e.patient_id,aetitle:e.aetitle}})).data}}const e2e=t=>{const e=Sh({queryKey:["studies",t],queryFn:()=>n5t.getStudies(t),refetchInterval:6e4});return{studies:e.data||[],isStudiesLoading:e.isLoading,isStudiesFetching:e.isFetching,isStudiesError:e.isError,studiesRefetch:e.refetch}},$J={initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.7}},r5t=()=>{const{t}=Hn("studies"),e=Sf(),n=o3(),[r,i]=aRe(),{regularAetitles:a=[],isDeviceLoading:o}=aU(),[s,c]=D.useState(()=>r.get("patient")||""),[l,u]=D.useState(()=>r.get("patient")||""),[f,d]=D.useState(()=>r.get("aetitle")?.split(",")||[]),h=f.length>0?f.join(","):void 0,[m,p]=D.useState(()=>{const k=r.get("from"),L=r.get("to");return k&&L?{from:wJ(k),to:wJ(L)}:{from:new Date,to:new Date}}),{studies:y,isStudiesLoading:x,isStudiesError:S,studiesRefetch:C}=e2e({from_date:m?.from?Ji(m.from,"yyyy-MM-dd"):void 0,till_date:m?.to?Ji(m.to,"yyyy-MM-dd"):void 0,aetitle:h,patient:l});D.useEffect(()=>{const k=new URLSearchParams;l&&k.set("patient",l),h&&k.set("aetitle",h),m?.from&&k.set("from",Ji(m.from,"yyyy-MM-dd")),m?.to&&k.set("to",Ji(m.to,"yyyy-MM-dd")),i(k,{replace:!0})},[l,h,m,i]);const _=()=>{s.trim()&&u(s.trim())},T=k=>{const L=k.target.value;c(L),L===""&&u("")},O=()=>{c(""),u("")},M=k=>{k.key==="Enter"&&_()},I=k=>{d(L=>L.includes(k)?L.filter($=>$!==k):[...L,k])},V=()=>{d([]),O(),p({from:new Date,to:new Date})};return S?w.jsx("div",{className:qr.errorContainer,children:w.jsx(e3,{variant:"card",description:t("errors.description"),onRetry:C})}):w.jsxs("div",{className:qr.container,children:[w.jsxs("div",{className:qr.headerSection,children:[w.jsx("h1",{className:qr.title,children:t("title")}),w.jsx("p",{className:qr.description,children:t("description")})]}),w.jsx("div",{className:qr.filterContent,children:w.jsxs("div",{className:qr.filtersContainer,children:[w.jsxs("div",{className:qr.searchWrapper,children:[w.jsx(d2,{className:qr.searchIcon}),w.jsx(Ar,{placeholder:t("search_placeholder"),value:s,onChange:T,onKeyDown:M,className:qr.searchInput}),w.jsx("div",{className:qr.searchActionWrapper,children:w.jsx(yd,{mode:"wait",initial:!1,children:l?w.jsx(ho.div,{variants:$J,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15,ease:Rg},children:w.jsx(bt,{type:"button",variant:"ghost",size:"icon",className:qr.searchButton,onClick:O,children:w.jsx(Kg,{})})},"clear"):w.jsx(ho.div,{variants:$J,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15,ease:Rg},children:w.jsx(bt,{type:"button",variant:"ghost",size:"icon",className:qr.searchButton,onClick:_,disabled:!s.trim(),children:w.jsx(qg,{})})},"search")})})]}),w.jsxs(bl,{children:[w.jsx(Sl,{asChild:!0,children:w.jsxs(bt,{variant:"outline",className:qr.dateButton,children:[w.jsx(K0,{className:qr.dateIcon}),w.jsx("span",{children:tU(m?.from,m?.to)})]})}),w.jsx(Cl,{className:qr.datePopover,align:"start",children:w.jsx($g,{mode:"range",selected:m,onSelect:p,locale:n})})]}),w.jsxs(bl,{children:[w.jsx(Sl,{asChild:!0,children:w.jsxs(bt,{variant:"outline",className:`${qr.filterButton} ${qr.outline}`,children:[w.jsx(j6,{className:qr.filterIcon}),t("equipment")]})}),w.jsx(Cl,{className:`${qr.popoverContent} ${qr.wide}`,align:"start",children:w.jsxs("div",{className:qr.popoverSpace,children:[w.jsx("h4",{className:qr.popoverTitle,children:t("select_equipment")}),o?w.jsx("div",{className:qr.loading,children:w.jsx(Jo,{size:"md"})}):a.map(k=>w.jsxs("div",{className:qr.checkboxWrapper,children:[w.jsx(Am,{id:`aetitle-${k}`,checked:f.includes(k),onCheckedChange:()=>I(k)}),w.jsx("label",{htmlFor:`aetitle-${k}`,className:qr.checkboxLabel,children:k})]},k))]})})]}),w.jsx("div",{className:qr.exportWrapper,children:w.jsxs(bt,{variant:"outline",className:qr.exportButton,children:[w.jsx(vb,{className:qr.filterIcon}),t("export_excel")]})})]})}),w.jsx(Oc,{children:x?w.jsx(e5t,{}):y.length===0?w.jsx(Qye,{onReset:V,title:t("empty_state.title"),description:t("empty_state.description")}):w.jsxs(PE,{children:[w.jsx(kE,{children:w.jsxs(ip,{children:[w.jsx(Ts,{className:"w-[50px] pl-4",children:w.jsx(Am,{"aria-label":t("table.select_all"),className:"w-4.5 h-4.5"})}),w.jsx(Ts,{className:"w-[50%] pl-5",children:t("table.name")}),w.jsx(Ts,{className:"w-[30%]",children:t("table.patient")}),w.jsx(Ts,{className:"w-[20%]",children:t("table.date_time")})]})}),w.jsx(AE,{children:y.map(k=>w.jsxs(ip,{onClick:()=>e(`/studies/${k.uid}`),children:[w.jsx(Es,{className:"w-[50px] pl-4",children:w.jsx(Am,{"aria-label":t("table.select_row"),className:"w-4.5 h-4.5"})}),w.jsx(Es,{className:"pl-5",children:w.jsx("div",{className:"h-4 flex items-center",children:w.jsx("span",{className:"font-medium truncate max-w-[500px]",children:k?.description||t("table.no_data")})})}),w.jsx(Es,{children:w.jsx("div",{className:"h-4 flex items-center",children:w.jsx("span",{className:"truncate max-w-[200px]",children:Jye(k.patient)})})}),w.jsx(Es,{children:n3(k.date)})]},k.uid))})]})}),w.jsx(lU,{})]})},i5t="_container_1o0qj_1",a5t="_header_1o0qj_7",o5t="_headerLeft_1o0qj_17",s5t="_backIcon_1o0qj_22",c5t="_info_1o0qj_26",l5t="_title_1o0qj_30",u5t="_metadata_1o0qj_37",f5t="_studyName_1o0qj_45",d5t="_patientName_1o0qj_49",h5t="_date_1o0qj_50",g5t="_separator_1o0qj_54",p5t="_modalityBadge_1o0qj_59",m5t="_headerActions_1o0qj_67",v5t="_divider_1o0qj_79",y5t="_conclusionButton_1o0qj_85",x5t="_viewerContainer_1o0qj_90",w5t="_sidebar_1o0qj_95",b5t="_sidebarToggle_1o0qj_111",S5t="_studiesSection_1o0qj_139",C5t="_studiesSectionHeader_1o0qj_143",_5t="_studiesSectionTitle_1o0qj_155",T5t="_studiesHeaderRight_1o0qj_161",E5t="_studiesCount_1o0qj_167",O5t="_studiesList_1o0qj_174",D5t="_studyItem_1o0qj_192",M5t="_selectedStudy_1o0qj_208",R5t="_currentStudy_1o0qj_212",I5t="_studyLabel_1o0qj_212",N5t="_studyDescription_1o0qj_212",P5t="_studyCheckbox_1o0qj_215",k5t="_currentBadge_1o0qj_239",A5t="_studyDate_1o0qj_252",L5t="_studiesEmpty_1o0qj_257",V5t="_prewiewLoading_1o0qj_258",$5t="_seriesSection_1o0qj_264",j5t="_sidebarHeader_1o0qj_270",U5t="_sidebarTitle_1o0qj_278",F5t="_sidebarHeaderActions_1o0qj_284",B5t="_imageCount_1o0qj_289",z5t="_viewModeToggle_1o0qj_297",G5t="_viewModeButton_1o0qj_304",W5t="_thumbnailList_1o0qj_312",H5t="_thumbnailEmpty_1o0qj_335",q5t="_seriesGroupHeader_1o0qj_355",K5t="_seriesGroupTitle_1o0qj_373",Y5t="_seriesGroupDate_1o0qj_388",X5t="_currentBadgeSmall_1o0qj_394",Z5t="_viewer_1o0qj_90",Q5t="_imageContainer_1o0qj_415",J5t="_sidebarToggleClosed_1o0qj_424",ewt="_loadingOverlay_1o0qj_446",twt="_frameCounter_1o0qj_467",nwt="_wwcOverlay_1o0qj_482",rwt="_viewportGrid_1o0qj_497",iwt="_single_1o0qj_504",awt="_twoVertical_1o0qj_508",owt="_twoHorizontal_1o0qj_512",swt="_fourGrid_1o0qj_516",cwt="_viewportLabel_1o0qj_521",lwt="_viewportItem_1o0qj_534",uwt="_dragOver_1o0qj_539",fwt="_viewportCanvas_1o0qj_543",dwt="_activeViewport_1o0qj_550",hwt="_popoverContent_1o0qj_555",gwt="_emptyViewportPlaceholder_1o0qj_560",pwt="_tooltipContent_1o0qj_654",vt={container:i5t,header:a5t,headerLeft:o5t,backIcon:s5t,info:c5t,title:l5t,metadata:u5t,studyName:f5t,patientName:d5t,date:h5t,separator:g5t,modalityBadge:p5t,headerActions:m5t,divider:v5t,conclusionButton:y5t,viewerContainer:x5t,sidebar:w5t,sidebarToggle:b5t,studiesSection:S5t,studiesSectionHeader:C5t,studiesSectionTitle:_5t,studiesHeaderRight:T5t,studiesCount:E5t,studiesList:O5t,studyItem:D5t,selectedStudy:M5t,currentStudy:R5t,studyLabel:I5t,studyDescription:N5t,studyCheckbox:P5t,currentBadge:k5t,studyDate:A5t,studiesEmpty:L5t,prewiewLoading:V5t,seriesSection:$5t,sidebarHeader:j5t,sidebarTitle:U5t,sidebarHeaderActions:F5t,imageCount:B5t,viewModeToggle:z5t,viewModeButton:G5t,thumbnailList:W5t,thumbnailEmpty:H5t,seriesGroupHeader:q5t,seriesGroupTitle:K5t,seriesGroupDate:Y5t,currentBadgeSmall:X5t,viewer:Z5t,imageContainer:Q5t,sidebarToggleClosed:J5t,loadingOverlay:ewt,frameCounter:twt,wwcOverlay:nwt,viewportGrid:rwt,single:iwt,twoVertical:awt,twoHorizontal:owt,fourGrid:swt,viewportLabel:cwt,viewportItem:lwt,dragOver:uwt,viewportCanvas:fwt,activeViewport:dwt,popoverContent:hwt,emptyViewportPlaceholder:gwt,tooltipContent:pwt};var LE="Collapsible",[mwt]=Uc(LE),[vwt,vU]=mwt(LE),t2e=D.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=t,[c,l]=xd({prop:r,defaultProp:i??!1,onChange:o,caller:LE});return w.jsx(vwt,{scope:n,disabled:a,contentId:No(),open:c,onOpenToggle:D.useCallback(()=>l(u=>!u),[l]),children:w.jsx(Yt.div,{"data-state":xU(c),"data-disabled":a?"":void 0,...s,ref:e})})});t2e.displayName=LE;var n2e="CollapsibleTrigger",r2e=D.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=vU(n2e,n);return w.jsx(Yt.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":xU(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:Et(t.onClick,i.onOpenToggle)})});r2e.displayName=n2e;var yU="CollapsibleContent",i2e=D.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=vU(yU,t.__scopeCollapsible);return w.jsx(Lo,{present:n||i.open,children:({present:a})=>w.jsx(ywt,{...r,ref:e,present:a})})});i2e.displayName=yU;var ywt=D.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...a}=t,o=vU(yU,n),[s,c]=D.useState(r),l=D.useRef(null),u=$n(e,l),f=D.useRef(0),d=f.current,h=D.useRef(0),m=h.current,p=o.open||s,y=D.useRef(p),x=D.useRef(void 0);return D.useEffect(()=>{const S=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(S)},[]),ko(()=>{const S=l.current;if(S){x.current=x.current||{transitionDuration:S.style.transitionDuration,animationName:S.style.animationName},S.style.transitionDuration="0s",S.style.animationName="none";const C=S.getBoundingClientRect();f.current=C.height,h.current=C.width,y.current||(S.style.transitionDuration=x.current.transitionDuration,S.style.animationName=x.current.animationName),c(r)}},[o.open,r]),w.jsx(Yt.div,{"data-state":xU(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...a,ref:u,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:p&&i})});function xU(t){return t?"open":"closed"}var xwt=t2e;function wwt({...t}){return w.jsx(xwt,{"data-slot":"collapsible",...t})}function bwt({...t}){return w.jsx(r2e,{"data-slot":"collapsible-trigger",...t})}function Swt({...t}){return w.jsx(i2e,{"data-slot":"collapsible-content",...t})}var it;(function(t){t.ERROR_EVENT="CORNERSTONE_ERROR",t.CACHE_SIZE_EXCEEDED="CACHE_SIZE_EXCEEDED",t.IMAGE_LOAD_ERROR="IMAGE_LOAD_ERROR",t.CAMERA_MODIFIED="CORNERSTONE_CAMERA_MODIFIED",t.CAMERA_RESET="CORNERSTONE_CAMERA_RESET",t.VOI_MODIFIED="CORNERSTONE_VOI_MODIFIED",t.PRESET_MODIFIED="CORNERSTONE_VIEWPORT_RENDERING_PRESET_MODIFIED",t.DISPLAY_AREA_MODIFIED="CORNERSTONE_DISPLAY_AREA_MODIFIED",t.ELEMENT_DISABLED="CORNERSTONE_ELEMENT_DISABLED",t.ELEMENT_ENABLED="CORNERSTONE_ELEMENT_ENABLED",t.IMAGE_RENDERED="CORNERSTONE_IMAGE_RENDERED",t.IMAGE_VOLUME_MODIFIED="CORNERSTONE_IMAGE_VOLUME_MODIFIED",t.IMAGE_VOLUME_LOADING_COMPLETED="CORNERSTONE_IMAGE_VOLUME_LOADING_COMPLETED",t.IMAGE_LOADED="CORNERSTONE_IMAGE_LOADED",t.IMAGE_RETRIEVAL_STAGE="CORNERSTONE_IMAGE_RETRIEVAL_STAGE",t.IMAGE_LOAD_FAILED="CORNERSTONE_IMAGE_LOAD_FAILED",t.VOLUME_VIEWPORT_NEW_VOLUME="CORNERSTONE_VOLUME_VIEWPORT_NEW_VOLUME",t.VOLUME_LOADED="CORNERSTONE_VOLUME_LOADED",t.VOLUME_LOADED_FAILED="CORNERSTONE_VOLUME_LOADED_FAILED",t.IMAGE_CACHE_IMAGE_ADDED="CORNERSTONE_IMAGE_CACHE_IMAGE_ADDED",t.IMAGE_CACHE_IMAGE_REMOVED="CORNERSTONE_IMAGE_CACHE_IMAGE_REMOVED",t.VOLUME_CACHE_VOLUME_ADDED="CORNERSTONE_VOLUME_CACHE_VOLUME_ADDED",t.VOLUME_CACHE_VOLUME_REMOVED="CORNERSTONE_VOLUME_CACHE_VOLUME_REMOVED",t.STACK_NEW_IMAGE="CORNERSTONE_STACK_NEW_IMAGE",t.VOLUME_NEW_IMAGE="CORNERSTONE_VOLUME_NEW_IMAGE",t.PRE_STACK_NEW_IMAGE="CORNERSTONE_PRE_STACK_NEW_IMAGE",t.IMAGE_SPACING_CALIBRATED="CORNERSTONE_IMAGE_SPACING_CALIBRATED",t.VIEWPORT_NEW_IMAGE_SET="CORNERSTONE_VIEWPORT_NEW_IMAGE_SET",t.STACK_VIEWPORT_SCROLL="CORNERSTONE_STACK_VIEWPORT_SCROLL",t.STACK_SCROLL_OUT_OF_BOUNDS="STACK_SCROLL_OUT_OF_BOUNDS",t.GEOMETRY_CACHE_GEOMETRY_ADDED="CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_ADDED",t.GEOMETRY_CACHE_GEOMETRY_REMOVED="CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_REMOVED",t.VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS="VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS",t.VOLUME_VIEWPORT_SCROLL="VOLUME_VIEWPORT_SCROLL",t.CLIPPING_PLANES_UPDATED="CORNERSTONE_CLIPPING_PLANES_UPDATED",t.WEB_WORKER_PROGRESS="CORNERSTONE_WEB_WORKER_PROGRESS",t.COLORMAP_MODIFIED="CORNERSTONE_COLORMAP_MODIFIED",t.DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED="DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED",t.DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED="DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED",t.DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED="DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED",t.DYNAMIC_VOLUME_TIME_POINT_LOADED="DYNAMIC_VOLUME_TIME_POINT_LOADED",t.GEOMETRY_LOADED="GEOMETRY_LOADED",t.GEOMETRY_LOAD_PROGRESS="GEOMETRY_LOAD_PROGRESS",t.GEOMETRY_LOADED_FAILED="GEOMETRY_LOADED_FAILED",t.ACTORS_CHANGED="CORNERSTONE_ACTORS_CHANGED"})(it||(it={}));var In;(function(t){t.Interaction="interaction",t.Thumbnail="thumbnail",t.Prefetch="prefetch",t.Compute="compute"})(In||(In={}));var Rr;(function(t){t.STACK="stack",t.ORTHOGRAPHIC="orthographic",t.PERSPECTIVE="perspective",t.VOLUME_3D="volume3d",t.VIDEO="video",t.WHOLE_SLIDE="wholeSlide"})(Rr||(Rr={}));var G0;(function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR",t[t.FAST_LINEAR=2]="FAST_LINEAR"})(G0||(G0={}));const wC={COMPOSITE_BLEND:0,MAXIMUM_INTENSITY_BLEND:1,MINIMUM_INTENSITY_BLEND:2,AVERAGE_INTENSITY_BLEND:3,ADDITIVE_INTENSITY_BLEND:4,RADON_TRANSFORM_BLEND:5,LABELMAP_EDGE_PROJECTION_BLEND:6},Cwt={OFF:0,NORMALIZED:1,RAW:2};var a2e={BlendMode:wC,FilterMode:Cwt};const{BlendMode:Qx}=a2e;var Ug;(function(t){t[t.COMPOSITE=Qx.COMPOSITE_BLEND]="COMPOSITE",t[t.MAXIMUM_INTENSITY_BLEND=Qx.MAXIMUM_INTENSITY_BLEND]="MAXIMUM_INTENSITY_BLEND",t[t.MINIMUM_INTENSITY_BLEND=Qx.MINIMUM_INTENSITY_BLEND]="MINIMUM_INTENSITY_BLEND",t[t.AVERAGE_INTENSITY_BLEND=Qx.AVERAGE_INTENSITY_BLEND]="AVERAGE_INTENSITY_BLEND",t[t.LABELMAP_EDGE_PROJECTION_BLEND=Qx.LABELMAP_EDGE_PROJECTION_BLEND]="LABELMAP_EDGE_PROJECTION_BLEND"})(Ug||(Ug={}));var Fg;(function(t){t.AXIAL="axial",t.CORONAL="coronal",t.SAGITTAL="sagittal",t.ACQUISITION="acquisition",t.AXIAL_REFORMAT="axial_reformat",t.CORONAL_REFORMAT="coronal_reformat",t.SAGITTAL_REFORMAT="sagittal_reformat",t.REFORMAT="reformat"})(Fg||(Fg={}));var OT;(function(t){t.CONTOUR="CONTOUR",t.SURFACE="SURFACE",t.MESH="MESH"})(OT||(OT={}));var UP;(function(t){t.CLOSED_PLANAR="CLOSED_PLANAR",t.OPEN_PLANAR="OPEN_PLANAR"})(UP||(UP={}));const _wt=UP;var FP;(function(t){t.PLY="PLY",t.STL="STL",t.OBJ="OBJ",t.VTP="VTP"})(FP||(FP={}));const Twt=FP;var ns;(function(t){t.LINEAR="LINEAR",t.SAMPLED_SIGMOID="SIGMOID",t.LINEAR_EXACT="LINEAR_EXACT"})(ns||(ns={}));var BP;(function(t){t.SUM="SUM",t.AVERAGE="AVERAGE",t.SUBTRACT="SUBTRACT"})(BP||(BP={}));const Ewt=BP;var ed;(function(t){t.NOT_APPLICABLE="",t.ERMF="ERMF",t.USER="User",t.PROJECTION="Proj",t.REGION="Region",t.ERROR="Error",t.UNCALIBRATED="Uncalibrated",t.CALIBRATED="Calibrated",t.UNKNOWN="Unknown"})(ed||(ed={}));var Ss;(function(t){t.NO_DATA="noData",t.LOADING="loading",t.PRE_RENDER="preRender",t.RESIZE="resize",t.RENDERED="rendered"})(Ss||(Ss={}));var yl;(function(t){t[t.FAR_REPLICATE=1]="FAR_REPLICATE",t[t.ADJACENT_REPLICATE=3]="ADJACENT_REPLICATE",t[t.SUBRESOLUTION=6]="SUBRESOLUTION",t[t.LOSSY=7]="LOSSY",t[t.FULL_RESOLUTION=8]="FULL_RESOLUTION"})(yl||(yl={}));var Gw;(function(t){t.FRAME="f",t.SECOND="s"})(Gw||(Gw={}));const Owt=Object.freeze(Object.defineProperty({__proto__:null,get SpeedUnit(){return Gw}},Symbol.toStringTag,{value:"Module"}));var Js;(function(t){t.CALIBRATION="calibrationModule",t.CINE="cineModule",t.GENERAL_IMAGE="generalImageModule",t.GENERAL_SERIES="generalSeriesModule",t.GENERAL_STUDY="generalStudyModule",t.IMAGE_PIXEL="imagePixelModule",t.IMAGE_PLANE="imagePlaneModule",t.IMAGE_URL="imageUrlModule",t.MODALITY_LUT="modalityLutModule",t.MULTIFRAME="multiframeModule",t.NM_MULTIFRAME_GEOMETRY="nmMultiframeGeometryModule",t.OVERLAY_PLANE="overlayPlaneModule",t.PATIENT="patientModule",t.PATIENT_STUDY="patientStudyModule",t.PET_IMAGE="petImageModule",t.PET_ISOTOPE="petIsotopeModule",t.PET_SERIES="petSeriesModule",t.SOP_COMMON="sopCommonModule",t.ULTRASOUND_ENHANCED_REGION="ultrasoundEnhancedRegionModule",t.VOI_LUT="voiLutModule",t.WADO_WEB_CLIENT="wadoWebClient"})(Js||(Js={}));var zP;(function(t){t.SUM="SUM",t.SUBTRACT="SUBTRACT",t.AVERAGE="AVERAGE"})(zP||(zP={}));var DT;(function(t){t.RLE="RLE",t.Volume="Volume"})(DT||(DT={}));var o1;(function(t){t.Tiled="tiled",t.ContextPool="contextPool"})(o1||(o1={}));const Ad=Object.freeze(Object.defineProperty({__proto__:null,BlendModes:Ug,CalibrationTypes:ed,ContourType:_wt,DynamicOperatorType:Ewt,Events:it,get GenerateImageType(){return zP},GeometryType:OT,ImageQualityStatus:yl,InterpolationType:G0,MeshType:Twt,MetadataModules:Js,OrientationAxis:Fg,RenderingEngineModeEnum:o1,RequestType:In,VOILUTFunctionType:ns,VideoEnums:Owt,ViewportStatus:Ss,ViewportType:Rr,VoxelManagerEnum:DT},Symbol.toStringTag,{value:"Module"})),GP={hotIron:{name:"Hot Iron",numOfColors:256,colors:[[0,0,0,255],[2,0,0,255],[4,0,0,255],[6,0,0,255],[8,0,0,255],[10,0,0,255],[12,0,0,255],[14,0,0,255],[16,0,0,255],[18,0,0,255],[20,0,0,255],[22,0,0,255],[24,0,0,255],[26,0,0,255],[28,0,0,255],[30,0,0,255],[32,0,0,255],[34,0,0,255],[36,0,0,255],[38,0,0,255],[40,0,0,255],[42,0,0,255],[44,0,0,255],[46,0,0,255],[48,0,0,255],[50,0,0,255],[52,0,0,255],[54,0,0,255],[56,0,0,255],[58,0,0,255],[60,0,0,255],[62,0,0,255],[64,0,0,255],[66,0,0,255],[68,0,0,255],[70,0,0,255],[72,0,0,255],[74,0,0,255],[76,0,0,255],[78,0,0,255],[80,0,0,255],[82,0,0,255],[84,0,0,255],[86,0,0,255],[88,0,0,255],[90,0,0,255],[92,0,0,255],[94,0,0,255],[96,0,0,255],[98,0,0,255],[100,0,0,255],[102,0,0,255],[104,0,0,255],[106,0,0,255],[108,0,0,255],[110,0,0,255],[112,0,0,255],[114,0,0,255],[116,0,0,255],[118,0,0,255],[120,0,0,255],[122,0,0,255],[124,0,0,255],[126,0,0,255],[128,0,0,255],[130,0,0,255],[132,0,0,255],[134,0,0,255],[136,0,0,255],[138,0,0,255],[140,0,0,255],[142,0,0,255],[144,0,0,255],[146,0,0,255],[148,0,0,255],[150,0,0,255],[152,0,0,255],[154,0,0,255],[156,0,0,255],[158,0,0,255],[160,0,0,255],[162,0,0,255],[164,0,0,255],[166,0,0,255],[168,0,0,255],[170,0,0,255],[172,0,0,255],[174,0,0,255],[176,0,0,255],[178,0,0,255],[180,0,0,255],[182,0,0,255],[184,0,0,255],[186,0,0,255],[188,0,0,255],[190,0,0,255],[192,0,0,255],[194,0,0,255],[196,0,0,255],[198,0,0,255],[200,0,0,255],[202,0,0,255],[204,0,0,255],[206,0,0,255],[208,0,0,255],[210,0,0,255],[212,0,0,255],[214,0,0,255],[216,0,0,255],[218,0,0,255],[220,0,0,255],[222,0,0,255],[224,0,0,255],[226,0,0,255],[228,0,0,255],[230,0,0,255],[232,0,0,255],[234,0,0,255],[236,0,0,255],[238,0,0,255],[240,0,0,255],[242,0,0,255],[244,0,0,255],[246,0,0,255],[248,0,0,255],[250,0,0,255],[252,0,0,255],[254,0,0,255],[255,0,0,255],[255,2,0,255],[255,4,0,255],[255,6,0,255],[255,8,0,255],[255,10,0,255],[255,12,0,255],[255,14,0,255],[255,16,0,255],[255,18,0,255],[255,20,0,255],[255,22,0,255],[255,24,0,255],[255,26,0,255],[255,28,0,255],[255,30,0,255],[255,32,0,255],[255,34,0,255],[255,36,0,255],[255,38,0,255],[255,40,0,255],[255,42,0,255],[255,44,0,255],[255,46,0,255],[255,48,0,255],[255,50,0,255],[255,52,0,255],[255,54,0,255],[255,56,0,255],[255,58,0,255],[255,60,0,255],[255,62,0,255],[255,64,0,255],[255,66,0,255],[255,68,0,255],[255,70,0,255],[255,72,0,255],[255,74,0,255],[255,76,0,255],[255,78,0,255],[255,80,0,255],[255,82,0,255],[255,84,0,255],[255,86,0,255],[255,88,0,255],[255,90,0,255],[255,92,0,255],[255,94,0,255],[255,96,0,255],[255,98,0,255],[255,100,0,255],[255,102,0,255],[255,104,0,255],[255,106,0,255],[255,108,0,255],[255,110,0,255],[255,112,0,255],[255,114,0,255],[255,116,0,255],[255,118,0,255],[255,120,0,255],[255,122,0,255],[255,124,0,255],[255,126,0,255],[255,128,4,255],[255,130,8,255],[255,132,12,255],[255,134,16,255],[255,136,20,255],[255,138,24,255],[255,140,28,255],[255,142,32,255],[255,144,36,255],[255,146,40,255],[255,148,44,255],[255,150,48,255],[255,152,52,255],[255,154,56,255],[255,156,60,255],[255,158,64,255],[255,160,68,255],[255,162,72,255],[255,164,76,255],[255,166,80,255],[255,168,84,255],[255,170,88,255],[255,172,92,255],[255,174,96,255],[255,176,100,255],[255,178,104,255],[255,180,108,255],[255,182,112,255],[255,184,116,255],[255,186,120,255],[255,188,124,255],[255,190,128,255],[255,192,132,255],[255,194,136,255],[255,196,140,255],[255,198,144,255],[255,200,148,255],[255,202,152,255],[255,204,156,255],[255,206,160,255],[255,208,164,255],[255,210,168,255],[255,212,172,255],[255,214,176,255],[255,216,180,255],[255,218,184,255],[255,220,188,255],[255,222,192,255],[255,224,196,255],[255,226,200,255],[255,228,204,255],[255,230,208,255],[255,232,212,255],[255,234,216,255],[255,236,220,255],[255,238,224,255],[255,240,228,255],[255,242,232,255],[255,244,236,255],[255,246,240,255],[255,248,244,255],[255,250,248,255],[255,252,252,255],[255,255,255,255]]},pet:{name:"PET",numColors:256,colors:[[0,0,0,255],[0,2,1,255],[0,4,3,255],[0,6,5,255],[0,8,7,255],[0,10,9,255],[0,12,11,255],[0,14,13,255],[0,16,15,255],[0,18,17,255],[0,20,19,255],[0,22,21,255],[0,24,23,255],[0,26,25,255],[0,28,27,255],[0,30,29,255],[0,32,31,255],[0,34,33,255],[0,36,35,255],[0,38,37,255],[0,40,39,255],[0,42,41,255],[0,44,43,255],[0,46,45,255],[0,48,47,255],[0,50,49,255],[0,52,51,255],[0,54,53,255],[0,56,55,255],[0,58,57,255],[0,60,59,255],[0,62,61,255],[0,65,63,255],[0,67,65,255],[0,69,67,255],[0,71,69,255],[0,73,71,255],[0,75,73,255],[0,77,75,255],[0,79,77,255],[0,81,79,255],[0,83,81,255],[0,85,83,255],[0,87,85,255],[0,89,87,255],[0,91,89,255],[0,93,91,255],[0,95,93,255],[0,97,95,255],[0,99,97,255],[0,101,99,255],[0,103,101,255],[0,105,103,255],[0,107,105,255],[0,109,107,255],[0,111,109,255],[0,113,111,255],[0,115,113,255],[0,117,115,255],[0,119,117,255],[0,121,119,255],[0,123,121,255],[0,125,123,255],[0,128,125,255],[1,126,127,255],[3,124,129,255],[5,122,131,255],[7,120,133,255],[9,118,135,255],[11,116,137,255],[13,114,139,255],[15,112,141,255],[17,110,143,255],[19,108,145,255],[21,106,147,255],[23,104,149,255],[25,102,151,255],[27,100,153,255],[29,98,155,255],[31,96,157,255],[33,94,159,255],[35,92,161,255],[37,90,163,255],[39,88,165,255],[41,86,167,255],[43,84,169,255],[45,82,171,255],[47,80,173,255],[49,78,175,255],[51,76,177,255],[53,74,179,255],[55,72,181,255],[57,70,183,255],[59,68,185,255],[61,66,187,255],[63,64,189,255],[65,63,191,255],[67,61,193,255],[69,59,195,255],[71,57,197,255],[73,55,199,255],[75,53,201,255],[77,51,203,255],[79,49,205,255],[81,47,207,255],[83,45,209,255],[85,43,211,255],[86,41,213,255],[88,39,215,255],[90,37,217,255],[92,35,219,255],[94,33,221,255],[96,31,223,255],[98,29,225,255],[100,27,227,255],[102,25,229,255],[104,23,231,255],[106,21,233,255],[108,19,235,255],[110,17,237,255],[112,15,239,255],[114,13,241,255],[116,11,243,255],[118,9,245,255],[120,7,247,255],[122,5,249,255],[124,3,251,255],[126,1,253,255],[128,0,255,255],[130,2,252,255],[132,4,248,255],[134,6,244,255],[136,8,240,255],[138,10,236,255],[140,12,232,255],[142,14,228,255],[144,16,224,255],[146,18,220,255],[148,20,216,255],[150,22,212,255],[152,24,208,255],[154,26,204,255],[156,28,200,255],[158,30,196,255],[160,32,192,255],[162,34,188,255],[164,36,184,255],[166,38,180,255],[168,40,176,255],[170,42,172,255],[171,44,168,255],[173,46,164,255],[175,48,160,255],[177,50,156,255],[179,52,152,255],[181,54,148,255],[183,56,144,255],[185,58,140,255],[187,60,136,255],[189,62,132,255],[191,64,128,255],[193,66,124,255],[195,68,120,255],[197,70,116,255],[199,72,112,255],[201,74,108,255],[203,76,104,255],[205,78,100,255],[207,80,96,255],[209,82,92,255],[211,84,88,255],[213,86,84,255],[215,88,80,255],[217,90,76,255],[219,92,72,255],[221,94,68,255],[223,96,64,255],[225,98,60,255],[227,100,56,255],[229,102,52,255],[231,104,48,255],[233,106,44,255],[235,108,40,255],[237,110,36,255],[239,112,32,255],[241,114,28,255],[243,116,24,255],[245,118,20,255],[247,120,16,255],[249,122,12,255],[251,124,8,255],[253,126,4,255],[255,128,0,255],[255,130,4,255],[255,132,8,255],[255,134,12,255],[255,136,16,255],[255,138,20,255],[255,140,24,255],[255,142,28,255],[255,144,32,255],[255,146,36,255],[255,148,40,255],[255,150,44,255],[255,152,48,255],[255,154,52,255],[255,156,56,255],[255,158,60,255],[255,160,64,255],[255,162,68,255],[255,164,72,255],[255,166,76,255],[255,168,80,255],[255,170,85,255],[255,172,89,255],[255,174,93,255],[255,176,97,255],[255,178,101,255],[255,180,105,255],[255,182,109,255],[255,184,113,255],[255,186,117,255],[255,188,121,255],[255,190,125,255],[255,192,129,255],[255,194,133,255],[255,196,137,255],[255,198,141,255],[255,200,145,255],[255,202,149,255],[255,204,153,255],[255,206,157,255],[255,208,161,255],[255,210,165,255],[255,212,170,255],[255,214,174,255],[255,216,178,255],[255,218,182,255],[255,220,186,255],[255,222,190,255],[255,224,194,255],[255,226,198,255],[255,228,202,255],[255,230,206,255],[255,232,210,255],[255,234,214,255],[255,236,218,255],[255,238,222,255],[255,240,226,255],[255,242,230,255],[255,244,234,255],[255,246,238,255],[255,248,242,255],[255,250,246,255],[255,252,250,255],[255,255,255,255]]},hotMetalBlue:{name:"Hot Metal Blue",numColors:256,colors:[[0,0,0,255],[0,0,2,255],[0,0,4,255],[0,0,6,255],[0,0,8,255],[0,0,10,255],[0,0,12,255],[0,0,14,255],[0,0,16,255],[0,0,17,255],[0,0,19,255],[0,0,21,255],[0,0,23,255],[0,0,25,255],[0,0,27,255],[0,0,29,255],[0,0,31,255],[0,0,33,255],[0,0,35,255],[0,0,37,255],[0,0,39,255],[0,0,41,255],[0,0,43,255],[0,0,45,255],[0,0,47,255],[0,0,49,255],[0,0,51,255],[0,0,53,255],[0,0,55,255],[0,0,57,255],[0,0,59,255],[0,0,61,255],[0,0,63,255],[0,0,65,255],[0,0,67,255],[0,0,69,255],[0,0,71,255],[0,0,73,255],[0,0,75,255],[0,0,77,255],[0,0,79,255],[0,0,81,255],[0,0,83,255],[0,0,84,255],[0,0,86,255],[0,0,88,255],[0,0,90,255],[0,0,92,255],[0,0,94,255],[0,0,96,255],[0,0,98,255],[0,0,100,255],[0,0,102,255],[0,0,104,255],[0,0,106,255],[0,0,108,255],[0,0,110,255],[0,0,112,255],[0,0,114,255],[0,0,116,255],[0,0,117,255],[0,0,119,255],[0,0,121,255],[0,0,123,255],[0,0,125,255],[0,0,127,255],[0,0,129,255],[0,0,131,255],[0,0,133,255],[0,0,135,255],[0,0,137,255],[0,0,139,255],[0,0,141,255],[0,0,143,255],[0,0,145,255],[0,0,147,255],[0,0,149,255],[0,0,151,255],[0,0,153,255],[0,0,155,255],[0,0,157,255],[0,0,159,255],[0,0,161,255],[0,0,163,255],[0,0,165,255],[0,0,167,255],[3,0,169,255],[6,0,171,255],[9,0,173,255],[12,0,175,255],[15,0,177,255],[18,0,179,255],[21,0,181,255],[24,0,183,255],[26,0,184,255],[29,0,186,255],[32,0,188,255],[35,0,190,255],[38,0,192,255],[41,0,194,255],[44,0,196,255],[47,0,198,255],[50,0,200,255],[52,0,197,255],[55,0,194,255],[57,0,191,255],[59,0,188,255],[62,0,185,255],[64,0,182,255],[66,0,179,255],[69,0,176,255],[71,0,174,255],[74,0,171,255],[76,0,168,255],[78,0,165,255],[81,0,162,255],[83,0,159,255],[85,0,156,255],[88,0,153,255],[90,0,150,255],[93,2,144,255],[96,4,138,255],[99,6,132,255],[102,8,126,255],[105,9,121,255],[108,11,115,255],[111,13,109,255],[114,15,103,255],[116,17,97,255],[119,19,91,255],[122,21,85,255],[125,23,79,255],[128,24,74,255],[131,26,68,255],[134,28,62,255],[137,30,56,255],[140,32,50,255],[143,34,47,255],[146,36,44,255],[149,38,41,255],[152,40,38,255],[155,41,35,255],[158,43,32,255],[161,45,29,255],[164,47,26,255],[166,49,24,255],[169,51,21,255],[172,53,18,255],[175,55,15,255],[178,56,12,255],[181,58,9,255],[184,60,6,255],[187,62,3,255],[190,64,0,255],[194,66,0,255],[198,68,0,255],[201,70,0,255],[205,72,0,255],[209,73,0,255],[213,75,0,255],[217,77,0,255],[221,79,0,255],[224,81,0,255],[228,83,0,255],[232,85,0,255],[236,87,0,255],[240,88,0,255],[244,90,0,255],[247,92,0,255],[251,94,0,255],[255,96,0,255],[255,98,3,255],[255,100,6,255],[255,102,9,255],[255,104,12,255],[255,105,15,255],[255,107,18,255],[255,109,21,255],[255,111,24,255],[255,113,26,255],[255,115,29,255],[255,117,32,255],[255,119,35,255],[255,120,38,255],[255,122,41,255],[255,124,44,255],[255,126,47,255],[255,128,50,255],[255,130,53,255],[255,132,56,255],[255,134,59,255],[255,136,62,255],[255,137,65,255],[255,139,68,255],[255,141,71,255],[255,143,74,255],[255,145,76,255],[255,147,79,255],[255,149,82,255],[255,151,85,255],[255,152,88,255],[255,154,91,255],[255,156,94,255],[255,158,97,255],[255,160,100,255],[255,162,103,255],[255,164,106,255],[255,166,109,255],[255,168,112,255],[255,169,115,255],[255,171,118,255],[255,173,121,255],[255,175,124,255],[255,177,126,255],[255,179,129,255],[255,181,132,255],[255,183,135,255],[255,184,138,255],[255,186,141,255],[255,188,144,255],[255,190,147,255],[255,192,150,255],[255,194,153,255],[255,196,156,255],[255,198,159,255],[255,200,162,255],[255,201,165,255],[255,203,168,255],[255,205,171,255],[255,207,174,255],[255,209,176,255],[255,211,179,255],[255,213,182,255],[255,215,185,255],[255,216,188,255],[255,218,191,255],[255,220,194,255],[255,222,197,255],[255,224,200,255],[255,226,203,255],[255,228,206,255],[255,229,210,255],[255,231,213,255],[255,233,216,255],[255,235,219,255],[255,237,223,255],[255,239,226,255],[255,240,229,255],[255,242,232,255],[255,244,236,255],[255,246,239,255],[255,248,242,255],[255,250,245,255],[255,251,249,255],[255,253,252,255],[255,255,255,255]]},pet20Step:{name:"PET 20 Step",numColors:256,colors:[[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255]]},gray:{name:"Gray",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,1,1]],green:[[0,0,0],[1,1,1]],blue:[[0,0,0],[1,1,1]]}},jet:{name:"Jet",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.35,0,0],[.66,1,1],[.89,1,1],[1,.5,.5]],green:[[0,0,0],[.125,0,0],[.375,1,1],[.64,1,1],[.91,0,0],[1,0,0]],blue:[[0,.5,.5],[.11,1,1],[.34,1,1],[.65,0,0],[1,0,0]]}},hsv:{name:"HSV",numColors:256,gamma:1,segmentedData:{red:[[0,1,1],[.15873,1,1],[.174603,.96875,.96875],[.333333,.03125,.03125],[.349206,0,0],[.666667,0,0],[.68254,.03125,.03125],[.84127,.96875,.96875],[.857143,1,1],[1,1,1]],green:[[0,0,0],[.15873,.9375,.9375],[.174603,1,1],[.507937,1,1],[.666667,.0625,.0625],[.68254,0,0],[1,0,0]],blue:[[0,0,0],[.333333,0,0],[.349206,.0625,.0625],[.507937,1,1],[.84127,1,1],[.857143,.9375,.9375],[1,.09375,.09375]]}},hot:{name:"Hot",numColors:256,gamma:1,segmentedData:{red:[[0,.0416,.0416],[.365079,1,1],[1,1,1]],green:[[0,0,0],[.365079,0,0],[.746032,1,1],[1,1,1]],blue:[[0,0,0],[.746032,0,0],[1,1,1]]}},cool:{name:"Cool",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,1,1]],green:[[0,1,1],[1,0,0]],blue:[[0,1,1],[1,1,1]]}},spring:{name:"Spring",numColors:256,gamma:1,segmentedData:{red:[[0,1,1],[1,1,1]],green:[[0,0,0],[1,1,1]],blue:[[0,1,1],[1,0,0]]}},summer:{name:"Summer",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,1,1]],green:[[0,.5,.5],[1,1,1]],blue:[[0,.4,.4],[1,.4,.4]]}},autumn:{name:"Autumn",numColors:256,gamma:1,segmentedData:{red:[[0,1,1],[1,1,1]],green:[[0,0,0],[1,1,1]],blue:[[0,0,0],[1,0,0]]}},winter:{name:"Winter",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,0,0]],green:[[0,0,0],[1,1,1]],blue:[[0,1,1],[1,.5,.5]]}},bone:{name:"Bone",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.746032,.652778,.652778],[1,1,1]],green:[[0,0,0],[.365079,.319444,.319444],[.746032,.777778,.777778],[1,1,1]],blue:[[0,0,0],[.365079,.444444,.444444],[1,1,1]]}},copper:{name:"Copper",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.809524,1,1],[1,1,1]],green:[[0,0,0],[1,.7812,.7812]],blue:[[0,0,0],[1,.4975,.4975]]}},spectral:{name:"Spectral",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.05,.4667,.4667],[.1,.5333,.5333],[.15,0,0],[.2,0,0],[.25,0,0],[.3,0,0],[.35,0,0],[.4,0,0],[.45,0,0],[.5,0,0],[.55,0,0],[.6,0,0],[.65,.7333,.7333],[.7,.9333,.9333],[.75,1,1],[.8,1,1],[.85,1,1],[.9,.8667,.8667],[.95,.8,.8],[1,.8,.8]],green:[[0,0,0],[.05,0,0],[.1,0,0],[.15,0,0],[.2,0,0],[.25,.4667,.4667],[.3,.6,.6],[.35,.6667,.6667],[.4,.6667,.6667],[.45,.6,.6],[.5,.7333,.7333],[.55,.8667,.8667],[.6,1,1],[.65,1,1],[.7,.9333,.9333],[.75,.8,.8],[.8,.6,.6],[.85,0,0],[.9,0,0],[.95,0,0],[1,.8,.8]],blue:[[0,0,0],[.05,.5333,.5333],[.1,.6,.6],[.15,.6667,.6667],[.2,.8667,.8667],[.25,.8667,.8667],[.3,.8667,.8667],[.35,.6667,.6667],[.4,.5333,.5333],[.45,0,0],[.5,0,0],[.55,0,0],[.6,0,0],[.65,0,0],[.7,0,0],[.75,0,0],[.8,0,0],[.85,0,0],[.9,0,0],[.95,0,0],[1,.8,.8]]}},coolwarm:{name:"CoolWarm",numColors:256,gamma:1,segmentedData:{red:[[0,.2298057,.2298057],[.03125,.26623388,.26623388],[.0625,.30386891,.30386891],[.09375,.342804478,.342804478],[.125,.38301334,.38301334],[.15625,.424369608,.424369608],[.1875,.46666708,.46666708],[.21875,.509635204,.509635204],[.25,.552953156,.552953156],[.28125,.596262162,.596262162],[.3125,.639176211,.639176211],[.34375,.681291281,.681291281],[.375,.722193294,.722193294],[.40625,.761464949,.761464949],[.4375,.798691636,.798691636],[.46875,.833466556,.833466556],[.5,.865395197,.865395197],[.53125,.897787179,.897787179],[.5625,.924127593,.924127593],[.59375,.944468518,.944468518],[.625,.958852946,.958852946],[.65625,.96732803,.96732803],[.6875,.969954137,.969954137],[.71875,.966811177,.966811177],[.75,.958003065,.958003065],[.78125,.943660866,.943660866],[.8125,.923944917,.923944917],[.84375,.89904617,.89904617],[.875,.869186849,.869186849],[.90625,.834620542,.834620542],[.9375,.795631745,.795631745],[.96875,.752534934,.752534934],[1,.705673158,.705673158]],green:[[0,.298717966,.298717966],[.03125,.353094838,.353094838],[.0625,.406535296,.406535296],[.09375,.458757618,.458757618],[.125,.50941904,.50941904],[.15625,.558148092,.558148092],[.1875,.604562568,.604562568],[.21875,.648280772,.648280772],[.25,.688929332,.688929332],[.28125,.726149107,.726149107],[.3125,.759599947,.759599947],[.34375,.788964712,.788964712],[.375,.813952739,.813952739],[.40625,.834302879,.834302879],[.4375,.849786142,.849786142],[.46875,.860207984,.860207984],[.5,.86541021,.86541021],[.53125,.848937047,.848937047],[.5625,.827384882,.827384882],[.59375,.800927443,.800927443],[.625,.769767752,.769767752],[.65625,.734132809,.734132809],[.6875,.694266682,.694266682],[.71875,.650421156,.650421156],[.75,.602842431,.602842431],[.78125,.551750968,.551750968],[.8125,.49730856,.49730856],[.84375,.439559467,.439559467],[.875,.378313092,.378313092],[.90625,.312874446,.312874446],[.9375,.24128379,.24128379],[.96875,.157246067,.157246067],[1,.01555616,.01555616]],blue:[[0,.753683153,.753683153],[.03125,.801466763,.801466763],[.0625,.84495867,.84495867],[.09375,.883725899,.883725899],[.125,.917387822,.917387822],[.15625,.945619588,.945619588],[.1875,.968154911,.968154911],[.21875,.98478814,.98478814],[.25,.995375608,.995375608],[.28125,.999836203,.999836203],[.3125,.998151185,.998151185],[.34375,.990363227,.990363227],[.375,.976574709,.976574709],[.40625,.956945269,.956945269],[.4375,.931688648,.931688648],[.46875,.901068838,.901068838],[.5,.865395561,.865395561],[.53125,.820880546,.820880546],[.5625,.774508472,.774508472],[.59375,.726736146,.726736146],[.625,.678007945,.678007945],[.65625,.628751763,.628751763],[.6875,.579375448,.579375448],[.71875,.530263762,.530263762],[.75,.481775914,.481775914],[.78125,.434243684,.434243684],[.8125,.387970225,.387970225],[.84375,.343229596,.343229596],[.875,.300267182,.300267182],[.90625,.259301199,.259301199],[.9375,.220525627,.220525627],[.96875,.184115123,.184115123],[1,.150232812,.150232812]]}},blues:{name:"Blues",numColors:256,gamma:1,segmentedData:{red:[[0,.9686274528503418,.9686274528503418],[.125,.8705882430076599,.8705882430076599],[.25,.7764706015586853,.7764706015586853],[.375,.6196078658103943,.6196078658103943],[.5,.41960784792900085,.41960784792900085],[.625,.25882354378700256,.25882354378700256],[.75,.12941177189350128,.12941177189350128],[.875,.0313725508749485,.0313725508749485],[1,.0313725508749485,.0313725508749485]],green:[[0,.9843137264251709,.9843137264251709],[.125,.9215686321258545,.9215686321258545],[.25,.8588235378265381,.8588235378265381],[.375,.7921568751335144,.7921568751335144],[.5,.6823529601097107,.6823529601097107],[.625,.572549045085907,.572549045085907],[.75,.4431372582912445,.4431372582912445],[.875,.3176470696926117,.3176470696926117],[1,.1882352977991104,.1882352977991104]],blue:[[0,1,1],[.125,.9686274528503418,.9686274528503418],[.25,.9372549057006836,.9372549057006836],[.375,.8823529481887817,.8823529481887817],[.5,.8392156958580017,.8392156958580017],[.625,.7764706015586853,.7764706015586853],[.75,.7098039388656616,.7098039388656616],[.875,.6117647290229797,.6117647290229797],[1,.41960784792900085,.41960784792900085]]}}},Ki={MINIMUM_SLAB_THICKNESS:.05,MAXIMUM_RAY_DISTANCE:1e6};Object.freeze(Ki);const _u=.001;function o2e(t){const e=Object.getOwnPropertyNames(t);for(const n of e){const r=t[n];r&&typeof r=="object"&&o2e(r)}return Object.freeze(t)}const Dwt={axial:{viewPlaneNormal:[0,0,-1],viewUp:[0,-1,0],viewRight:[1,0,0]},sagittal:{viewPlaneNormal:[1,0,0],viewUp:[0,0,1],viewRight:[0,1,0]},coronal:{viewPlaneNormal:[0,-1,0],viewUp:[0,0,1],viewRight:[1,0,0]}},W0=o2e(Dwt),s2e=[{name:"CT-AAA",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"12 -3024 0 143.556 0 166.222 0.686275 214.389 0.696078 419.736 0.833333 3071 0.803922",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"24 -3024 0 0 0 143.556 0.615686 0.356863 0.184314 166.222 0.882353 0.603922 0.290196 214.389 1 1 1 419.736 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-AAA2",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"16 -3024 0 129.542 0 145.244 0.166667 157.02 0.5 169.918 0.627451 395.575 0.8125 1578.73 0.8125 3071 0.8125",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"32 -3024 0 0 0 129.542 0.54902 0.25098 0.14902 145.244 0.6 0.627451 0.843137 157.02 0.890196 0.47451 0.6 169.918 0.992157 0.870588 0.392157 395.575 1 0.886275 0.658824 1578.73 1 0.829256 0.957922 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Bone",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"8 -3024 0 -16.4458 0 641.385 0.715686 3071 0.705882",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"16 -3024 0 0 0 -16.4458 0.729412 0.254902 0.301961 641.385 0.905882 0.815686 0.552941 3071 1 1 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Bones",gradientOpacity:"4 0 1 985.12 1",specularPower:"1",scalarOpacity:"8 -1000 0 152.19 0 278.93 0.190476 952 0.2",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"20 -1000 0.3 0.3 1 -488 0.3 1 0.3 463.28 1 0 0 659.15 1 0.912535 0.0374849 953 1 0.3 0.3",diffuse:"1",interpolation:"1"},{name:"CT-Cardiac",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"12 -3024 0 -77.6875 0 94.9518 0.285714 179.052 0.553571 260.439 0.848214 3071 0.875",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"24 -3024 0 0 0 -77.6875 0.54902 0.25098 0.14902 94.9518 0.882353 0.603922 0.290196 179.052 1 0.937033 0.954531 260.439 0.615686 0 0 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Cardiac2",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"12 -3024 0 42.8964 0 163.488 0.428571 277.642 0.776786 1587 0.754902 3071 0.754902",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"24 -3024 0 0 0 42.8964 0.54902 0.25098 0.14902 163.488 0.917647 0.639216 0.0588235 277.642 1 0.878431 0.623529 1587 1 1 1 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Cardiac3",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"14 -3024 0 -86.9767 0 45.3791 0.169643 139.919 0.589286 347.907 0.607143 1224.16 0.607143 3071 0.616071",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"28 -3024 0 0 0 -86.9767 0 0.25098 1 45.3791 1 0 0 139.919 1 0.894893 0.894893 347.907 1 1 0.25098 1224.16 1 1 1 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Chest-Contrast-Enhanced",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"10 -3024 0 67.0106 0 251.105 0.446429 439.291 0.625 3071 0.616071",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"20 -3024 0 0 0 67.0106 0.54902 0.25098 0.14902 251.105 0.882353 0.603922 0.290196 439.291 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Chest-Vessels",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"10 -3024 0 -1278.35 0 22.8277 0.428571 439.291 0.625 3071 0.616071",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"20 -3024 0 0 0 -1278.35 0.54902 0.25098 0.14902 22.8277 0.882353 0.603922 0.290196 439.291 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"1",interpolation:"1"},{name:"CT-Coronary-Arteries",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"12 -2048 0 136.47 0 159.215 0.258929 318.43 0.571429 478.693 0.776786 3661 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"24 -2048 0 0 0 136.47 0 0 0 159.215 0.159804 0.159804 0.159804 318.43 0.764706 0.764706 0.764706 478.693 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Coronary-Arteries-2",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"14 -2048 0 142.677 0 145.016 0.116071 192.174 0.5625 217.24 0.776786 384.347 0.830357 3661 0.830357",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"28 -2048 0 0 0 142.677 0 0 0 145.016 0.615686 0 0.0156863 192.174 0.909804 0.454902 0 217.24 0.972549 0.807843 0.611765 384.347 0.909804 0.909804 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Coronary-Arteries-3",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"14 -2048 0 128.643 0 129.982 0.0982143 173.636 0.669643 255.884 0.857143 584.878 0.866071 3661 1",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"28 -2048 0 0 0 128.643 0 0 0 129.982 0.615686 0 0.0156863 173.636 0.909804 0.454902 0 255.884 0.886275 0.886275 0.886275 584.878 0.968627 0.968627 0.968627 3661 1 1 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Cropped-Volume-Bone",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"10 -2048 0 -451 0 -450 1 1050 1 3661 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"20 -2048 0 0 0 -451 0 0 0 -450 0.0556356 0.0556356 0.0556356 1050 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Fat",gradientOpacity:"6 0 1 985.12 1 988 1",specularPower:"1",scalarOpacity:"14 -1000 0 -100 0 -99 0.15 -60 0.15 -59 0 101.2 0 952 0",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"36 -1000 0.3 0.3 1 -497.5 0.3 1 0.3 -99 0 0 1 -76.946 0 1 0 -65.481 0.835431 0.888889 0.0165387 83.89 1 0 0 463.28 1 0 0 659.15 1 0.912535 0.0374849 2952 1 0.300267 0.299886",diffuse:"1",interpolation:"1"},{name:"CT-Liver-Vasculature",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"14 -2048 0 149.113 0 157.884 0.482143 339.96 0.660714 388.526 0.830357 1197.95 0.839286 3661 0.848214",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"28 -2048 0 0 0 149.113 0 0 0 157.884 0.501961 0.25098 0 339.96 0.695386 0.59603 0.36886 388.526 0.854902 0.85098 0.827451 1197.95 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Lung",gradientOpacity:"6 0 1 985.12 1 988 1",specularPower:"1",scalarOpacity:"12 -1000 0 -600 0 -599 0.15 -400 0.15 -399 0 2952 0",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"24 -1000 0.3 0.3 1 -600 0 0 1 -530 0.134704 0.781726 0.0724558 -460 0.929244 1 0.109473 -400 0.888889 0.254949 0.0240258 2952 1 0.3 0.3",diffuse:"1",interpolation:"1"},{name:"CT-MIP",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"8 -3024 0 -637.62 0 700 1 3071 1",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"16 -3024 0 0 0 -637.62 1 1 1 700 1 1 1 3071 1 1 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Muscle",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"10 -3024 0 -155.407 0 217.641 0.676471 419.736 0.833333 3071 0.803922",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"20 -3024 0 0 0 -155.407 0.54902 0.25098 0.14902 217.641 0.882353 0.603922 0.290196 419.736 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Pulmonary-Arteries",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"14 -2048 0 -568.625 0 -364.081 0.0714286 -244.813 0.401786 18.2775 0.607143 447.798 0.830357 3592.73 0.839286",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"28 -2048 0 0 0 -568.625 0 0 0 -364.081 0.396078 0.301961 0.180392 -244.813 0.611765 0.352941 0.0705882 18.2775 0.843137 0.0156863 0.156863 447.798 0.752941 0.752941 0.752941 3592.73 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Soft-Tissue",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"10 -2048 0 -167.01 0 -160 1 240 1 3661 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"20 -2048 0 0 0 -167.01 0 0 0 -160 0.0556356 0.0556356 0.0556356 240 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Air",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"8 -3024 0.705882 -900.0 0.715686 -500.0 0 3071 0",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"16 -3024 1 1 1 -900.0 0.2 1.0 1.0 -500.0 0.3 0.3 1.0 3071 0 0 0 ",diffuse:"0.9",interpolation:"1"},{name:"MR-Angio",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"12 -2048 0 151.354 0 158.279 0.4375 190.112 0.580357 200.873 0.732143 3661 0.741071",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"24 -2048 0 0 0 151.354 0 0 0 158.279 0.74902 0.376471 0 190.112 1 0.866667 0.733333 200.873 0.937255 0.937255 0.937255 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"MR-Default",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"12 0 0 20 0 40 0.15 120 0.3 220 0.375 1024 0.5",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"24 0 0 0 0 20 0.168627 0 0 40 0.403922 0.145098 0.0784314 120 0.780392 0.607843 0.380392 220 0.847059 0.835294 0.788235 1024 1 1 1",diffuse:"1",interpolation:"1"},{name:"MR-MIP",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"8 0 0 98.3725 0 416.637 1 2800 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"16 0 1 1 1 98.3725 1 1 1 416.637 1 1 1 2800 1 1 1",diffuse:"1",interpolation:"1"},{name:"MR-T2-Brain",gradientOpacity:"4 0 1 160.25 1",specularPower:"40",scalarOpacity:"10 0 0 36.05 0 218.302 0.171429 412.406 1 641 1",specular:"0.5",shade:"1",ambient:"0.3",colorTransfer:"16 0 0 0 0 98.7223 0.956863 0.839216 0.192157 412.406 0 0.592157 0.807843 641 1 1 1",diffuse:"0.6",interpolation:"1"},{name:"DTI-FA-Brain",gradientOpacity:"4 0 1 0.9950 1",specularPower:"40",scalarOpacity:"16 0 0 0 0 0.3501 0.0158 0.49379 0.7619 0.6419 1 0.9920 1 0.9950 0 0.9950 0",specular:"0.5",shade:"1",ambient:"0.3",colorTransfer:"28 0 1 0 0 0 1 0 0 0.24974 0.4941 1 0 0.49949 0 0.9882 1 0.7492 0.51764 0 1 0.9950 1 0 0 0.9950 1 0 0",diffuse:"0.9",interpolation:"1"}],Mwt={slicer3D:[160/255,164/255,217/255]},wU=Object.freeze(Object.defineProperty({__proto__:null,BACKGROUND_COLORS:Mwt,CPU_COLORMAPS:GP,EPSILON:_u,MPR_CAMERA_VALUES:W0,RENDERING_DEFAULTS:Ki,VIEWPORT_PRESETS:s2e},Symbol.toStringTag,{value:"Module"})),Jx={},Ww={get:t=>Jx[t],set:t=>{const e=t.id;Jx[e]=t},delete:t=>delete Jx[t],getAll:()=>{const e=Object.keys(Jx).map(n=>Jx[n]);return e.sort((n,r)=>n.id[0]==="_"&&r.id[0]!=="_"?1:n.id[0]!=="_"&&r.id[0]==="_"?-1:0),e}};function O1(t){return Ww.get(t)}function Ld(){return Ww.getAll()}const MT=t=>t&&typeof t=="object"&&Object.prototype.toString.call(t)!=="[object RegExp]"&&Object.prototype.toString.call(t)!=="[object Date]",Rwt=t=>Array.isArray(t)?[]:{},Hw=(t,e)=>e&&e.clone===!0&&MT(t)?Ac(Rwt(t),t,e):t,jJ=(t,e,n)=>{const r=t.slice();return e.forEach(function(i,a){typeof r[a]>"u"?r[a]=Hw(i,n):MT(i)?r[a]=Ac(t[a],i,n):t.indexOf(i)===-1&&(r[a]=Hw(i,n))}),r},Iwt=(t,e,n)=>{const r={};return MT(t)&&Object.keys(t).forEach(function(i){r[i]=Hw(t[i],n)}),Object.keys(e).forEach(function(i){!MT(e[i])||!t[i]?r[i]=Hw(e[i],n):r[i]=Ac(t[i],e[i],n)}),r},Ac=(t={},e={},n=void 0)=>{const r=Array.isArray(e),a=(n||{arrayMerge:jJ}).arrayMerge||jJ;return r?Array.isArray(t)?a(t,e,n):Hw(e,n):Iwt(t,e,n)};/**
 * @license
 * Copyright 2019 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const c2e=Symbol("Comlink.proxy"),Nwt=Symbol("Comlink.endpoint"),l2e=Symbol("Comlink.releaseProxy"),uR=Symbol("Comlink.finalizer"),bC=Symbol("Comlink.thrown"),u2e=t=>typeof t=="object"&&t!==null||typeof t=="function",Pwt={canHandle:t=>u2e(t)&&t[c2e],serialize(t){const{port1:e,port2:n}=new MessageChannel;return bU(t,e),[n,[n]]},deserialize(t){return t.start(),WP(t)}},kwt={canHandle:t=>u2e(t)&&bC in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},f2e=new Map([["proxy",Pwt],["throw",kwt]]);function Awt(t,e){for(const n of t)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function bU(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!Awt(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:o,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(cm);let l;try{const u=s.slice(0,-1).reduce((d,h)=>d[h],t),f=s.reduce((d,h)=>d[h],t);switch(o){case"GET":l=f;break;case"SET":u[s.slice(-1)[0]]=cm(i.data.value),l=!0;break;case"APPLY":l=f.apply(u,c);break;case"CONSTRUCT":{const d=new f(...c);l=p2e(d)}break;case"ENDPOINT":{const{port1:d,port2:h}=new MessageChannel;bU(t,h),l=Uwt(d,[d])}break;case"RELEASE":l=void 0;break;default:return}}catch(u){l={value:u,[bC]:0}}Promise.resolve(l).catch(u=>({value:u,[bC]:0})).then(u=>{const[f,d]=NT(u);e.postMessage(Object.assign(Object.assign({},f),{id:a}),d),o==="RELEASE"&&(e.removeEventListener("message",r),d2e(e),uR in t&&typeof t[uR]=="function"&&t[uR]())}).catch(u=>{const[f,d]=NT({value:new TypeError("Unserializable return value"),[bC]:0});e.postMessage(Object.assign(Object.assign({},f),{id:a}),d)})}),e.start&&e.start()}function Lwt(t){return t.constructor.name==="MessagePort"}function d2e(t){Lwt(t)&&t.close()}function WP(t,e){const n=new Map;return t.addEventListener("message",function(i){const{data:a}=i;if(!a||!a.id)return;const o=n.get(a.id);if(o)try{o(a)}finally{n.delete(a.id)}}),HP(t,n,[],e)}function mS(t){if(t)throw new Error("Proxy has been released and is not useable")}function h2e(t){return Av(t,new Map,{type:"RELEASE"}).then(()=>{d2e(t)})}const RT=new WeakMap,IT="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(RT.get(t)||0)-1;RT.set(t,e),e===0&&h2e(t)});function Vwt(t,e){const n=(RT.get(e)||0)+1;RT.set(e,n),IT&&IT.register(t,e,t)}function $wt(t){IT&&IT.unregister(t)}function HP(t,e,n=[],r=function(){}){let i=!1;const a=new Proxy(r,{get(o,s){if(mS(i),s===l2e)return()=>{$wt(a),h2e(t),e.clear(),i=!0};if(s==="then"){if(n.length===0)return{then:()=>a};const c=Av(t,e,{type:"GET",path:n.map(l=>l.toString())}).then(cm);return c.then.bind(c)}return HP(t,e,[...n,s])},set(o,s,c){mS(i);const[l,u]=NT(c);return Av(t,e,{type:"SET",path:[...n,s].map(f=>f.toString()),value:l},u).then(cm)},apply(o,s,c){mS(i);const l=n[n.length-1];if(l===Nwt)return Av(t,e,{type:"ENDPOINT"}).then(cm);if(l==="bind")return HP(t,e,n.slice(0,-1));const[u,f]=UJ(c);return Av(t,e,{type:"APPLY",path:n.map(d=>d.toString()),argumentList:u},f).then(cm)},construct(o,s){mS(i);const[c,l]=UJ(s);return Av(t,e,{type:"CONSTRUCT",path:n.map(u=>u.toString()),argumentList:c},l).then(cm)}});return Vwt(a,t),a}function jwt(t){return Array.prototype.concat.apply([],t)}function UJ(t){const e=t.map(NT);return[e.map(n=>n[0]),jwt(e.map(n=>n[1]))]}const g2e=new WeakMap;function Uwt(t,e){return g2e.set(t,e),t}function p2e(t){return Object.assign(t,{[c2e]:!0})}function NT(t){for(const[e,n]of f2e)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},g2e.get(t)||[]]}function cm(t){switch(t.type){case"HANDLER":return f2e.get(t.name).deserialize(t.value);case"RAW":return t.value}}function Av(t,e,n,r){return new Promise(i=>{const a=Fwt();e.set(a,i),t.start&&t.start(),t.postMessage(Object.assign({id:a},n),r)})}function Fwt(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function ya(){return typeof crypto.randomUUID=="function"?crypto.randomUUID():("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}class SU{constructor(e){this.numRequests={[In.Interaction]:0,[In.Thumbnail]:0,[In.Prefetch]:0,[In.Compute]:0},this.id=e||ya(),this.requestPool={[In.Interaction]:{0:[]},[In.Thumbnail]:{0:[]},[In.Prefetch]:{0:[]},[In.Compute]:{0:[]}},this.grabDelay=5,this.awake=!1,this.numRequests={[In.Interaction]:0,[In.Thumbnail]:0,[In.Prefetch]:0,[In.Compute]:0},this.maxNumRequests={[In.Interaction]:6,[In.Thumbnail]:6,[In.Prefetch]:5,[In.Compute]:1e3}}setMaxSimultaneousRequests(e,n){this.maxNumRequests[e]=n}getMaxSimultaneousRequests(e){return this.maxNumRequests[e]}destroy(){this.timeoutHandle&&window.clearTimeout(this.timeoutHandle)}addRequest(e,n,r,i=0){const a={requestFn:e,type:n,additionalDetails:r};this.requestPool[n][i]===void 0&&(this.requestPool[n][i]=[]),this.requestPool[n][i].push(a),this.startGrabbing()}filterRequests(e){Object.keys(this.requestPool).forEach(n=>{const r=this.requestPool[n];Object.keys(r).forEach(i=>{r[i]=r[i].filter(a=>e(a))})})}clearRequestStack(e){if(!this.requestPool[e])throw new Error(`No category for the type ${e} found`);this.requestPool[e]={0:[]}}sendRequests(e){const n=this.maxNumRequests[e]-this.numRequests[e];let r=0;for(let i=0;i<n;i++){const a=this.getNextRequest(e);if(a===null)return!1;if(a){this.numRequests[e]++,this.awake=!0;let o;try{o=a.requestFn()}catch(s){console.warn("sendRequest failed",s)}o?.finally?o.finally(()=>{this.numRequests[e]--,this.startAgain()}):(this.numRequests[e]--,r++)}}return r&&this.startAgain(),!0}getNextRequest(e){const n=this.getSortedPriorityGroups(e);for(const r of n)if(this.requestPool[e][r].length)return this.requestPool[e][r].shift();return null}startGrabbing(){const e=this.sendRequests(In.Interaction),n=this.sendRequests(In.Thumbnail),r=this.sendRequests(In.Prefetch),i=this.sendRequests(In.Compute);!e&&!n&&!r&&!i&&(this.awake=!1)}startAgain(){this.awake&&(this.grabDelay!==void 0?this.timeoutHandle||(this.timeoutHandle=window.setTimeout(()=>{this.timeoutHandle=null,this.startGrabbing()},this.grabDelay)):this.startGrabbing())}getSortedPriorityGroups(e){return Object.keys(this.requestPool[e]).map(Number).filter(r=>this.requestPool[e][r].length).sort((r,i)=>r-i)}getRequestPool(){return this.requestPool}}class m2e{constructor(){this.workerRegistry={},this.workerPoolManager=new SU("webworker")}registerWorker(e,n,r={}){const{maxWorkerInstances:i=1,overwrite:a=!1,autoTerminateOnIdle:o={enabled:!1,idleTimeThreshold:3e3}}=r;if(this.workerRegistry[e]&&!a){console.warn(`Worker type '${e}' is already registered...`);return}a&&this.workerRegistry[e]?.idleCheckIntervalId&&clearInterval(this.workerRegistry[e].idleCheckIntervalId);const s={workerFn:null,instances:[],loadCounters:[],lastActiveTime:[],nativeWorkers:[],autoTerminateOnIdle:o.enabled,idleCheckIntervalId:null,idleTimeThreshold:o.idleTimeThreshold};s.loadCounters=Array(i).fill(0),s.lastActiveTime=Array(i).fill(null);for(let c=0;c<i;c++){const l=n();s.instances.push(WP(l)),s.nativeWorkers.push(l),s.workerFn=n}this.workerRegistry[e]=s}getNextWorkerAPI(e){const n=this.workerRegistry[e];if(!n)return console.error(`Worker type '${e}' is not registered.`),null;const r=n.instances.filter(o=>o!==null);let i=0,a=n.loadCounters[0]||0;for(let o=1;o<r.length;o++){const s=n.loadCounters[o]||0;s<a&&(i=o,a=s)}if(n.instances[i]===null){const o=n.workerFn();n.instances[i]=WP(o),n.nativeWorkers[i]=o}return n.loadCounters[i]+=1,{api:n.instances[i],index:i}}executeTask(e,n,r={},{requestType:i=In.Compute,priority:a=0,options:o={},callbacks:s=[]}={}){return new Promise((c,l)=>{const u=async()=>{const{api:f,index:d}=this.getNextWorkerAPI(e);if(!f){const h=new Error(`No available worker instance for '${e}'`);console.error(h),l(h);return}try{let h=[];s.length&&(h=s.map(y=>p2e(y)));const m=this.workerRegistry[e];m.processing=!0;const p=await f[n](r,...h);m.processing=!1,m.lastActiveTime[d]=Date.now(),m.autoTerminateOnIdle&&!m.idleCheckIntervalId&&m.idleTimeThreshold&&(m.idleCheckIntervalId=setInterval(()=>{this.terminateIdleWorkers(e,m.idleTimeThreshold)},m.idleTimeThreshold)),c(p)}catch(h){console.error(`Error executing method '${n}' on worker '${e}':`,h),l(h)}finally{this.workerRegistry[e].loadCounters[d]--}};this.workerPoolManager.addRequest(u,i,o,a)})}terminateIdleWorkers(e,n){const r=this.workerRegistry[e];if(r.processing)return;const i=Date.now();r.instances.forEach((a,o)=>{const s=r.lastActiveTime[o],c=s!==null&&r.loadCounters[o]>0,l=i-s;!c&&l>n&&this.terminateWorkerInstance(e,o)})}terminate(e){const n=this.workerRegistry[e];if(!n){console.error(`Worker type '${e}' is not registered.`);return}n.instances.forEach((r,i)=>{this.terminateWorkerInstance(e,i)})}terminateWorkerInstance(e,n){const r=this.workerRegistry[e],i=r.instances[n];i!==null&&(i[l2e](),r.nativeWorkers[n].terminate(),r.instances[n]=null,r.lastActiveTime[n]=null)}}const fR=4,Bwt=5,zwt=1,FJ=[1,1];function BJ({ext:t,filterType:e,texData:n,internalFormat:r,glDataType:i}){try{const a=document.createElement("canvas");a.width=fR,a.height=fR;const o=a.getContext("webgl2");if(!o)return!1;const s=`#version 300 es
    void main() {
      gl_PointSize = ${fR.toFixed(1)};
      gl_Position = vec4(0, 0, 0, 1);
    }
  `,c=`#version 300 es
    precision highp float;
    precision highp int;
    precision highp sampler2D;

    uniform sampler2D u_image;

    out vec4 color;

    void main() {
        vec4 intColor = texture(u_image, gl_PointCoord.xy);
        color = vec4(vec3(intColor.rrr), 1);
    }
    `;let l;if(t&&(l=o.getExtension(t),!l))return!1;const u=o.createShader(o.VERTEX_SHADER);if(o.shaderSource(u,s),o.compileShader(u),!o.getShaderParameter(u,o.COMPILE_STATUS))return!1;const f=o.createShader(o.FRAGMENT_SHADER);if(o.shaderSource(f,c),o.compileShader(f),!o.getShaderParameter(f,o.COMPILE_STATUS))return!1;const d=o.createProgram();if(o.attachShader(d,u),o.attachShader(d,f),o.linkProgram(d),!o.getProgramParameter(d,o.LINK_STATUS))return!1;const h=o.createTexture();o.bindTexture(o.TEXTURE_2D,h),o.texImage2D(o.TEXTURE_2D,0,r(o,l),Bwt,zwt,0,o.RED,i(o,l),n);const m=e==="LINEAR"?o.LINEAR:o.NEAREST;o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,m),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,m),o.useProgram(d),o.drawArrays(o.POINTS,0,1);const p=new Uint8Array(4);o.readPixels(FJ[0],FJ[1],1,1,o.RGBA,o.UNSIGNED_BYTE,p);const[y,x,S]=p,C=o.getExtension("WEBGL_lose_context");return C&&C.loseContext(),y===x&&x===S&&y!==0}catch{return!1}}function Gwt(){const t=new Int16Array([32767,2e3,3e3,4e3,5e3,16784,7e3,8e3,9e3,32767]);return{norm16:BJ({ext:"EXT_texture_norm16",filterType:"NEAREST",texData:t,internalFormat:(e,n)=>n.R16_SNORM_EXT,glDataType:e=>e.SHORT}),norm16Linear:BJ({ext:"EXT_texture_norm16",filterType:"LINEAR",texData:t,internalFormat:(e,n)=>n.R16_SNORM_EXT,glDataType:e=>e.SHORT})}}let b5=!1;const qP={gpuTier:{tier:2},isMobile:!1,rendering:{useCPURendering:!1,preferSizeOverAccuracy:!1,useLegacyCameraFOV:!1,strictZSpacingForVolumeViewport:!0,renderingEngineMode:o1.ContextPool,webGlContextCount:7,volumeRendering:{sampleDistanceMultiplier:1}},debug:{statsOverlay:!1},peerImport:t=>null};let b0={...qP,rendering:{...qP.rendering}},H5=null,v2e=!1;function Wwt(){const t=document.createElement("canvas");return t.getContext("webgl2")||t.getContext("webgl")||t.getContext("experimental-webgl")}function Hwt(){const t=Wwt();return t instanceof WebGLRenderingContext||t instanceof WebGL2RenderingContext}function qwt(){const t=Gwt();return t.norm16&&t.norm16Linear}function y2e(){return/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&navigator.platform.includes("MacIntel")}function Kwt(t=b0){return b5||(v2e=qwt(),b0=Ac(qP,t),b0.isMobile&&(b0.rendering.webGlContextCount=1),y2e()&&(t.rendering?.preferSizeOverAccuracy?b0.rendering.preferSizeOverAccuracy=!0:console.log("norm16 texture not supported, you can turn on the preferSizeOverAccuracy flag to use native data type, but be aware of the inaccuracy of the rendering in high bits")),Hwt()?console.log("CornerstoneRender: using GPU rendering"):(console.log("CornerstoneRender: GPU not detected, using CPU rendering"),b0.rendering.useCPURendering=!0),b5=!0,H5||(H5=new m2e),b5)}function Ywt(){return v2e}function CU(){return!y2e()}function q5(){return b0.rendering.useCPURendering}function Xwt(){return b5}function mf(){return b0}function x2e(){return H5||(H5=new m2e),H5}async function Zwt(t){return b0.peerImport(t)}class Qwt{constructor(){this.listeners={},this.debouncedListeners={}}reset(){this.listeners={},this.debouncedListeners={}}addEventListenerOnce(e,n){const r=i=>{this.removeEventListener(e,r),n.call(this,i)};this.addEventListener(e,r)}addEventListener(e,n){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].indexOf(n)===-1&&this.listeners[e].push(n)}addEventListenerDebounced(e,n,r){this.debouncedListeners[e]=this.debouncedListeners[e]||{};const i=this.debouncedListeners[e];if(!i[n]){const a=o=>{i[n]&&clearTimeout(i[n].timeoutId),i[n].timeoutId=setTimeout(()=>{n.call(this,o)},r)};i[n]={original:n,handle:a,timeoutId:null},this.addEventListener(e,a)}}removeEventListenerDebounced(e,n){if(this.debouncedListeners[e]?.[n]){const r=this.debouncedListeners[e][n];this.removeEventListener(e,r.handle),clearTimeout(r.timeoutId),delete this.debouncedListeners[e][n]}}removeEventListener(e,n){if(!this.listeners[e])return;const r=this.listeners[e],i=r.length;for(let a=0;a<i;a++)if(r[a]===n){r.splice(a,1);return}}dispatchEvent(e){if(!this.listeners[e.type])return!e.defaultPrevented;const n=this.listeners[e.type].slice(),r=n.length;for(let i=0;i<r;i++)try{n[i].call(this,e)}catch(a){console.error(`error in event listener of type:  ${e.type}`,a)}return!e.defaultPrevented}}const pt=new Qwt;function dt(t=pt,e,n=null){if(!e)throw new Error("Event type was not defined");const r=new CustomEvent(e,{detail:n,cancelable:!0});return t?.dispatchEvent(r)}var dR,zJ;function Jwt(){return zJ||(zJ=1,dR=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(a=Object.keys(e),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),dR}var ebt=Jwt();const _U=ka(ebt);var hR,GJ;function w2e(){if(GJ)return hR;GJ=1;var t=Object.prototype.toString;return hR=function(n){var r=t.call(n),i=r==="[object Arguments]";return i||(i=r!=="[object Array]"&&n!==null&&typeof n=="object"&&typeof n.length=="number"&&n.length>=0&&t.call(n.callee)==="[object Function]"),i},hR}var gR,WJ;function tbt(){if(WJ)return gR;WJ=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=w2e(),i=Object.prototype.propertyIsEnumerable,a=!i.call({toString:null},"toString"),o=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(d){var h=d.constructor;return h&&h.prototype===d},l={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},u=(function(){if(typeof window>"u")return!1;for(var d in window)try{if(!l["$"+d]&&e.call(window,d)&&window[d]!==null&&typeof window[d]=="object")try{c(window[d])}catch{return!0}}catch{return!0}return!1})(),f=function(d){if(typeof window>"u"||!u)return c(d);try{return c(d)}catch{return!1}};t=function(h){var m=h!==null&&typeof h=="object",p=n.call(h)==="[object Function]",y=r(h),x=m&&n.call(h)==="[object String]",S=[];if(!m&&!p&&!y)throw new TypeError("Object.keys called on a non-object");var C=o&&p;if(x&&h.length>0&&!e.call(h,0))for(var _=0;_<h.length;++_)S.push(String(_));if(y&&h.length>0)for(var T=0;T<h.length;++T)S.push(String(T));else for(var O in h)!(C&&O==="prototype")&&e.call(h,O)&&S.push(String(O));if(a)for(var M=f(h),I=0;I<s.length;++I)!(M&&s[I]==="constructor")&&e.call(h,s[I])&&S.push(s[I]);return S}}return gR=t,gR}var pR,HJ;function nbt(){if(HJ)return pR;HJ=1;var t=Array.prototype.slice,e=w2e(),n=Object.keys,r=n?function(o){return n(o)}:tbt(),i=Object.keys;return r.shim=function(){if(Object.keys){var o=(function(){var s=Object.keys(arguments);return s&&s.length===arguments.length})(1,2);o||(Object.keys=function(c){return e(c)?i(t.call(c)):i(c)})}else Object.keys=r;return Object.keys||r},pR=r,pR}var mR,qJ;function b2e(){if(qJ)return mR;qJ=1;var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return mR=t,mR}var vR,KJ;function rbt(){return KJ||(KJ=1,vR=SyntaxError),vR}var yR,YJ;function ibt(){return YJ||(YJ=1,yR=TypeError),yR}var xR,XJ;function abt(){return XJ||(XJ=1,xR=Object.getOwnPropertyDescriptor),xR}var wR,ZJ;function obt(){if(ZJ)return wR;ZJ=1;var t=abt();if(t)try{t([],"length")}catch{t=null}return wR=t,wR}var bR,QJ;function sbt(){if(QJ)return bR;QJ=1;var t=b2e(),e=rbt(),n=ibt(),r=obt();return bR=function(a,o,s){if(!a||typeof a!="object"&&typeof a!="function")throw new n("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,d=!!r&&r(a,o);if(t)t(a,o,{configurable:u===null&&d?d.configurable:!u,enumerable:c===null&&d?d.enumerable:!c,value:s,writable:l===null&&d?d.writable:!l});else if(f||!c&&!l&&!u)a[o]=s;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},bR}var SR,JJ;function cbt(){if(JJ)return SR;JJ=1;var t=b2e(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},SR=e,SR}var CR,eee;function S2e(){if(eee)return CR;eee=1;var t=nbt(),e=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",n=Object.prototype.toString,r=Array.prototype.concat,i=sbt(),a=function(l){return typeof l=="function"&&n.call(l)==="[object Function]"},o=cbt()(),s=function(l,u,f,d){if(u in l){if(d===!0){if(l[u]===f)return}else if(!a(d)||!d())return}o?i(l,u,f,!0):i(l,u,f)},c=function(l,u){var f=arguments.length>2?arguments[2]:{},d=t(u);e&&(d=r.call(d,Object.getOwnPropertySymbols(u)));for(var h=0;h<d.length;h+=1)s(l,d[h],u[d[h]],f[d[h]])};return c.supportsDescriptors=!!o,CR=c,CR}var e5={exports:{}},tee;function C2e(){return tee||(tee=1,typeof self<"u"?e5.exports=self:typeof window<"u"?e5.exports=window:e5.exports=Function("return this")()),e5.exports}var _R,nee;function _2e(){if(nee)return _R;nee=1;var t=C2e();return _R=function(){return typeof _0!="object"||!_0||_0.Math!==Math||_0.Array!==Array?t:_0},_R}var TR,ree;function lbt(){if(ree)return TR;ree=1;var t=S2e(),e=_2e();return TR=function(){var r=e();if(t.supportsDescriptors){var i=Object.getOwnPropertyDescriptor(r,"globalThis");(!i||i.configurable&&(i.enumerable||!i.writable||globalThis!==r))&&Object.defineProperty(r,"globalThis",{configurable:!0,enumerable:!1,value:r,writable:!0})}else(typeof globalThis!="object"||globalThis!==r)&&(r.globalThis=r);return r},TR}var ER,iee;function ubt(){if(iee)return ER;iee=1;var t=S2e(),e=C2e(),n=_2e(),r=lbt(),i=n(),a=function(){return i};return t(a,{getPolyfill:n,implementation:e,shim:r}),ER=a,ER}var fbt=ubt();const dbt=ka(fbt),Xu=dbt(),T2e={vtkObject:()=>null};function sf(t){if(t==null||t.isA)return t;if(!t.vtkClass)return Xu.console&&Xu.console.error&&Xu.console.error("Invalid VTK object"),null;const e=T2e[t.vtkClass];if(!e)return Xu.console&&Xu.console.error&&Xu.console.error(`No vtk class found for Object of type ${t.vtkClass}`),null;const n={...t};Object.keys(n).forEach(i=>{n[i]&&typeof n[i]=="object"&&n[i].vtkClass&&(n[i]=sf(n[i]))});const r=e(n);return r&&r.modified&&r.modified(),r}function hbt(t,e){T2e[t]=e}sf.register=hbt;class OR extends Array{push(){for(let e=0;e<arguments.length;e++)this.includes(arguments[e])||super.push(arguments[e]);return this.length}}let KP=0;const E2e=Symbol("void");function gbt(){return KP}const O2e={};function lm(){}const pbt=["log","debug","info","warn","error","time","timeEnd","group","groupEnd"];pbt.forEach(t=>{O2e[t]=lm});Xu.console=console.hasOwnProperty("log")?console:O2e;const ap={debug:lm,error:Xu.console.error||lm,info:Xu.console.info||lm,log:Xu.console.log||lm,warn:Xu.console.warn||lm};function D2e(t,e){ap[t]&&(ap[t]=e||lm)}function M2e(){ap.log(...arguments)}function R2e(){ap.info(...arguments)}function PT(){ap.debug(...arguments)}function Yn(){ap.error(...arguments)}function VE(){ap.warn(...arguments)}const aee={};function I2e(t){aee[t]||(ap.error(t),aee[t]=!0)}const Ds=Object.create(null);Ds.Float32Array=Float32Array;Ds.Float64Array=Float64Array;Ds.Uint8Array=Uint8Array;Ds.Int8Array=Int8Array;Ds.Uint16Array=Uint16Array;Ds.Int16Array=Int16Array;Ds.Uint32Array=Uint32Array;Ds.Int32Array=Int32Array;Ds.Uint8ClampedArray=Uint8ClampedArray;try{Ds.BigInt64Array=BigInt64Array,Ds.BigUint64Array=BigUint64Array}catch{}function I2(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return new(Ds[t]||Float64Array)(...n)}function $E(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return(Ds[t]||Float64Array).from(...n)}function jE(t){return t.charAt(0).toUpperCase()+t.slice(1)}function va(t){return jE(t[0]==="_"?t.slice(1):t)}function N2e(t){return t.charAt(0).toLowerCase()+t.slice(1)}function P2e(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let i=Number(t),a="B";for(;i>n;)i/=n,a=r.pop();return`${i.toFixed(e)} ${a}`}function k2e(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:" ";const n=[];let r=t;for(;r>1e3;)n.push(`000${r%1e3}`.slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(e)}function A2e(t){Object.keys(t).forEach(e=>{Array.isArray(t[e])&&(t[e]=[].concat(t[e]))})}function mbt(t){return Object.values(Ds).some(e=>t instanceof e)}function vbt(t,e){if(t===e)return!0;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}return!1}function ybt(t,e){return Object.keys(t).find(n=>t[n]===e)}function L2e(t){return t&&t.isA?t.getState():t}function TU(t){setTimeout(t,0)}function V2e(t,e){const n=performance.now();t.finally(()=>{const r=performance.now()-n;e(r)})}function yi(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};A2e(e);const n=[];if(Number.isInteger(e.mtime)||(e.mtime=++KP),!("classHierarchy"in e))e.classHierarchy=new OR("vtkObject");else if(!(e.classHierarchy instanceof OR)){const a=new OR;for(let o=0;o<e.classHierarchy.length;o++)a.push(e.classHierarchy[o]);e.classHierarchy=a}function r(a){n[a]=null}function i(a){function o(){r(a)}return Object.freeze({unsubscribe:o})}return t.isDeleted=()=>!!e.deleted,t.modified=a=>{if(e.deleted){Yn("instance deleted - cannot call any method");return}a&&a<t.getMTime()||(e.mtime=++KP,n.forEach(o=>o&&o(t)))},t.onModified=a=>{if(e.deleted)return Yn("instance deleted - cannot call any method"),null;const o=n.length;return n.push(a),i(o)},t.getMTime=()=>e.mtime,t.isA=a=>{let o=e.classHierarchy.length;for(;o--;)if(e.classHierarchy[o]===a)return!0;return!1},t.getClassName=function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e.classHierarchy[e.classHierarchy.length-1-a]},t.set=function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,c=!1;return Object.keys(a).forEach(l=>{const u=s?null:t[`set${jE(l)}`];u&&Array.isArray(a[l])&&u.length>1?c=u(...a[l])||c:u?c=u(a[l])||c:(["mtime"].indexOf(l)===-1&&!o&&VE(`Warning: Set value to model directly ${l}, ${a[l]}`),c=e[l]!==a[l]||c,e[l]=a[l])}),c},t.get=function(){for(var a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];if(!o.length)return e;const c={};return o.forEach(l=>{c[l]=e[l]}),c},t.getReferenceByName=a=>e[a],t.delete=()=>{Object.keys(e).forEach(a=>delete e[a]),n.forEach((a,o)=>r(o)),e.deleted=!0},t.getState=()=>{if(e.deleted)return null;const a={...e,vtkClass:t.getClassName()};Object.keys(a).forEach(s=>{a[s]===null||a[s]===void 0||s[0]==="_"?delete a[s]:a[s].isA?a[s]=a[s].getState():Array.isArray(a[s])?a[s]=a[s].map(L2e):mbt(a[s])&&(a[s]=Array.from(a[s]))});const o={};return Object.keys(a).sort().forEach(s=>{o[s]=a[s]}),o.mtime&&delete o.mtime,o},t.shallowCopy=function(a){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(a.getClassName()!==t.getClassName())throw new Error(`Cannot ShallowCopy ${a.getClassName()} into ${t.getClassName()}`);const s=a.get(),c=Object.keys(e).sort();Object.keys(s).sort().forEach(u=>{const f=c.indexOf(u);f===-1?o&&PT(`add ${u} in shallowCopy`):c.splice(f,1),e[u]=s[u]}),c.length&&o&&PT(`Untouched keys: ${c.join(", ")}`),t.modified()},t.toJSON=function(){return t.getState()},t}const xbt={object(t,e,n){return function(){return{...e[n.name]}}}};function sc(t,e,n){n.forEach(r=>{if(typeof r=="object"){const i=xbt[r.type];i?t[`get${va(r.name)}`]=i(t,e,r):t[`get${va(r.name)}`]=()=>e[r.name]}else t[`get${va(r)}`]=()=>e[r]})}const $2e={enum(t,e,n){const r=`_on${va(n.name)}Changed`;return i=>{if(typeof i=="string"){if(n.enum[i]!==void 0)return e[n.name]!==n.enum[i]?(e[n.name]=n.enum[i],t.modified(),!0):!1;throw Yn(`Set Enum with invalid argument ${n}, ${i}`),new RangeError("Set Enum with invalid string argument")}if(typeof i=="number"){if(e[n.name]!==i){if(Object.keys(n.enum).map(a=>n.enum[a]).indexOf(i)!==-1){const a=e[n.name];return e[n.name]=i,e[r]?.(t,e,i,a),t.modified(),!0}throw Yn(`Set Enum outside numeric range ${n}, ${i}`),new RangeError("Set Enum outside numeric range")}return!1}throw Yn(`Set Enum with invalid argument (String/Number) ${n}, ${i}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(t,e,n){n.params?.length===1&&VE('Setter of type "object" with a single "param" field is not supported');const r=`_on${va(n.name)}Changed`;return function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];let s;if(a.length>1&&n.params?.length?s=n.params.reduce((c,l,u)=>Object.assign(c,{[l]:a[u]}),{}):s=a[0],!_U(e[n.name],s)){const c=e[n.name];return e[n.name]=s,e[r]?.(t,e,s,c),t.modified(),!0}return!1}}};function oee(t){if(typeof t=="object"){const e=$2e[t.type];if(e)return(n,r)=>e(n,r,t);throw Yn(`No setter for field ${t}`),new TypeError("No setter for field")}return function(n,r){const i=`_on${va(t)}Changed`;return function(o){if(r.deleted)return Yn("instance deleted - cannot call any method"),!1;if(r[t]!==o){const s=r[t.name];return r[t]=o,r[i]?.(n,r,o,s),n.modified(),!0}return!1}}}function c3(t,e,n){n.forEach(r=>{typeof r=="object"?t[`set${va(r.name)}`]=oee(r)(t,e):t[`set${va(r)}`]=oee(r)(t,e)})}function Ja(t,e,n){sc(t,e,n),c3(t,e,n)}function N2(t,e,n){n.forEach(r=>{t[`get${va(r)}`]=()=>e[r]?Array.from(e[r]):e[r],t[`get${va(r)}ByReference`]=()=>e[r]})}function EU(t,e,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:void 0;n.forEach(a=>{if(e[a]&&r&&e[a].length!==r)throw new RangeError(`Invalid initial number of values for array (${a})`);const o=`_on${va(a)}Changed`;t[`set${va(a)}`]=function(){if(e.deleted)return Yn("instance deleted - cannot call any method"),!1;for(var s=arguments.length,c=new Array(s),l=0;l<s;l++)c[l]=arguments[l];let u=c,f,d=!1;if(u.length===1&&(u[0]==null||u[0].length>=0)&&(u=u[0],d=!0),u==null)f=e[a]!==u;else{if(r&&u.length!==r)if(u.length<r&&i!==void 0)for(u=Array.from(u),d=!1;u.length<r;)u.push(i);else throw new RangeError(`Invalid number of values for array setter (${a})`);f=e[a]==null||e[a].length!==u.length;for(let h=0;!f&&h<u.length;++h)f=e[a][h]!==u[h];f&&d&&(u=Array.from(u))}if(f){const h=e[a.name];e[a]=u,e[o]?.(t,e,u,h),t.modified()}return f},t[`set${va(a)}From`]=s=>{const c=e[a];s.forEach((l,u)=>{c[u]=l})}})}function OU(t,e,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:void 0;N2(t,e,n),EU(t,e,n,r,i)}function l3(t,e,n){for(let r=0;r<n.length;r++){const i=n[r];e[i]!==void 0&&(e[`_${i}`]=e[i],delete e[i])}}function DU(t,e,n,r){e.inputData?e.inputData=e.inputData.map(sf):e.inputData=[],e.inputConnection?e.inputConnection=e.inputConnection.map(sf):e.inputConnection=[],e.output?e.output=e.output.map(sf):e.output=[],e.inputArrayToProcess?e.inputArrayToProcess=e.inputArrayToProcess.map(sf):e.inputArrayToProcess=[],e.numberOfInputs=n;function i(h){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e.deleted){Yn("instance deleted - cannot call any method");return}if(m>=e.numberOfInputs){Yn(`algorithm ${t.getClassName()} only has ${e.numberOfInputs} input ports. To add more input ports, use addInputData()`);return}(e.inputData[m]!==h||e.inputConnection[m])&&(e.inputData[m]=h,e.inputConnection[m]=null,t.modified&&t.modified())}function a(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e.inputConnection[h]&&(e.inputData[h]=e.inputConnection[h]()),e.inputData[h]}function o(h){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e.deleted){Yn("instance deleted - cannot call any method");return}if(m>=e.numberOfInputs){let p=`algorithm ${t.getClassName()} only has `;p+=`${e.numberOfInputs}`,p+=" input ports. To add more input ports, use addInputConnection()",Yn(p);return}e.inputData[m]=null,e.inputConnection[m]=h}function s(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e.inputConnection[h]}function c(){let h=e.numberOfInputs;for(;h&&!e.inputData[h-1]&&!e.inputConnection[h-1];)h--;return h===e.numberOfInputs&&e.numberOfInputs++,h}function l(h){if(e.deleted){Yn("instance deleted - cannot call any method");return}o(h,c())}function u(h){if(e.deleted){Yn("instance deleted - cannot call any method");return}i(h,c())}function f(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e.deleted?(Yn("instance deleted - cannot call any method"),null):(t.shouldUpdate()&&t.update(),e.output[h])}t.shouldUpdate=()=>{const h=t.getMTime();let m=1/0,p=r;for(;p--;){if(!e.output[p]||e.output[p].isDeleted())return!0;const y=e.output[p].getMTime();if(y<h)return!0;y<m&&(m=y)}for(p=e.numberOfInputs;p--;)if(e.inputConnection[p]?.filter.shouldUpdate()||t.getInputData(p)?.getMTime()>m)return!0;return!1};function d(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;const m=()=>f(h);return m.filter=t,m}if(e.numberOfInputs){let h=e.numberOfInputs;for(;h--;)e.inputData.push(null),e.inputConnection.push(null);t.setInputData=i,t.setInputConnection=o,t.addInputData=u,t.addInputConnection=l,t.getInputData=a,t.getInputConnection=s}r&&(t.getOutputData=f,t.getOutputPort=d),t.update=()=>{const h=[];if(e.numberOfInputs){let m=0;for(;m<e.numberOfInputs;)h[m]=t.getInputData(m),m++}t.shouldUpdate()&&t.requestData&&t.requestData(h,e.output)},t.getNumberOfInputPorts=()=>e.numberOfInputs,t.getNumberOfOutputPorts=()=>r||e.output.length,t.getInputArrayToProcess=h=>{const m=e.inputArrayToProcess[h],p=e.inputData[h];return m&&p?p[`get${m.fieldAssociation}`]().getArray(m.arrayName):null},t.setInputArrayToProcess=function(h,m,p){let y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"Scalars";for(;e.inputArrayToProcess.length<h;)e.inputArrayToProcess.push(null);e.inputArrayToProcess[h]={arrayName:m,fieldAssociation:p,attributeType:y}}}const MU=Symbol("Event abort");function j2e(t,e,n){const r=[],i=t.delete;let a=1;function o(l){for(let u=0;u<r.length;++u){const[f]=r[u];if(f===l){r.splice(u,1);return}}}function s(l){function u(){o(l)}return Object.freeze({unsubscribe:u})}function c(){if(e.deleted){Yn("instance deleted - cannot call any method");return}const l=r.slice();for(let u=0;u<l.length;++u){const[,f,d]=l[u];if(f){if(d<0)setTimeout(()=>f.apply(t,arguments),1-d);else if(f.apply(t,arguments)===MU)break}}}t[`invoke${va(n)}`]=c,t[`on${va(n)}`]=function(l){let u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!l.apply)return console.error(`Invalid callback for event ${n}`),null;if(e.deleted)return Yn("instance deleted - cannot call any method"),null;const f=a++;return r.push([f,l,u]),r.sort((d,h)=>h[2]-d[2]),s(f)},t.delete=()=>{i(),r.forEach(l=>{let[u]=l;return o(u)})}}function ri(t,e){const n=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const i={},a={};return t(a,i,r),Object.freeze(a)};return e&&sf.register(e,n),n}function u3(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return e.filter(o=>!!o).map(o=>o(...i))}}function RU(t){return t&&t.isA&&t.isA("vtkObject")}function kT(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];if(RU(t)){if(r.indexOf(t)>=0)return n;r.push(t);const i=e(t);i!==void 0&&n.push(i);const a=t.get();Object.keys(a).forEach(o=>{const s=a[o];Array.isArray(s)?s.forEach(c=>{kT(c,e,n,r)}):kT(s,e,n,r)})}return n}function U2e(t,e,n){var r=this;let i;const a=function(){for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];const l=r,u=()=>{i=null,n||t.apply(l,s)},f=n&&!i;clearTimeout(i),i=setTimeout(u,e),f&&t.apply(l,s)};return a.cancel=()=>clearTimeout(i),a}function F2e(t,e){let n=!1,r=null;function i(){n=!1,r!==null&&(a(...r),r=null)}function a(){for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];if(n){r=s;return}n=!0,t(...s),setTimeout(i,e)}return a}function IU(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};e.keystore=Object.assign(e.keystore||{},n),t.setKey=(r,i)=>{e.keystore[r]=i},t.getKey=r=>e.keystore[r],t.getAllKeys=()=>Object.keys(e.keystore),t.deleteKey=r=>delete e.keystore[r],t.clearKeystore=()=>t.getAllKeys().forEach(r=>delete e.keystore[r])}let wbt=1;const vS="__root__";function B2e(t,e){IU(t,e);const n=t.delete;e.proxyId=`${wbt++}`,e.ui=JSON.parse(JSON.stringify(e.ui||[])),sc(t,e,["proxyId","proxyGroup","proxyName"]),Ja(t,e,["proxyManager"]);const r={},i={};function a(l,u){i[u]||(i[u]=[]);const f=i[u];for(let d=0;d<l.length;d++)f.push(l[d].name),r[l[d].name]=l[d],l[d].children&&l[d].children.length&&a(l[d].children,l[d].name)}a(e.ui,vS),t.updateUI=l=>{e.ui=JSON.parse(JSON.stringify(l||[])),Object.keys(r).forEach(u=>delete r[u]),Object.keys(i).forEach(u=>delete i[u]),a(e.ui,vS),t.modified()};function o(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:vS;return i[l]}t.updateProxyProperty=(l,u)=>{const f=r[l];f?Object.assign(f,u):r[l]={...u}},t.activate=()=>{if(e.proxyManager){const l=`setActive${va(t.getProxyGroup().slice(0,-1))}`;e.proxyManager[l]&&e.proxyManager[l](t)}},e.propertyLinkSubscribers={},t.registerPropertyLinkForGC=(l,u)=>{u in e.propertyLinkSubscribers||(e.propertyLinkSubscribers[u]=[]),e.propertyLinkSubscribers[u].push(l)},t.gcPropertyLinks=l=>{const u=e.propertyLinkSubscribers[l]||[];for(;u.length;)u.pop().unbind(t)},e.propertyLinkMap={},t.getPropertyLink=function(l){let u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e.propertyLinkMap[l])return e.propertyLinkMap[l];let f=null;const d=[];let h=0,m=!1;function p(_){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(m)return null;const O=[];let M=null;for(h=d.length;h--;){const V=d[h];V.instance===_?M=V:O.push(V)}if(!M)return null;const I=M.instance[`get${va(M.propertyName)}`]();if(!vbt(I,f)||T){for(f=I,m=!0;O.length;){const V=O.pop();V.instance.set({[V.propertyName]:f})}m=!1}return e.propertyLinkMap[l].persistent&&(e.propertyLinkMap[l].value=I),I}function y(_,T){const O=[];for(h=d.length;h--;){const M=d[h];M.instance===_&&(M.propertyName===T||T===void 0)&&(M.subscription.unsubscribe(),O.push(h))}for(;O.length;)d.splice(O.pop(),1)}function x(_,T){let O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const M=_.onModified(p),I=d[0];return d.push({instance:_,propertyName:T,subscription:M}),O&&(e.propertyLinkMap[l].persistent&&e.propertyLinkMap[l].value!==void 0?_.set({[T]:e.propertyLinkMap[l].value}):I&&p(I.instance,!0)),{unsubscribe:()=>y(_,T)}}function S(){for(;d.length;)d.pop().subscription.unsubscribe()}const C={bind:x,unbind:y,unsubscribe:S,persistent:u};return e.propertyLinkMap[l]=C,C};function s(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:vS;const u=[],f=e.proxyId,d=o(l)||[];for(let h=0;h<d.length;h++){const m=d[h],p=t[`get${va(m)}`],y=p?p():void 0,x={id:f,name:m,value:y},S=s(m);S.length&&(x.children=S),u.push(x)}return u}t.listPropertyNames=()=>s().map(l=>l.name),t.getPropertyByName=l=>s().find(u=>u.name===l),t.getPropertyDomainByName=l=>(r[l]||{}).domain,t.getProxySection=()=>({id:e.proxyId,name:e.proxyGroup,ui:e.ui,properties:s()}),t.delete=()=>{const l=Object.keys(e.propertyLinkMap);let u=l.length;for(;u--;)e.propertyLinkMap[l[u]].unsubscribe();Object.keys(e.propertyLinkSubscribers).forEach(t.gcPropertyLinks),n()},t.getState=()=>null;function c(){if(e.links)for(let l=0;l<e.links.length;l++){const{link:u,property:f,persistent:d,updateOnBind:h,type:m}=e.links[l];if(m==="application"){const p=e.proxyManager.getPropertyLink(u,d);t.registerPropertyLinkForGC(p,"application"),p.bind(t,f,h)}}}TU(c)}function z2e(t,e,n){const r=t.delete,i=[],a=Object.keys(n);let o=a.length;for(;o--;){const s=a[o],{modelKey:c,property:l,modified:u=!0}=n[s],f=va(l),d=va(s);t[`get${d}`]=e[c][`get${f}`],t[`set${d}`]=e[c][`set${f}`],u&&i.push(e[c].onModified(t.modified))}t.delete=()=>{for(;i.length;)i.pop().unsubscribe();r()}}function G2e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};e.this=t;function i(s){const c=Object.keys(s);let l=c.length;for(;l--;){const u=c[l];e[u].set(s[u])}}const a=Object.keys(r);let o=a.length;for(;o--;){const s=a[o];e[s]=r[s];const c=n[s];t[`set${va(s)}`]=l=>{if(l!==e[s]){e[s]=l;const u=c[l];i(u),t.modified()}}}a.length&&sc(t,e,a)}const see=10,cee=40,lee=800;function W2e(t){let e=0,n=0,r=0,i=0;return"detail"in t&&(n=t.detail),"wheelDelta"in t&&(n=-t.wheelDelta/120),"wheelDeltaY"in t&&(n=-t.wheelDeltaY/120),"wheelDeltaX"in t&&(e=-t.wheelDeltaX/120),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=n,n=0),r=e*see,i=n*see,"deltaY"in t&&(i=t.deltaY),"deltaX"in t&&(r=t.deltaX),(r||i)&&t.deltaMode&&(t.deltaMode===1?(r*=cee,i*=cee):(r*=lee,i*=lee)),r&&!e&&(e=r<1?-1:1),i&&!n&&(n=i<1?-1:1),{spinX:e,spinY:n||e,pixelX:r,pixelY:i||r}}var se={algo:DU,capitalize:jE,chain:u3,debounce:U2e,enumToString:ybt,event:j2e,EVENT_ABORT:MU,formatBytesToProperUnit:P2e,formatNumbersWithThousandSeparator:k2e,get:sc,getArray:N2,getCurrentGlobalMTime:gbt,getStateArrayMapFunc:L2e,isVtkObject:RU,keystore:IU,measurePromiseExecution:V2e,moveToProtected:l3,newInstance:ri,newTypedArray:I2,newTypedArrayFrom:$E,normalizeWheel:W2e,obj:yi,proxy:B2e,proxyPropertyMapping:z2e,proxyPropertyState:G2e,safeArrays:A2e,set:c3,setArray:EU,setGet:Ja,setGetArray:OU,setImmediate:TU,setLoggerFunction:D2e,throttle:F2e,traverseInstanceTree:kT,TYPED_ARRAYS:Ds,uncapitalize:N2e,VOID:E2e,vtkDebugMacro:PT,vtkErrorMacro:Yn,vtkInfoMacro:R2e,vtkLogMacro:M2e,vtkOnceErrorMacro:I2e,vtkWarningMacro:VE,objectSetterMap:$2e},Rs=Object.freeze({__proto__:null,VOID:E2e,setLoggerFunction:D2e,vtkLogMacro:M2e,vtkInfoMacro:R2e,vtkDebugMacro:PT,vtkErrorMacro:Yn,vtkWarningMacro:VE,vtkOnceErrorMacro:I2e,TYPED_ARRAYS:Ds,newTypedArray:I2,newTypedArrayFrom:$E,capitalize:jE,_capitalize:va,uncapitalize:N2e,formatBytesToProperUnit:P2e,formatNumbersWithThousandSeparator:k2e,setImmediateVTK:TU,measurePromiseExecution:V2e,obj:yi,get:sc,set:c3,setGet:Ja,getArray:N2,setArray:EU,setGetArray:OU,moveToProtected:l3,algo:DU,EVENT_ABORT:MU,event:j2e,newInstance:ri,chain:u3,isVtkObject:RU,traverseInstanceTree:kT,debounce:U2e,throttle:F2e,keystore:IU,proxy:B2e,proxyPropertyMapping:z2e,proxyPropertyState:G2e,normalizeWheel:W2e,default:se}),SC={exports:{}},bbt=SC.exports,uee;function Sbt(){return uee||(uee=1,(function(t){(function(e,n,r){function i(c){var l=this,u=s();l.next=function(){var f=2091639*l.s0+l.c*23283064365386963e-26;return l.s0=l.s1,l.s1=l.s2,l.s2=f-(l.c=f|0)},l.c=1,l.s0=u(" "),l.s1=u(" "),l.s2=u(" "),l.s0-=u(c),l.s0<0&&(l.s0+=1),l.s1-=u(c),l.s1<0&&(l.s1+=1),l.s2-=u(c),l.s2<0&&(l.s2+=1),u=null}function a(c,l){return l.c=c.c,l.s0=c.s0,l.s1=c.s1,l.s2=c.s2,l}function o(c,l){var u=new i(c),f=l&&l.state,d=u.next;return d.int32=function(){return u.next()*4294967296|0},d.double=function(){return d()+(d()*2097152|0)*11102230246251565e-32},d.quick=d,f&&(typeof f=="object"&&a(f,u),d.state=function(){return a(u,{})}),d}function s(){var c=4022871197,l=function(u){u=String(u);for(var f=0;f<u.length;f++){c+=u.charCodeAt(f);var d=.02519603282416938*c;c=d>>>0,d-=c,d*=c,c=d>>>0,d-=c,c+=d*4294967296}return(c>>>0)*23283064365386963e-26};return l}n&&n.exports?n.exports=o:this.alea=o})(bbt,t)})(SC)),SC.exports}var CC={exports:{}},Cbt=CC.exports,fee;function _bt(){return fee||(fee=1,(function(t){(function(e,n,r){function i(s){var c=this,l="";c.x=0,c.y=0,c.z=0,c.w=0,c.next=function(){var f=c.x^c.x<<11;return c.x=c.y,c.y=c.z,c.z=c.w,c.w^=c.w>>>19^f^f>>>8},s===(s|0)?c.x=s:l+=s;for(var u=0;u<l.length+64;u++)c.x^=l.charCodeAt(u)|0,c.next()}function a(s,c){return c.x=s.x,c.y=s.y,c.z=s.z,c.w=s.w,c}function o(s,c){var l=new i(s),u=c&&c.state,f=function(){return(l.next()>>>0)/4294967296};return f.double=function(){do var d=l.next()>>>11,h=(l.next()>>>0)/4294967296,m=(d+h)/(1<<21);while(m===0);return m},f.int32=l.next,f.quick=f,u&&(typeof u=="object"&&a(u,l),f.state=function(){return a(l,{})}),f}n&&n.exports?n.exports=o:this.xor128=o})(Cbt,t)})(CC)),CC.exports}var _C={exports:{}},Tbt=_C.exports,dee;function Ebt(){return dee||(dee=1,(function(t){(function(e,n,r){function i(s){var c=this,l="";c.next=function(){var f=c.x^c.x>>>2;return c.x=c.y,c.y=c.z,c.z=c.w,c.w=c.v,(c.d=c.d+362437|0)+(c.v=c.v^c.v<<4^(f^f<<1))|0},c.x=0,c.y=0,c.z=0,c.w=0,c.v=0,s===(s|0)?c.x=s:l+=s;for(var u=0;u<l.length+64;u++)c.x^=l.charCodeAt(u)|0,u==l.length&&(c.d=c.x<<10^c.x>>>4),c.next()}function a(s,c){return c.x=s.x,c.y=s.y,c.z=s.z,c.w=s.w,c.v=s.v,c.d=s.d,c}function o(s,c){var l=new i(s),u=c&&c.state,f=function(){return(l.next()>>>0)/4294967296};return f.double=function(){do var d=l.next()>>>11,h=(l.next()>>>0)/4294967296,m=(d+h)/(1<<21);while(m===0);return m},f.int32=l.next,f.quick=f,u&&(typeof u=="object"&&a(u,l),f.state=function(){return a(l,{})}),f}n&&n.exports?n.exports=o:this.xorwow=o})(Tbt,t)})(_C)),_C.exports}var TC={exports:{}},Obt=TC.exports,hee;function Dbt(){return hee||(hee=1,(function(t){(function(e,n,r){function i(s){var c=this;c.next=function(){var u=c.x,f=c.i,d,h;return d=u[f],d^=d>>>7,h=d^d<<24,d=u[f+1&7],h^=d^d>>>10,d=u[f+3&7],h^=d^d>>>3,d=u[f+4&7],h^=d^d<<7,d=u[f+7&7],d=d^d<<13,h^=d^d<<9,u[f]=h,c.i=f+1&7,h};function l(u,f){var d,h=[];if(f===(f|0))h[0]=f;else for(f=""+f,d=0;d<f.length;++d)h[d&7]=h[d&7]<<15^f.charCodeAt(d)+h[d+1&7]<<13;for(;h.length<8;)h.push(0);for(d=0;d<8&&h[d]===0;++d);for(d==8?h[7]=-1:h[d],u.x=h,u.i=0,d=256;d>0;--d)u.next()}l(c,s)}function a(s,c){return c.x=s.x.slice(),c.i=s.i,c}function o(s,c){s==null&&(s=+new Date);var l=new i(s),u=c&&c.state,f=function(){return(l.next()>>>0)/4294967296};return f.double=function(){do var d=l.next()>>>11,h=(l.next()>>>0)/4294967296,m=(d+h)/(1<<21);while(m===0);return m},f.int32=l.next,f.quick=f,u&&(u.x&&a(u,l),f.state=function(){return a(l,{})}),f}n&&n.exports?n.exports=o:this.xorshift7=o})(Obt,t)})(TC)),TC.exports}var EC={exports:{}},Mbt=EC.exports,gee;function Rbt(){return gee||(gee=1,(function(t){(function(e,n,r){function i(s){var c=this;c.next=function(){var u=c.w,f=c.X,d=c.i,h,m;return c.w=u=u+1640531527|0,m=f[d+34&127],h=f[d=d+1&127],m^=m<<13,h^=h<<17,m^=m>>>15,h^=h>>>12,m=f[d]=m^h,c.i=d,m+(u^u>>>16)|0};function l(u,f){var d,h,m,p,y,x=[],S=128;for(f===(f|0)?(h=f,f=null):(f=f+"\0",h=0,S=Math.max(S,f.length)),m=0,p=-32;p<S;++p)f&&(h^=f.charCodeAt((p+32)%f.length)),p===0&&(y=h),h^=h<<10,h^=h>>>15,h^=h<<4,h^=h>>>13,p>=0&&(y=y+1640531527|0,d=x[p&127]^=h+y,m=d==0?m+1:0);for(m>=128&&(x[(f&&f.length||0)&127]=-1),m=127,p=512;p>0;--p)h=x[m+34&127],d=x[m=m+1&127],h^=h<<13,d^=d<<17,h^=h>>>15,d^=d>>>12,x[m]=h^d;u.w=y,u.X=x,u.i=m}l(c,s)}function a(s,c){return c.i=s.i,c.w=s.w,c.X=s.X.slice(),c}function o(s,c){s==null&&(s=+new Date);var l=new i(s),u=c&&c.state,f=function(){return(l.next()>>>0)/4294967296};return f.double=function(){do var d=l.next()>>>11,h=(l.next()>>>0)/4294967296,m=(d+h)/(1<<21);while(m===0);return m},f.int32=l.next,f.quick=f,u&&(u.X&&a(u,l),f.state=function(){return a(l,{})}),f}n&&n.exports?n.exports=o:this.xor4096=o})(Mbt,t)})(EC)),EC.exports}var OC={exports:{}},Ibt=OC.exports,pee;function Nbt(){return pee||(pee=1,(function(t){(function(e,n,r){function i(s){var c=this,l="";c.next=function(){var f=c.b,d=c.c,h=c.d,m=c.a;return f=f<<25^f>>>7^d,d=d-h|0,h=h<<24^h>>>8^m,m=m-f|0,c.b=f=f<<20^f>>>12^d,c.c=d=d-h|0,c.d=h<<16^d>>>16^m,c.a=m-f|0},c.a=0,c.b=0,c.c=-1640531527,c.d=1367130551,s===Math.floor(s)?(c.a=s/4294967296|0,c.b=s|0):l+=s;for(var u=0;u<l.length+20;u++)c.b^=l.charCodeAt(u)|0,c.next()}function a(s,c){return c.a=s.a,c.b=s.b,c.c=s.c,c.d=s.d,c}function o(s,c){var l=new i(s),u=c&&c.state,f=function(){return(l.next()>>>0)/4294967296};return f.double=function(){do var d=l.next()>>>11,h=(l.next()>>>0)/4294967296,m=(d+h)/(1<<21);while(m===0);return m},f.int32=l.next,f.quick=f,u&&(typeof u=="object"&&a(u,l),f.state=function(){return a(l,{})}),f}n&&n.exports?n.exports=o:this.tychei=o})(Ibt,t)})(OC)),OC.exports}var DC={exports:{}};const Pbt={},kbt=Object.freeze(Object.defineProperty({__proto__:null,default:Pbt},Symbol.toStringTag,{value:"Module"})),Cd=q_e(kbt);var Abt=DC.exports,mee;function Lbt(){return mee||(mee=1,(function(t){(function(e,n,r){var i=256,a=6,o=52,s="random",c=r.pow(i,a),l=r.pow(2,o),u=l*2,f=i-1,d;function h(_,T,O){var M=[];T=T==!0?{entropy:!0}:T||{};var I=x(y(T.entropy?[_,C(n)]:_??S(),3),M),V=new m(M),k=function(){for(var L=V.g(a),$=c,W=0;L<l;)L=(L+W)*i,$*=i,W=V.g(1);for(;L>=u;)L/=2,$/=2,W>>>=1;return(L+W)/$};return k.int32=function(){return V.g(4)|0},k.quick=function(){return V.g(4)/4294967296},k.double=k,x(C(V.S),n),(T.pass||O||function(L,$,W,G){return G&&(G.S&&p(G,V),L.state=function(){return p(V,{})}),W?(r[s]=L,$):L})(k,I,"global"in T?T.global:this==r,T.state)}function m(_){var T,O=_.length,M=this,I=0,V=M.i=M.j=0,k=M.S=[];for(O||(_=[O++]);I<i;)k[I]=I++;for(I=0;I<i;I++)k[I]=k[V=f&V+_[I%O]+(T=k[I])],k[V]=T;(M.g=function(L){for(var $,W=0,G=M.i,oe=M.j,U=M.S;L--;)$=U[G=f&G+1],W=W*i+U[f&(U[G]=U[oe=f&oe+$])+(U[oe]=$)];return M.i=G,M.j=oe,W})(i)}function p(_,T){return T.i=_.i,T.j=_.j,T.S=_.S.slice(),T}function y(_,T){var O=[],M=typeof _,I;if(T&&M=="object")for(I in _)try{O.push(y(_[I],T-1))}catch{}return O.length?O:M=="string"?_:_+"\0"}function x(_,T){for(var O=_+"",M,I=0;I<O.length;)T[f&I]=f&(M^=T[f&I]*19)+O.charCodeAt(I++);return C(T)}function S(){try{var _;return d&&(_=d.randomBytes)?_=_(i):(_=new Uint8Array(i),(e.crypto||e.msCrypto).getRandomValues(_)),C(_)}catch{var T=e.navigator,O=T&&T.plugins;return[+new Date,e,O,e.screen,C(n)]}}function C(_){return String.fromCharCode.apply(0,_)}if(x(r.random(),n),t.exports){t.exports=h;try{d=Cd}catch{}}else r["seed"+s]=h})(typeof self<"u"?self:Abt,[],Math)})(DC)),DC.exports}var DR,vee;function Vbt(){if(vee)return DR;vee=1;var t=Sbt(),e=_bt(),n=Ebt(),r=Dbt(),i=Rbt(),a=Nbt(),o=Lbt();return o.alea=t,o.xor128=e,o.xorwow=n,o.xorshift7=r,o.xor4096=i,o.tychei=a,DR=o,DR}var $bt=Vbt();const jbt=ka($bt),NU=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Ubt=[1,0,0,0,1,0,0,0,1],PU=1e-6,kU=1e-12,{vtkErrorMacro:H2e,vtkWarningMacro:s1}=se;let q2e=0;const yee=20;function f3(t){return()=>H2e(`vtkMath::${t} - NOT IMPLEMENTED`)}function K5(t,e,n,r){let i;for(let a=0;a<e;a++)i=t[n*e+a],t[n*e+a]=t[r*e+a],t[r*e+a]=i}function S5(t,e,n,r){let i;for(let a=0;a<e;a++)i=t[a*e+n],t[a*e+n]=t[a*e+r],t[a*e+r]=i}function pi(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:3;const e=Array(t);for(let n=0;n<t;++n)e[n]=0;return e}const Fbt=()=>Math.PI;function Bbt(t,e){return e>1023?t*2**1023*2**(e-1023):e<-1074?t*2**-1074*2**(e+1074):t*2**e}function Hi(t){return t/180*Math.PI}function AT(t){return t*180/Math.PI}const{round:zbt,floor:AU,ceil:Gbt,min:Wbt,max:Hbt}=Math;function qbt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=1/0;for(let i=e,a=t.length;i<a;i+=n)t[i]<r&&(r=t[i]);return r}function Kbt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=-1/0;for(let i=e,a=t.length;i<a;i+=n)r<t[i]&&(r=t[i]);return r}function Ybt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=1/0,i=-1/0;for(let a=e,o=t.length;a<o;a+=n)t[a]<r&&(r=t[a]),i<t[a]&&(i=t[a]);return[r,i]}const Xbt=f3("ceilLog2"),Zbt=f3("factorial");function yg(t){let e=1;for(;e<t;)e*=2;return e}function C5(t){return t===yg(t)}function Qbt(t,e){let n=1;for(let r=1;r<=e;++r)n*=(t-r+1)/r;return Math.floor(n)}function Jbt(t,e){if(t<e)return 0;const n=pi(e);for(let r=0;r<e;++r)n[r]=r;return n}function e3t(t,e,n){let r=0;for(let i=e-1;i>=0;--i)if(n[i]<t-e+i){let a=n[i]+1;for(;i<e;)n[i++]=a++;r=1;break}return r}function t3t(t){jbt(`${t}`,{global:!0}),q2e=t}function n3t(){return q2e}function r3t(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;const n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:1)-t;return t+n*Math.random()}const i3t=f3("gaussian");function LT(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n}function J0(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n}function K2e(t,e){return t[0]*=e,t[1]*=e,t[2]*=e,t}function Y2e(t,e){return t[0]*=e,t[1]*=e,t}function YP(t,e,n,r){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r}function a3t(t,e,n,r){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r}function Fn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function o3t(t,e,n){n[0]=t[0]*e[0],n[1]=t[0]*e[1],n[2]=t[0]*e[2],n[3]=t[1]*e[0],n[4]=t[1]*e[1],n[5]=t[1]*e[2],n[6]=t[2]*e[0],n[7]=t[2]*e[1],n[8]=t[2]*e[2]}function _d(t,e,n){const r=t[1]*e[2]-t[2]*e[1],i=t[2]*e[0]-t[0]*e[2],a=t[0]*e[1]-t[1]*e[0];return n[0]=r,n[1]=i,n[2]=a,n}function Ng(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3;switch(e){case 1:return Math.abs(t);case 2:return Math.sqrt(t[0]*t[0]+t[1]*t[1]);case 3:return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);default:{let n=0;for(let r=0;r<e;r++)n+=t[r]*t[r];return Math.sqrt(n)}}}function c1(t){const e=Ng(t);return e!==0&&(t[0]/=e,t[1]/=e,t[2]/=e),e}function s3t(t,e,n,r){const i=t[0]*t[0],a=t[1]*t[1],o=t[2]*t[2],s=Math.sqrt(i+a+o);let c,l,u;i>a&&i>o?(c=0,l=1,u=2):a>o?(c=1,l=2,u=0):(c=2,l=0,u=1);const f=t[c]/s,d=t[l]/s,h=t[u]/s,m=Math.sqrt(f*f+h*h);if(r!==0){const p=Math.sin(r),y=Math.cos(r);e&&(e[c]=(h*y-f*d*p)/m,e[l]=p*m,e[u]=(-(f*y)-d*h*p)/m),n&&(n[c]=(-(h*p)-f*d*y)/m,n[l]=y*m,n[u]=(f*p-d*h*y)/m)}else e&&(e[c]=h/m,e[l]=0,e[u]=-f/m),n&&(n[c]=-f*d/m,n[l]=m,n[u]=-d*h/m)}function c3t(t,e,n){const r=Fn(e,e);if(r===0)return n[0]=0,n[1]=0,n[2]=0,!1;const i=Fn(t,e)/r;for(let a=0;a<3;a++)n[a]=e[a];return K2e(n,i),!0}function XP(t,e){return t[0]*e[0]+t[1]*e[1]}function l3t(t,e,n){const r=XP(e,e);if(r===0)return n[0]=0,n[1]=0,!1;const i=XP(t,e)/r;for(let a=0;a<2;a++)n[a]=e[a];return Y2e(n,i),!0}function Zf(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])+(t[2]-e[2])*(t[2]-e[2])}function u3t(t,e){const n=[0,0,0];return _d(t,e,n),Math.atan2(Ng(n),Fn(t,e))}function f3t(t,e,n){const r=Math.abs(t-n);return 1/Math.sqrt(2*Math.PI*e)*Math.exp(-(r**2)/(2*e))}function d3t(t,e,n){const r=Math.abs(t-n);return Math.exp(-(r**2)/(2*e))}function h3t(t,e,n){n[0]=t[0]*e[0],n[1]=t[0]*e[1],n[2]=t[1]*e[0],n[3]=t[1]*e[1]}function X2e(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function g3t(t){const e=X2e(t);return e!==0&&(t[0]/=e,t[1]/=e),e}function Yi(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.length===2?e[0][0]*e[1][1]-e[1][0]*e[0][1]:e.length===4?e[0]*e[3]-e[1]*e[2]:Number.NaN}function p3t(t,e){let n,r,i;const a=[0,0,0];for(let o=0;o<3;o++)i=Math.abs(t[o*3]),(r=Math.abs(t[o*3+1]))>i&&(i=r),(r=Math.abs(t[o*3+2]))>i&&(i=r),a[o]=1/i;i=a[0]*Math.abs(t[0]),n=0,(r=a[1]*Math.abs(t[3]))>=i&&(i=r,n=1),(r=a[2]*Math.abs(t[6]))>=i&&(n=2),n!==0&&(K5(t,3,n,0),a[n]=a[0]),e[0]=n,t[3]/=t[0],t[6]/=t[0],t[4]-=t[3]*t[1],t[7]-=t[6]*t[1],i=a[1]*Math.abs(t[4]),n=1,(r=a[2]*Math.abs(t[7]))>=i&&(n=2,K5(t,3,1,2),a[2]=a[1]),e[1]=n,t[7]/=t[4],t[5]-=t[3]*t[2],t[8]-=t[6]*t[2]+t[7]*t[5],e[2]=2}function m3t(t,e,n){let r=n[e[0]];n[e[0]]=n[0],n[0]=r,r=n[e[1]],n[e[1]]=n[1],n[1]=r-t[3]*n[0],r=n[e[2]],n[e[2]]=n[2],n[2]=r-t[6]*n[0]-t[7]*n[1],n[2]/=t[8],n[1]=(n[1]-t[5]*n[2])/t[4],n[0]=(n[0]-t[1]*n[1]-t[2]*n[2])/t[0]}function v3t(t,e,n){const r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],f=t[8],d=+Yi(s,u,c,f),h=-Yi(o,l,c,f),m=+Yi(o,l,s,u),p=-Yi(i,u,a,f),y=+Yi(r,l,a,f),x=-Yi(r,l,i,u),S=+Yi(i,s,a,c),C=-Yi(r,o,a,c),_=+Yi(r,o,i,s),T=r*d+i*h+a*m,O=d*e[0]+p*e[1]+S*e[2],M=h*e[0]+y*e[1]+C*e[2],I=m*e[0]+x*e[1]+_*e[2];n[0]=O/T,n[1]=M/T,n[2]=I/T}function MC(t,e,n){const r=t[0]*e[0]+t[1]*e[1]+t[2]*e[2],i=t[3]*e[0]+t[4]*e[1]+t[5]*e[2],a=t[6]*e[0]+t[7]*e[1]+t[8]*e[2];n[0]=r,n[1]=i,n[2]=a}function ZP(t,e,n){const r=[...t],i=[...e];for(let a=0;a<3;a++)n[a]=r[0]*i[a]+r[1]*i[a+3]+r[2]*i[a+6],n[a+3]=r[3]*i[a]+r[4]*i[a+3]+r[5]*i[a+6],n[a+6]=r[6]*i[a]+r[7]*i[a+3]+r[8]*i[a+6]}function y3t(t,e,n,r,i,a,o){r!==i&&H2e("Number of columns of A must match number of rows of B.");const s=[...t],c=[...e];for(let l=0;l<n;l++)for(let u=0;u<a;u++){o[l*a+u]=0;for(let f=0;f<r;f++)o[l*a+u]+=s[l*r+f]*c[u+a*f]}}function dy(t,e){let n;n=t[3],e[3]=t[1],e[1]=n,n=t[6],e[6]=t[2],e[2]=n,n=t[7],e[7]=t[5],e[5]=n,e[0]=t[0],e[4]=t[4],e[8]=t[8]}function x3t(t,e){const n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],f=+Yi(o,l,s,u),d=-Yi(a,c,s,u),h=+Yi(a,c,o,l),m=-Yi(r,l,i,u),p=+Yi(n,c,i,u),y=-Yi(n,c,r,l),x=+Yi(r,o,i,s),S=-Yi(n,a,i,s),C=+Yi(n,a,r,o),_=n*f+r*d+i*h;_===0&&s1("Matrix has 0 determinant"),e[0]=f/_,e[3]=d/_,e[6]=h/_,e[1]=m/_,e[4]=p/_,e[7]=y/_,e[2]=x/_,e[5]=S/_,e[8]=C/_}function UE(t){return t[0]*t[4]*t[8]+t[3]*t[7]*t[2]+t[6]*t[1]*t[5]-t[0]*t[7]*t[5]-t[3]*t[1]*t[8]-t[6]*t[4]*t[2]}function Z2e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:PU;if(t.length!==e.length)return!1;function r(i,a){return Math.abs(i-e[a])<=n}return t.every(r)}const d3=Z2e;function Q2e(t){for(let e=0;e<3;e++)t[e*3]=t[e*3+1]=t[e*3+2]=0,t[e*3+e]=1}function J2e(t,e){for(let n=0;n<t;n++){for(let r=0;r<t;r++)e[n*t+r]=0;e[n*t+n]=1}return e}function w3t(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:PU;return d3(t,NU,e)}function b3t(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:PU;return d3(t,Ubt,e)}function exe(t,e){const n=t[0]*t[0],r=t[0]*t[1],i=t[0]*t[2],a=t[0]*t[3],o=t[1]*t[1],s=t[2]*t[2],c=t[3]*t[3],l=t[1]*t[2],u=t[1]*t[3],f=t[2]*t[3],d=o+s+c;let h=1/(n+d);const m=(n-d)*h;h*=2,e[0]=o*h+m,e[3]=(l+a)*h,e[6]=(u-i)*h,e[1]=(l-a)*h,e[4]=s*h+m,e[7]=(f+r)*h,e[2]=(u+i)*h,e[5]=(f-r)*h,e[8]=c*h+m}function RC(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!`${t}`.includes("e"))return+`${Math.round(`${t}e+${e}`)}e-${e}`;const n=`${t}`.split("e");let r="";return+n[1]+e>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+e}`)}e-${e}`}function QP(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return e[0]=RC(t[0],n),e[1]=RC(t[1],n),e[2]=RC(t[2],n),e}function h3(t,e,n,r){let i,a,o,s,c,l,u,f,d,h,m,p,y,x,S,C;const _=pi(e),T=pi(e),O=(I,V,k)=>{x=I[V],y=I[k],I[V]=x-p*(y+x*h),I[k]=y+p*(x-y*h)};for(J2e(e,r),c=0;c<e;c++)_[c]=n[c]=t[c+c*e],T[c]=0;for(i=0;i<yee;i++){for(m=0,c=0;c<e-1;c++)for(s=c+1;s<e;s++)m+=Math.abs(t[c*e+s]);if(m===0)break;for(i<3?u=.2*m/(e*e):u=0,c=0;c<e-1;c++)for(s=c+1;s<e;s++)if(x=100*Math.abs(t[c*e+s]),i>3&&Math.abs(n[c])+x===Math.abs(n[c])&&Math.abs(n[s])+x===Math.abs(n[s]))t[c*e+s]=0;else if(Math.abs(t[c*e+s])>u){for(y=n[s]-n[c],Math.abs(y)+x===Math.abs(y)?d=t[c*e+s]/y:(f=.5*y/t[c*e+s],d=1/(Math.abs(f)+Math.sqrt(1+f*f)),f<0&&(d=-d)),S=1/Math.sqrt(1+d*d),p=d*S,h=p/(1+S),y=d*t[c*e+s],T[c]-=y,T[s]+=y,n[c]-=y,n[s]+=y,t[c*e+s]=0,a=0;a<=c-1;a++)O(t,a*e+c,a*e+s);for(a=c+1;a<=s-1;a++)O(t,c*e+a,a*e+s);for(a=s+1;a<e;a++)O(t,c*e+a,s*e+a);for(a=0;a<e;a++)O(r,a*e+c,a*e+s)}for(c=0;c<e;c++)_[c]+=T[c],n[c]=_[c],T[c]=0}if(i>=yee)return s1("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(a=0;a<e-1;a++){for(o=a,C=n[o],i=a+1;i<e;i++)(n[i]>=C||Math.abs(n[i]-C)<kU)&&(o=i,C=n[o]);o!==a&&(n[o]=n[a],n[a]=C,S5(r,e,a,o))}const M=(e>>1)+(e&1);for(l=0,i=0;i<e*e;i++)r[i]>=0&&l++;if(l<M)for(i=0;i<e;i++)r[i*e+a]*=-1;return 1}function txe(t,e){const n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];n[0]=t[0]+t[4]+t[8],n[5]=t[0]-t[4]-t[8],n[10]=-t[0]+t[4]-t[8],n[15]=-t[0]-t[4]+t[8],n[1]=n[4]=t[7]-t[5],n[2]=n[8]=t[2]-t[6],n[3]=n[12]=t[3]-t[1],n[6]=n[9]=t[3]+t[1],n[7]=n[13]=t[2]+t[6],n[11]=n[14]=t[7]+t[5];const r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],a=[...n];h3(a,4,i,r),e[0]=r[0],e[1]=r[4],e[2]=r[8],e[3]=r[12]}function S3t(t,e,n){const r=t[0]*e[0],i=t[0]*e[1],a=t[0]*e[2],o=t[0]*e[3],s=t[1]*e[0],c=t[1]*e[1],l=t[1]*e[2],u=t[1]*e[3],f=t[2]*e[0],d=t[2]*e[1],h=t[2]*e[2],m=t[2]*e[3],p=t[3]*e[0],y=t[3]*e[1],x=t[3]*e[2],S=t[3]*e[3];n[0]=r-c-h-S,n[1]=i+s+m-x,n[2]=a-u+f+y,n[3]=o+l-d+p}function nxe(t,e){for(let d=0;d<9;d++)e[d]=t[d];const n=pi(3),r=pi(3);let i;for(let d=0;d<3;d++){const h=Math.abs(e[d*3]),m=Math.abs(e[d*3+1]),p=Math.abs(e[d*3+2]);i=m>h?m:h,i=p>i?p:i,n[d]=1,i!==0&&(n[d]/=i)}const a=Math.abs(e[0])*n[0],o=Math.abs(e[3])*n[1],s=Math.abs(e[6])*n[2];r[0]=0,i=a,o>=i&&(i=o,r[0]=1),s>=i&&(r[0]=2),r[0]!==0&&(S5(e,3,r[0],0),n[r[0]]=n[0]);const c=Math.abs(e[4])*n[1],l=Math.abs(e[7])*n[2];r[1]=1,i=c,l>=i&&(r[1]=2,S5(e,3,1,2)),r[2]=2;let u=0;if(UE(e)<0){u=1;for(let d=0;d<9;d++)e[d]=-e[d]}const f=pi(4);if(txe(e,f),exe(f,e),u)for(let d=0;d<9;d++)e[d]=-e[d];r[1]!==1&&S5(e,3,r[1],1),r[0]!==0&&S5(e,3,r[0],0)}function rxe(t,e,n){let r,i,a,o,s,c;const l=[...t];if(h3(l,3,e,n),e[0]===e[1]&&e[0]===e[2]){Q2e(n);return}for(dy(n,n),r=0;r<3;r++)if(e[(r+1)%3]===e[(r+2)%3]){for(c=Math.abs(n[r*3]),o=0,i=1;i<3;i++)c<(s=Math.abs(n[r*3+i]))&&(c=s,o=i);o!==r&&(s=e[o],e[o]=e[r],e[r]=s,K5(n,3,r,o)),n[o*3+o]<0&&(n[o*3]=-n[o*3],n[o*3+1]=-n[o*3+1],n[o*3+2]=-n[o*3+2]),i=(o+1)%3,a=(o+2)%3,n[i*3]=0,n[i*3+1]=0,n[i*3+2]=0,n[i*3+i]=1;const u=_d([n[o*3],n[o*3+1],n[o*3+2]],[n[i*3],n[i*3+1],n[i*3+2]],[]);c1(u);const f=_d(u,[n[o*3],n[o*3+1],n[o*3+2]],[]);for(let d=0;d<3;d++)n[a*3+d]=u[d],n[i*3+d]=f[d];dy(n,n);return}for(c=Math.abs(n[0]),o=0,r=1;r<3;r++)c<(s=Math.abs(n[r*3]))&&(c=s,o=r);if(o!==0){const u=e[o];e[o]=e[0],e[0]=u,K5(n,3,o,0)}if(Math.abs(n[4])<Math.abs(n[7])){const u=e[2];e[2]=e[1],e[1]=u,K5(n,3,1,2)}for(r=0;r<2;r++)n[r*3+r]<0&&(n[r*3]=-n[r*3],n[r*3+1]=-n[r*3+1],n[r*3+2]=-n[r*3+2]);UE(n)<0&&(n[6]=-n[6],n[7]=-n[7],n[8]=-n[8]),dy(n,n)}function C3t(t,e,n,r){let i;const a=[...t],o=UE(a);if(o<0)for(i=0;i<9;i++)a[i]=-a[i];nxe(a,e),dy(a,a),ZP(a,e,r),rxe(r,n,r),ZP(e,r,e),dy(r,r),o<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])}function LU(t,e,n){let r,i,a,o,s=0,c,l,u;const f=pi(n);for(r=0;r<n;r++){for(o=0,i=0;i<n;i++)(u=Math.abs(t[r*n+i]))>o&&(o=u);if(o===0)return s1("Unable to factor linear system"),0;f[r]=1/o}for(i=0;i<n;i++){for(r=0;r<i;r++){for(c=t[r*n+i],a=0;a<r;a++)c-=t[r*n+a]*t[a*n+i];t[r*n+i]=c}for(o=0,r=i;r<n;r++){for(c=t[r*n+i],a=0;a<i;a++)c-=t[r*n+a]*t[a*n+i];t[r*n+i]=c,(l=f[r]*Math.abs(c))>=o&&(o=l,s=r)}if(i!==s){for(a=0;a<n;a++)l=t[s*n+a],t[s*n+a]=t[i*n+a],t[i*n+a]=l;f[s]=f[i]}if(e[i]=s,Math.abs(t[i*n+i])<=kU)return s1("Unable to factor linear system"),0;if(i!==n-1)for(l=1/t[i*n+i],r=i+1;r<n;r++)t[r*n+i]*=l}return 1}function VU(t,e,n,r){let i,a,o,s,c;for(o=-1,i=0;i<r;i++){if(s=e[i],c=n[s],n[s]=n[i],o>=0)for(a=o;a<=i-1;a++)c-=t[i*r+a]*n[a];else c!==0&&(o=i);n[i]=c}for(i=r-1;i>=0;i--){for(c=n[i],a=i+1;a<r;a++)c-=t[i*r+a]*n[a];n[i]=c/t[i*r+i]}}function ixe(t,e,n){if(n===2){const i=pi(2),a=Yi(t[0],t[1],t[2],t[3]);return a===0?0:(i[0]=(t[3]*e[0]-t[1]*e[1])/a,i[1]=(-(t[2]*e[0])+t[0]*e[1])/a,e[0]=i[0],e[1]=i[1],1)}if(n===1)return t[0]===0?0:(e[0]/=t[0],1);const r=pi(n);return LU(t,r,n)===0?0:(VU(t,r,e,n),1)}function axe(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null;const a=r||pi(n),o=i||pi(n);if(LU(t,a,n)===0)return null;for(let s=0;s<n;s++){for(let c=0;c<n;c++)o[c]=0;o[s]=1,VU(t,a,o,n);for(let c=0;c<n;c++)e[c*n+s]=o[c]}return e}function _3t(t,e){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let i=0;i<e;i++)for(let a=i;a<e;a++)Math.abs(t[i*e+a])>r&&(r=Math.abs(t[i*e+a]));for(let i=0;i<e;i++)Math.abs(t[i*e+i])<n&&(n=Math.abs(t[i*e+i]));return n===0?Number.MAX_VALUE:r/n}function T3t(t,e,n){return h3(t,3,e,n)}function JP(t,e,n,r){if(t<n)return s1("Insufficient number of samples. Underdetermined."),0;let i,a,o;const s=pi(n*n),c=pi(n),l=pi(n*n);for(o=0;o<t;o++)for(i=0;i<n;i++)for(a=i;a<n;a++)s[i*n+a]+=e[o*n+i]*e[o*n+a];for(i=0;i<n;i++)for(a=0;a<i;a++)s[i*n+a]=s[a*n+i];for(h3(s,n,c,l),i=0;i<n;i++)r[i]=l[i*n+n-1];return 1}function E3t(t,e,n,r,i,a){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0;if(t<n||t<i)return s1("Insufficient number of samples. Underdetermined."),0;const s=pi(i);let c=1,l,u=0,f,d,h,m=0;if(o){for(d=0;d<i;d++)s[d]=1;for(f=0;f<t;f++)for(d=0;d<i;d++)Math.abs(r[f*i+d])>kU&&(c=0,s[d]=0);if(c&&i===1)return s1("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),JP(t,e,n,a);if(c)m=1;else for(d=0;d<i;d++)s[d]&&(m=1)}m&&(l=pi(n),u=JP(t,e,n,l));const p=pi(n*n),y=pi(n*n),x=pi(n*i);for(h=0;h<t;h++)for(f=0;f<n;f++){for(d=f;d<n;d++)p[f*n+d]+=e[h*n+f]*e[h*n+d];for(d=0;d<i;d++)x[f*i+d]+=e[h*n+f]*r[h*i+d]}for(f=0;f<n;f++)for(d=0;d<f;d++)p[f*n+d]=p[d*n+f];const S=axe(p,y,n);if(S)for(f=0;f<n;f++)for(d=0;d<i;d++)for(a[f*i+d]=0,h=0;h<n;h++)a[f*i+d]+=y[f*n+h]*x[h*i+d];if(m){for(d=0;d<i;d++)if(s[d])for(f=0;f<n;f++)a[f*i+d]=l[f*i]}return m?u&&S:S}function O3t(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,.5,1];switch(t.length){case 3:return e[0]=parseInt(t[0],16)*17/255,e[1]=parseInt(t[1],16)*17/255,e[2]=parseInt(t[2],16)*17/255,e;case 4:return e[0]=parseInt(t[1],16)*17/255,e[1]=parseInt(t[2],16)*17/255,e[2]=parseInt(t[3],16)*17/255,e;case 6:return e[0]=parseInt(t.substr(0,2),16)/255,e[1]=parseInt(t.substr(2,2),16)/255,e[2]=parseInt(t.substr(4,2),16)/255,e;case 7:return e[0]=parseInt(t.substr(1,2),16)/255,e[1]=parseInt(t.substr(3,2),16)/255,e[2]=parseInt(t.substr(5,2),16)/255,e;case 9:return e[0]=parseInt(t.substr(1,2),16)/255,e[1]=parseInt(t.substr(3,2),16)/255,e[2]=parseInt(t.substr(5,2),16)/255,e[3]=parseInt(t.substr(7,2),16)/255,e;default:return e}}function _5(t,e){let n,r;const[i,a,o]=t,s=1/3,c=1/6,l=2/3;let u=i,f=i;a>u?u=a:a<f&&(f=a),o>u?u=o:o<f&&(f=o);const d=u;d>0?r=(u-f)/u:r=0,r>0?(i===u?n=c*(a-o)/(u-f):a===u?n=s+c*(o-i)/(u-f):n=l+c*(i-a)/(u-f),n<0&&(n+=1)):n=0,e[0]=n,e[1]=r,e[2]=d}function um(t,e){const[n,r,i]=t,a=1/3,o=1/6,s=2/3,c=5/6;let l,u,f;n>o&&n<=a?(u=1,l=(a-n)/o,f=0):n>a&&n<=.5?(u=1,f=(n-a)/o,l=0):n>.5&&n<=s?(f=1,u=(s-n)/o,l=0):n>s&&n<=c?(f=1,l=(n-s)/o,u=0):n>c&&n<=1?(l=1,f=(1-n)/o,u=0):(l=1,u=n/o,f=0),l=r*l+(1-r),u=r*u+(1-r),f=r*f+(1-r),l*=i,u*=i,f*=i,e[0]=l,e[1]=u,e[2]=f}function oxe(t,e){const[n,r,i]=t;let a=(n+16)/116,o=r/500+a,s=a-i/200;a**3>.008856?a**=3:a=(a-16/116)/7.787,o**3>.008856?o**=3:o=(o-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787;const c=.9505,l=1,u=1.089;e[0]=c*o,e[1]=l*a,e[2]=u*s}function sxe(t,e){const[n,r,i]=t,a=.9505,o=1,s=1.089;let c=n/a,l=r/o,u=i/s;c>.008856?c**=1/3:c=7.787*c+16/116,l>.008856?l**=1/3:l=7.787*l+16/116,u>.008856?u**=1/3:u=7.787*u+16/116,e[0]=116*l-16,e[1]=500*(c-l),e[2]=200*(l-u)}function cxe(t,e){const[n,r,i]=t;let a=n*3.2406+r*-1.5372+i*-.4986,o=n*-.9689+r*1.8758+i*.0415,s=n*.0557+r*-.204+i*1.057;a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,o>.0031308?o=1.055*o**(1/2.4)-.055:o*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let c=a;c<o&&(c=o),c<s&&(c=s),c>1&&(a/=c,o/=c,s/=c),a<0&&(a=0),o<0&&(o=0),s<0&&(s=0),e[0]=a,e[1]=o,e[2]=s}function lxe(t,e){let[n,r,i]=t;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,i>.04045?i=((i+.055)/1.055)**2.4:i/=12.92,e[0]=n*.4124+r*.3576+i*.1805,e[1]=n*.2126+r*.7152+i*.0722,e[2]=n*.0193+r*.1192+i*.9505}function _m(t,e){const n=[0,0,0];lxe(t,n),sxe(n,e)}function VT(t,e){const n=[0,0,0];oxe(t,n),cxe(n,e)}function P2(t){return t[0]=1,t[1]=-1,t[2]=1,t[3]=-1,t[4]=1,t[5]=-1,t}function IC(t){return!(t[1]-t[0]<0)}function D3t(t,e,n){return n[0]=Math.min(t[0],e[0]),n[1]=Math.max(t[0],e[0]),n[2]=Math.min(t[1],e[1]),n[3]=Math.max(t[1],e[1]),n[4]=Math.min(t[2],e[2]),n[5]=Math.max(t[2],e[2]),n}function cf(t,e,n){return t<e?e:t>n?n:t}function ek(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[0,0,0];return r[0]=cf(t[0],e[0],n[0]),r[1]=cf(t[1],e[1],n[1]),r[2]=cf(t[2],e[2],n[2]),r}function M3t(t,e){let n=0;return e[0]!==e[1]&&(t<e[0]?n=e[0]:t>e[1]?n=e[1]:n=t,n=(n-e[0])/(e[1]-e[0])),n}const R3t=f3("GetScalarTypeFittingRange"),I3t=f3("GetAdjustedScalarRange");function N3t(t,e){if(!t||!e)return 0;for(let n=0;n<6;n+=2)if(t[n]<e[n]||t[n]>e[n+1]||t[n+1]<e[n]||t[n+1]>e[n+1])return 0;return 1}function P3t(t,e,n){if(!t||!e)return 0;for(let r=0;r<6;r+=2)if(t[r]+n[r/2]<e[r]||t[r]-n[r/2]>e[r+1]||t[r+1]+n[r/2]<e[r]||t[r+1]-n[r/2]>e[r+1])return 0;return 1}function k3t(t,e,n){if(!t||!e||!n)return 0;for(let r=0;r<3;r++)if(t[r]+n[r]<e[2*r]||t[r]-n[r]>e[2*r+1])return 0;return 1}function A3t(t,e,n,r){const i=pi(3),a=pi(3),o=pi(3),s=pi(3),c=pi(3),l=pi(3);for(let _=0;_<3;++_)i[_]=t[_]-e[_],a[_]=e[_]-n[_],o[_]=n[_]-t[_],s[_]=-i[_],c[_]=-a[_],l[_]=-o[_];const u=Ng(s),f=Ng(c),d=Ng(o),h=pi(3);_d(i,a,h);const m=Ng(h),p=u*f*d/(2*m),y=2*m*m,x=f*f*Fn(i,l)/y,S=d*d*Fn(s,a)/y,C=u*u*Fn(o,c)/y;for(let _=0;_<3;++_)r[_]=x*t[_]+S*e[_]+C*n[_];return p}const L3t=1/0,V3t=-1/0,uxe=t=>!Number.isFinite(t),{isFinite:$3t,isNaN:tk}=Number,$T=tk;function op(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function j3t(t){let e=-1,n=-1;for(let r=0;r<t.length;r++){const i=Math.abs(t[r]);i>e&&(n=r,e=i)}return n}function fxe(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3;const n=new Array(e),r=new Array(e);for(let a=0;a<e;++a)n[a]=a,r[a]=a;for(let a=e-1;a>0;a--){let o=-1/0,s=0,c=0;for(let l=0;l<=a;++l){const u=n[l];for(let f=0;f<=a;++f){const d=r[f],h=Math.abs(t[u+e*d]);h>o&&(o=h,s=l,c=f)}}[n[a],n[s]]=[n[s],n[a]],[r[a],r[c]]=[r[c],r[a]]}const i=new Array(e*e).fill(0);for(let a=0;a<e;++a){const o=n[a]+e*r[a];i[o]=t[o]<0?-1:1}return i}function dxe(t){const e=Math.floor(t*255);return e>15?e.toString(16):`0${e.toString(16)}`}function U3t(t){return`${arguments.length>1&&arguments[1]!==void 0?arguments[1]:"#"}${t.map(dxe).join("")}`}function yS(t){return Math.round(t*255)}function F3t(t){return t.length===3?`rgb(${t.map(yS).join(", ")})`:`rgba(${yS(t[0]||0)}, ${yS(t[1]||0)}, ${yS(t[2]||0)}, ${t[3]||0})`}var hu={Pi:Fbt,ldexp:Bbt,radiansFromDegrees:Hi,degreesFromRadians:AT,round:zbt,floor:AU,ceil:Gbt,ceilLog2:Xbt,min:Wbt,max:Hbt,arrayMin:qbt,arrayMax:Kbt,arrayRange:Ybt,isPowerOfTwo:C5,nearestPowerOfTwo:yg,factorial:Zbt,binomial:Qbt,beginCombination:Jbt,nextCombination:e3t,randomSeed:t3t,getSeed:n3t,random:r3t,gaussian:i3t,add:LT,subtract:J0,multiplyScalar:K2e,multiplyScalar2D:Y2e,multiplyAccumulate:YP,multiplyAccumulate2D:a3t,dot:Fn,outer:o3t,cross:_d,norm:Ng,normalize:c1,perpendiculars:s3t,projectVector:c3t,projectVector2D:l3t,distance2BetweenPoints:Zf,angleBetweenVectors:u3t,gaussianAmplitude:f3t,gaussianWeight:d3t,dot2D:XP,outer2D:h3t,norm2D:X2e,normalize2D:g3t,determinant2x2:Yi,LUFactor3x3:p3t,LUSolve3x3:m3t,linearSolve3x3:v3t,multiply3x3_vect3:MC,multiply3x3_mat3:ZP,multiplyMatrix:y3t,transpose3x3:dy,invert3x3:x3t,identity3x3:Q2e,identity:J2e,isIdentity:w3t,isIdentity3x3:b3t,determinant3x3:UE,quaternionToMatrix3x3:exe,areEquals:Z2e,areMatricesEqual:d3,roundNumber:RC,roundVector:QP,matrix3x3ToQuaternion:txe,multiplyQuaternion:S3t,orthogonalize3x3:nxe,diagonalize3x3:rxe,singularValueDecomposition3x3:C3t,solveLinearSystem:ixe,invertMatrix:axe,luFactorLinearSystem:LU,luSolveLinearSystem:VU,estimateMatrixCondition:_3t,jacobi:T3t,jacobiN:h3,solveHomogeneousLeastSquares:JP,solveLeastSquares:E3t,hex2float:O3t,rgb2hsv:_5,hsv2rgb:um,lab2xyz:oxe,xyz2lab:sxe,xyz2rgb:cxe,rgb2xyz:lxe,rgb2lab:_m,lab2rgb:VT,uninitializeBounds:P2,areBoundsInitialized:IC,computeBoundsFromPoints:D3t,clampValue:cf,clampVector:ek,clampAndNormalizeValue:M3t,getScalarTypeFittingRange:R3t,getAdjustedScalarRange:I3t,extentIsWithinOtherExtent:N3t,boundsIsWithinOtherBounds:P3t,pointIsWithinBounds:k3t,solve3PointCircle:A3t,inf:L3t,negInf:V3t,isInf:uxe,isNan:tk,isNaN:tk,isFinite:$3t,createUninitializedBounds:op,getMajorAxisIndex:j3t,getSparseOrthogonalMatrix:fxe,floatToHex2:dxe,floatRGB2HexCode:U3t,float2CssRGBA:F3t};const B3t={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},zn={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",UNSIGNED_CHAR_CLAMPED:"Uint8ClampedArray",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"},z3t=zn.FLOAT;var hxe={DefaultDataType:z3t,DataTypeByteSize:B3t,VtkDataTypes:zn};const{vtkErrorMacro:G3t}=Rs,{DefaultDataType:W3t}=hxe,H3t=1e-6;function nk(t,e,n){const r=t.length;let i=Number.MAX_VALUE,a=-Number.MAX_VALUE,o,s;for(s=e;s<r;s+=n)if(!Number.isNaN(t[s])){i=t[s],a=i;break}for(;s<r;s+=n)o=t[s],o<i?i=o:o>a&&(a=o);return{min:i,max:a}}function q3t(){let t=Number.MAX_VALUE,e=-Number.MAX_VALUE,n=0,r=0;return{add(i){t>i&&(t=i),e<i&&(e=i),n++,r+=i},get(){return{min:t,max:e,count:n,sum:r,mean:r/n}},getRange(){return{min:t,max:e}}}}function gxe(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;if(e<0&&n>1){const i=t.length/n,a=new Float64Array(i);for(let o=0,s=0;o<i;++o){for(let c=s+n;s<c;++s)a[o]+=t[s]*t[s];a[o]**=.5}return nk(a,0,1)}return nk(t,e<0?0:e,n)}function xee(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const n=t||[];for(;n.length<=e;)n.push(null);return n}function $U(t){return Object.prototype.toString.call(t).slice(8,-1)}function K3t(t){const e=t.getNumberOfComponents();let n=0;const r=new Array(e);for(let i=0;i<t.getNumberOfTuples();++i){t.getTuple(i,r);const a=Ng(r,e);a>n&&(n=a)}return n}const Y3t={computeRange:gxe,createRangeHelper:q3t,fastComputeRange:nk,getDataType:$U,getMaxNorm:K3t};function X3t(t,e){e.classHierarchy.push("vtkDataArray");function n(r){if(r<0)return!1;const i=t.getNumberOfComponents(),a=e.values.length/(i>0?i:1);if(r===a)return!0;if(r>a){const o=e.values;return e.values=I2(e.dataType,(r+a)*i),e.values.set(o),!0}return e.size>r*i&&(e.size=r*i,t.dataChange()),!0}t.dataChange=()=>{e.ranges=null,t.modified()},t.resize=r=>{n(r);const i=r*t.getNumberOfComponents();return e.size!==i?(e.size=i,t.dataChange(),!0):!1},t.initialize=()=>{t.resize(0)},t.getElementComponentSize=()=>e.values.BYTES_PER_ELEMENT,t.getComponent=function(r){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.values[r*e.numberOfComponents+i]},t.setComponent=(r,i,a)=>{a!==e.values[r*e.numberOfComponents+i]&&(e.values[r*e.numberOfComponents+i]=a,t.dataChange())},t.getValue=r=>{const i=r/e.numberOfComponents,a=r%e.numberOfComponents;return t.getComponent(i,a)},t.setValue=(r,i)=>{const a=r/e.numberOfComponents,o=r%e.numberOfComponents;t.setComponent(a,o,i)},t.getData=()=>e.size===e.values.length?e.values:e.values.subarray(0,e.size),t.getRange=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:-1,i=r;i<0&&(i=e.numberOfComponents===1?0:e.numberOfComponents);let a=null;return e.ranges||(e.ranges=xee(e.ranges,e.numberOfComponents)),a=e.ranges[i],a?(e.rangeTuple[0]=a.min,e.rangeTuple[1]=a.max,e.rangeTuple):(a=gxe(t.getData(),r,e.numberOfComponents),e.ranges[i]=a,e.rangeTuple[0]=a.min,e.rangeTuple[1]=a.max,e.rangeTuple)},t.setRange=(r,i)=>{e.ranges||(e.ranges=xee(e.ranges,e.numberOfComponents));const a={min:r.min,max:r.max};return e.ranges[i]=a,e.rangeTuple[0]=a.min,e.rangeTuple[1]=a.max,e.rangeTuple},t.getRanges=function(){if(!(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0))return structuredClone(e.ranges);const i=[];for(let a=0;a<e.numberOfComponents;a++){const[o,s]=t.getRange(a),c={min:o,max:s};i.push(c)}if(e.numberOfComponents>1){const[a,o]=t.getRange(-1),s={min:a,max:o};i.push(s)}return i},t.setTuple=(r,i)=>{const a=r*e.numberOfComponents;for(let o=0;o<e.numberOfComponents;o++)e.values[a+o]=i[o]},t.setTuples=(r,i)=>{let a=r*e.numberOfComponents;const o=Math.min(i.length,e.size-a);for(let s=0;s<o;)e.values[a++]=i[s++]},t.insertTuple=(r,i)=>(e.size<=r*e.numberOfComponents&&(e.size=(r+1)*e.numberOfComponents,n(r+1)),t.setTuple(r,i),r),t.insertTuples=(r,i)=>{const a=r+i.length/e.numberOfComponents;return e.size<a*e.numberOfComponents&&(e.size=a*e.numberOfComponents,n(a)),t.setTuples(r,i),a},t.insertNextTuple=r=>{const i=e.size/e.numberOfComponents;return t.insertTuple(i,r)},t.insertNextTuples=r=>{const i=e.size/e.numberOfComponents;return t.insertTuples(i,r)},t.findTuple=function(r){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:H3t;for(let a=0;a<e.size;a+=e.numberOfComponents)if(Math.abs(r[0]-e.values[a])<=i){let o=!0;for(let s=1;s<e.numberOfComponents;++s)if(Math.abs(r[s]-e.values[a+s])>i){o=!1;break}if(o)return a/e.numberOfComponents}return-1},t.getTuple=function(r){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const a=e.numberOfComponents||1,o=r*a;switch(a){case 4:i[3]=e.values[o+3];case 3:i[2]=e.values[o+2];case 2:i[1]=e.values[o+1];case 1:i[0]=e.values[o];break;default:for(let s=a-1;s>=0;--s)i[s]=e.values[o+s]}return i},t.getTuples=(r,i)=>{const a=(r??0)*e.numberOfComponents,o=(i??t.getNumberOfTuples())*e.numberOfComponents,s=t.getData().subarray(a,o);return s.length>0?s:null},t.getTupleLocation=function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:1)*e.numberOfComponents},t.getNumberOfComponents=()=>e.numberOfComponents,t.getNumberOfValues=()=>e.size,t.getNumberOfTuples=()=>e.size/e.numberOfComponents,t.getDataType=()=>e.dataType,t.newClone=()=>mxe({empty:!0,name:e.name,dataType:e.dataType,numberOfComponents:e.numberOfComponents}),t.getName=()=>(e.name||(t.modified(),e.name=`vtkDataArray${t.getMTime()}`),e.name),t.setData=(r,i)=>{e.values=r,e.size=r.length,e.dataType=$U(r),i&&(e.numberOfComponents=i),e.size%e.numberOfComponents!==0&&(e.numberOfComponents=1),t.dataChange()},t.getState=()=>{if(e.deleted)return null;const r={...e,vtkClass:t.getClassName()};r.values=Array.from(r.values),delete r.buffer,Object.keys(r).forEach(a=>{r[a]||delete r[a]});const i={};return Object.keys(r).sort().forEach(a=>{i[a]=r[a]}),i.mtime&&delete i.mtime,i},t.deepCopy=r=>{const i=t.getDataType(),a=e.values;t.shallowCopy(r),e.ranges=structuredClone(r.getRanges()),a?.length>=r.getNumberOfValues()&&i===r.getDataType()?(a.set(r.getData()),e.values=a,t.dataChange()):t.setData(r.getData().slice())},t.interpolateTuple=(r,i,a,o,s,c)=>{const l=e.numberOfComponents||1;(l!==i.getNumberOfComponents()||l!==o.getNumberOfComponents())&&G3t("numberOfComponents must match");const u=i.getTuple(a),f=o.getTuple(s),d=[];switch(d.length=l,l){case 4:d[3]=u[3]+(f[3]-u[3])*c;case 3:d[2]=u[2]+(f[2]-u[2])*c;case 2:d[1]=u[1]+(f[1]-u[1])*c;case 1:d[0]=u[0]+(f[0]-u[0])*c;break;default:for(let h=0;h<l;h++)d[h]=u[h]+(f[h]-u[h])*c}return t.insertTuple(r,d)}}const Z3t={name:"",numberOfComponents:1,dataType:W3t,rangeTuple:[0,0]};function pxe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Object.assign(e,Z3t,n),Array.isArray(n.values)&&n.dataType===void 0&&console.warn("vtkDataArray.newInstance: no dataType provided, converting to Float32Array"),!e.empty&&!e.values&&!e.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(e.values?Array.isArray(e.values)&&(e.values=$E(e.dataType,e.values)):e.values=I2(e.dataType,e.size),e.values&&(e.size=e.size??e.values.length,e.dataType=$U(e.values)),yi(t,e),c3(t,e,["name","numberOfComponents"]),e.size%e.numberOfComponents!==0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");X3t(t,e)}const mxe=ri(pxe,"vtkDataArray");var On={newInstance:mxe,extend:pxe,...Y3t,...hxe};const Q3t={MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},rk={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var jU={VectorMode:Q3t,ScalarMappingTarget:rk};const J3t={DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},e4t={DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5},t4t={BY_ID:0,BY_NAME:1};var UU={ColorMode:J3t,GetArray:t4t,ScalarMode:e4t};const{ScalarMappingTarget:wee,VectorMode:Yf}=jU,{VtkDataTypes:ag}=On,{ColorMode:xS}=UU,{vtkErrorMacro:bee}=se;function n4t(t){return t}function See(t){return Math.floor(t*255+.5)}function r4t(t,e){e.classHierarchy.push("vtkScalarsToColors"),t.setVectorModeToMagnitude=()=>t.setVectorMode(Yf.MAGNITUDE),t.setVectorModeToComponent=()=>t.setVectorMode(Yf.COMPONENT),t.setVectorModeToRGBColors=()=>t.setVectorMode(Yf.RGBCOLORS),t.build=()=>{},t.isOpaque=()=>!0,t.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r)){if(n&&r&&n.length!==r.length){bee("Values and annotations do not have the same number of tuples so ignoring");return}if(e.annotationArray=[],r&&n){const i=r.length;for(let a=0;a<i;a++)e.annotationArray.push({value:n[a],annotation:String(r[a])})}t.updateAnnotatedValueMap(),t.modified()}},t.setAnnotation=(n,r)=>{let i=t.checkForAnnotatedValue(n),a=!1;return i>=0?e.annotationArray[i].annotation!==r&&(e.annotationArray[i].annotation=r,a=!0):(e.annotationArray.push({value:n,annotation:r}),i=e.annotationArray.length-1,a=!0),a&&(t.updateAnnotatedValueMap(),t.modified()),i},t.getNumberOfAnnotatedValues=()=>e.annotationArray.length,t.getAnnotatedValue=n=>n<0||n>=e.annotationArray.length?null:e.annotationArray[n].value,t.getAnnotation=n=>e.annotationArray[n]===void 0?null:e.annotationArray[n].annotation,t.getAnnotatedValueIndex=n=>e.annotationArray.length?t.checkForAnnotatedValue(n):-1,t.removeAnnotation=n=>{const r=t.checkForAnnotatedValue(n),i=r>=0;return i&&(e.annotationArray.splice(r,1),t.updateAnnotatedValueMap(),t.modified()),i},t.resetAnnotations=()=>{e.annotationArray=[],e.annotatedValueMap=[],t.modified()},t.getAnnotationColor=(n,r)=>{if(e.indexedLookup){const i=t.getAnnotatedValueIndex(n);t.getIndexedColor(i,r)}else t.getColor(parseFloat(n),r),r[3]=1},t.checkForAnnotatedValue=n=>t.getAnnotatedValueIndexInternal(n),t.getAnnotatedValueIndexInternal=n=>{if(e.annotatedValueMap[n]!==void 0){const r=e.annotationArray.length;return e.annotatedValueMap[n]%r}return-1},t.getIndexedColor=(n,r)=>{r[0]=0,r[1]=0,r[2]=0,r[3]=0},t.updateAnnotatedValueMap=()=>{e.annotatedValueMap=[];const n=e.annotationArray.length;for(let r=0;r<n;r++)e.annotatedValueMap[e.annotationArray[r].value]=r},t.mapScalars=(n,r,i)=>{const a=n.getNumberOfComponents();let o=null;if(r===xS.DEFAULT&&(n.getDataType()===ag.UNSIGNED_CHAR||n.getDataType()===ag.UNSIGNED_CHAR_CLAMPED)||r===xS.DIRECT_SCALARS&&n)o=t.convertToRGBA(n,a,n.getNumberOfTuples());else{const s={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:ag.UNSIGNED_CHAR},c=se.newTypedArray(s.dataType,4*n.getNumberOfTuples());s.values=c,s.size=c.length,o=On.newInstance(s);let l=i;l<0&&a>1?t.mapVectorsThroughTable(n,o,wee.RGBA,-1,-1):(l<0&&(l=0),l>=a&&(l=a-1),t.mapScalarsThroughTable(n,o,wee.RGBA,l))}return o},t.mapVectorsToMagnitude=(n,r,i)=>{const a=n.getNumberOfTuples(),o=n.getNumberOfComponents(),s=r.getData(),c=n.getData();for(let l=0;l<a;l++){let u=0;for(let f=0;f<i;f++)u+=c[l*o+f]*c[l*o+f];s[l]=Math.sqrt(u)}},t.mapVectorsThroughTable=(n,r,i,a,o)=>{let s=t.getVectorMode(),c=o,l=a;const u=n.getNumberOfComponents();s===Yf.COMPONENT?(l===-1&&(l=t.getVectorComponent()),l<0&&(l=0),l>=u&&(l=u-1)):(c===-1&&(c=t.getVectorSize()),c<=0?(l=0,c=u):(l<0&&(l=0),l>=u&&(l=u-1),l+c>u&&(c=u-l)),s===Yf.MAGNITUDE&&(u===1||c===1)&&(s=Yf.COMPONENT));let f=0;switch(l>0&&(f=l),s){case Yf.COMPONENT:{t.mapScalarsThroughTable(n,r,i,f);break}case Yf.RGBCOLORS:break;case Yf.MAGNITUDE:default:{const d=On.newInstance({numberOfComponents:1,values:new Float32Array(n.getNumberOfTuples())});t.mapVectorsToMagnitude(n,d,c),t.mapScalarsThroughTable(d,r,i,0);break}}},t.luminanceToRGBA=(n,r,i,a)=>{const o=a(i),s=r.getData(),c=n.getData(),l=s.length,u=0,f=1;let d=0;for(let h=u;h<l;h+=f){const m=a(s[h]);c[d*4]=m,c[d*4+1]=m,c[d*4+2]=m,c[d*4+3]=o,d++}},t.luminanceAlphaToRGBA=(n,r,i,a)=>{const o=r.getData(),s=n.getData(),c=o.length,l=0,u=2;let f=0;for(let d=l;d<c;d+=u){const h=a(o[d]);s[f]=h,s[f+1]=h,s[f+2]=h,s[f+3]=a(o[d+1])*i,f+=4}},t.rGBToRGBA=(n,r,i,a)=>{const o=See(i),s=r.getData(),c=n.getData(),l=s.length,u=0,f=3;let d=0;for(let h=u;h<l;h+=f)c[d*4]=a(s[h]),c[d*4+1]=a(s[h+1]),c[d*4+2]=a(s[h+2]),c[d*4+3]=o,d++},t.rGBAToRGBA=(n,r,i,a)=>{const o=r.getData(),s=n.getData(),c=o.length,l=0,u=4;let f=0;for(let d=l;d<c;d+=u)s[f*4]=a(o[d]),s[f*4+1]=a(o[d+1]),s[f*4+2]=a(o[d+2]),s[f*4+3]=a(o[d+3])*i,f++},t.convertToRGBA=(n,r,i)=>{let{alpha:a}=e;if(r===4&&a>=1&&n.getDataType()===ag.UNSIGNED_CHAR)return n;const o=On.newInstance({numberOfComponents:4,empty:!0,size:4*i,dataType:ag.UNSIGNED_CHAR});if(i<=0)return o;a=a>0?a:0,a=a<1?a:1;let s=n4t;switch((n.getDataType()===ag.FLOAT||n.getDataType()===ag.DOUBLE)&&(s=See),r){case 1:t.luminanceToRGBA(o,n,a,s);break;case 2:t.luminanceAlphaToRGBA(o,n,s);break;case 3:t.rGBToRGBA(o,n,a,s);break;case 4:t.rGBAToRGBA(o,n,a,s);break;default:return bee("Cannot convert colors"),null}return o},t.usingLogScale=()=>!1,t.getNumberOfAvailableColors=()=>256*256*256,t.setRange=(n,r)=>t.setMappingRange(n,r),t.getRange=()=>t.getMappingRange(),t.areScalarsOpaque=(n,r,i)=>{if(!n)return t.isOpaque();const a=n.getNumberOfComponents();return r===xS.DEFAULT&&n.getDataType()===ag.UNSIGNED_CHAR||r===xS.DIRECT_SCALARS?a===3||a===1?e.alpha>=1:n.getRange(a-1)[0]===255:!0}}const i4t={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:Yf.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function vxe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,i4t,n),se.obj(t,e),e.mappingRange=[0,255],e.annotationArray=[],e.annotatedValueMap=[],se.setGet(t,e,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),se.setArray(t,e,["mappingRange"],2),se.getArray(t,e,["mappingRange"]),r4t(t,e)}const a4t=se.newInstance(vxe,"vtkScalarsToColors");var FU={newInstance:a4t,extend:vxe,...jU};const o4t={RGB:0,HSV:1,LAB:2,DIVERGING:3},s4t={LINEAR:0,LOG10:1};var yxe={ColorSpace:o4t,Scale:s4t};const{ColorSpace:su,Scale:BU}=yxe,{ScalarMappingTarget:wS}=FU,{vtkDebugMacro:c4t,vtkErrorMacro:d0,vtkWarningMacro:l4t}=se;function Cee(t,e){const n=t[0],r=t[1],i=t[2],a=Math.sqrt(n*n+r*r+i*i),o=a>.001?Math.acos(n/a):0,s=o>.001?Math.atan2(i,r):0;e[0]=a,e[1]=o,e[2]=s}function u4t(t,e){const n=t[0],r=t[1],i=t[2];e[0]=n*Math.cos(r),e[1]=n*Math.sin(r)*Math.cos(i),e[2]=n*Math.sin(r)*Math.sin(i)}function _ee(t,e){if(t[0]>=e-.1)return t[2];const n=t[1]*Math.sqrt(e*e-t[0]*t[0])/(t[0]*Math.sin(t[1]));return t[2]>-.3*Math.PI?t[2]+n:t[2]-n}function f4t(t,e){let n=t-e;for(n<0&&(n=-n);n>=2*Math.PI;)n-=2*Math.PI;return n>Math.PI&&(n=2*Math.PI-n),n}function Tee(t,e,n,r){const i=[],a=[];_m(e,i),_m(n,a);const o=[],s=[];Cee(i,o),Cee(a,s);let c=t;if(o[1]>.05&&s[1]>.05&&f4t(o[2],s[2])>.33*Math.PI){let f=Math.max(o[0],s[0]);f=Math.max(88,f),t<.5?(s[0]=f,s[1]=0,s[2]=0,c*=2):(o[0]=f,o[1]=0,o[2]=0,c=2*c-1)}o[1]<.05&&s[1]>.05?o[2]=_ee(s,o[0]):s[1]<.05&&o[1]>.05&&(s[2]=_ee(o,s[0]));const l=[];l[0]=(1-c)*o[0]+c*s[0],l[1]=(1-c)*o[1]+c*s[1],l[2]=(1-c)*o[2]+c*s[2];const u=[];u4t(l,u),VT(u,r)}function d4t(t,e){e.classHierarchy.push("vtkColorTransferFunction"),t.getSize=()=>e.nodes.length,t.addRGBPoint=(n,r,i,a)=>t.addRGBPointLong(n,r,i,a,.5,0),t.addRGBPointLong=function(n,r,i,a){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:.5,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(o<0||o>1)return d0("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return d0("Sharpness outside range [0.0, 1.0]"),-1;e.allowDuplicateScalars||t.removePoint(n);const c={x:n,r,g:i,b:a,midpoint:o,sharpness:s};e.nodes.push(c),t.sortAndUpdateRange();let l=0;for(;l<e.nodes.length&&e.nodes[l].x!==n;l++);return l<e.nodes.length?l:-1},t.addHSVPoint=(n,r,i,a)=>t.addHSVPointLong(n,r,i,a,.5,0),t.addHSVPointLong=function(n,r,i,a){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:.5,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;const c=[];return um([r,i,a],c),t.addRGBPoint(n,c[0],c[1],c[2],o,s)},t.setNodes=n=>{if(e.nodes!==n){const r=JSON.stringify(e.nodes);e.nodes=n;const i=JSON.stringify(e.nodes);if(t.sortAndUpdateRange()||r!==i)return t.modified(),!0}return!1},t.sortAndUpdateRange=()=>{const n=JSON.stringify(e.nodes);e.nodes.sort((a,o)=>a.x-o.x);const r=JSON.stringify(e.nodes),i=t.updateRange();return!i&&n!==r?(t.modified(),!0):i},t.updateRange=()=>{const n=[2];n[0]=e.mappingRange[0],n[1]=e.mappingRange[1];const r=e.nodes.length;return r?(e.mappingRange[0]=e.nodes[0].x,e.mappingRange[1]=e.nodes[r-1].x):(e.mappingRange[0]=0,e.mappingRange[1]=0),n[0]===e.mappingRange[0]&&n[1]===e.mappingRange[1]?!1:(t.modified(),!0)},t.removePoint=n=>{let r=0;for(;r<e.nodes.length&&e.nodes[r].x!==n;r++);const i=r;if(r>=e.nodes.length)return-1;let a=!1;return e.nodes.splice(r,1),(r===0||r===e.nodes.length)&&(a=t.updateRange()),a||t.modified(),i},t.movePoint=(n,r)=>{if(n!==r){t.removePoint(r);for(let i=0;i<e.nodes.length;i++)if(e.nodes[i].x===n){e.nodes[i].x=r,t.sortAndUpdateRange();break}}},t.removeAllPoints=()=>{e.nodes=[],t.sortAndUpdateRange()},t.addRGBSegment=(n,r,i,a,o,s,c,l)=>{t.sortAndUpdateRange();for(let u=0;u<e.nodes.length;)e.nodes[u].x>=n&&e.nodes[u].x<=o?e.nodes.splice(u,1):u++;t.addRGBPointLong(n,r,i,a,.5,0),t.addRGBPointLong(o,s,c,l,.5,0),t.modified()},t.addHSVSegment=(n,r,i,a,o,s,c,l)=>{const u=[r,i,a],f=[s,c,l],d=[],h=[];um(u,d),um(f,h),t.addRGBSegment(n,d[0],d[1],d[2],o,h[0],h[1],h[2])},t.mapValue=n=>{const r=[];return t.getColor(n,r),[Math.floor(255*r[0]+.5),Math.floor(255*r[1]+.5),Math.floor(255*r[2]+.5),255]},t.getColor=(n,r)=>{if(e.indexedLookup){const i=t.getSize(),a=t.getAnnotatedValueIndexInternal(n);if(a<0||i===0){const o=t.getNanColorByReference();r[0]=o[0],r[1]=o[1],r[2]=o[2]}else{const o=[];t.getNodeValue(a%i,o),r[0]=o[1],r[1]=o[2],r[2]=o[3]}return}t.getTable(n,n,1,r)},t.getRedValue=n=>{const r=[];return t.getColor(n,r),r[0]},t.getGreenValue=n=>{const r=[];return t.getColor(n,r),r[1]},t.getBlueValue=n=>{const r=[];return t.getColor(n,r),r[2]},t.getTable=(n,r,i,a)=>{const o=Number(n),s=Number(r);if($T(o)||$T(s)){for(let V=0;V<i;V++)a[V*3+0]=e.nanColor[0],a[V*3+1]=e.nanColor[1],a[V*3+2]=e.nanColor[2];return}let c=0;const l=e.nodes.length;let u=0,f=0,d=0;l!==0&&(u=e.nodes[l-1].r,f=e.nodes[l-1].g,d=e.nodes[l-1].b);let h=0,m=0,p=0;const y=[0,0,0],x=[0,0,0];let S=0,C=0;const _=[];let T=e.scale===BU.LOG10;T&&(T=e.mappingRange[0]>0);let O=0,M=0,I=0;T&&(O=Math.log10(o),M=Math.log10(s));for(let V=0;V<i;V++){const k=3*V;if(i>1?T?(I=O+V/(i-1)*(M-O),h=10**I):h=o+V/(i-1)*(s-o):T?(I=.5*(O+M),h=10**I):h=.5*(o+s),e.discretize){const L=e.mappingRange;if(h>=L[0]&&h<=L[1]){const $=e.numberOfValues,W=L[1]-L[0];if($<=1)h=L[0]+W/2;else{const G=(h-L[0])/W,oe=AU($*G);h=L[0]+oe/($-1)*W}}}for(;c<l&&h>e.nodes[c].x;)c++,c<l&&(m=e.nodes[c-1].x,p=e.nodes[c].x,T&&(m=Math.log10(m),p=Math.log10(p)),y[0]=e.nodes[c-1].r,x[0]=e.nodes[c].r,y[1]=e.nodes[c-1].g,x[1]=e.nodes[c].g,y[2]=e.nodes[c-1].b,x[2]=e.nodes[c].b,S=e.nodes[c-1].midpoint,C=e.nodes[c-1].sharpness,S<1e-5&&(S=1e-5),S>.99999&&(S=.99999));if(h>e.mappingRange[1])a[k]=0,a[k+1]=0,a[k+2]=0,e.clamping&&(t.getUseAboveRangeColor()?(a[k]=e.aboveRangeColor[0],a[k+1]=e.aboveRangeColor[1],a[k+2]=e.aboveRangeColor[2]):(a[k]=u,a[k+1]=f,a[k+2]=d));else if(h<e.mappingRange[0]||uxe(h)&&h<0)a[k]=0,a[k+1]=0,a[k+2]=0,e.clamping&&(t.getUseBelowRangeColor()?(a[k]=e.belowRangeColor[0],a[k+1]=e.belowRangeColor[1],a[k+2]=e.belowRangeColor[2]):l>0&&(a[k]=e.nodes[0].r,a[k+1]=e.nodes[0].g,a[k+2]=e.nodes[0].b));else if(c===0&&(Math.abs(h-o)<1e-6||e.discretize))l>0?(a[k]=e.nodes[0].r,a[k+1]=e.nodes[0].g,a[k+2]=e.nodes[0].b):(a[k]=0,a[k+1]=0,a[k+2]=0);else{let L=0;if(T?L=(I-m)/(p-m):L=(h-m)/(p-m),L<S?L=.5*L/S:L=.5+.5*(L-S)/(1-S),C>.99)if(L<.5){a[k]=y[0],a[k+1]=y[1],a[k+2]=y[2];continue}else{a[k]=x[0],a[k+1]=x[1],a[k+2]=x[2];continue}if(C<.01){if(e.colorSpace===su.RGB)a[k]=(1-L)*y[0]+L*x[0],a[k+1]=(1-L)*y[1]+L*x[1],a[k+2]=(1-L)*y[2]+L*x[2];else if(e.colorSpace===su.HSV){const F=[],ae=[];_5(y,F),_5(x,ae),e.hSVWrap&&(F[0]-ae[0]>.5||ae[0]-F[0]>.5)&&(F[0]>ae[0]?F[0]-=1:ae[0]-=1);const re=[];re[0]=(1-L)*F[0]+L*ae[0],re[0]<0&&(re[0]+=1),re[1]=(1-L)*F[1]+L*ae[1],re[2]=(1-L)*F[2]+L*ae[2],um(re,_),a[k]=_[0],a[k+1]=_[1],a[k+2]=_[2]}else if(e.colorSpace===su.LAB){const F=[],ae=[];_m(y,F),_m(x,ae);const re=[];re[0]=(1-L)*F[0]+L*ae[0],re[1]=(1-L)*F[1]+L*ae[1],re[2]=(1-L)*F[2]+L*ae[2],VT(re,_),a[k]=_[0],a[k+1]=_[1],a[k+2]=_[2]}else e.colorSpace===su.DIVERGING?(Tee(L,y,x,_),a[k]=_[0],a[k+1]=_[1],a[k+2]=_[2]):d0("ColorSpace set to invalid value.",e.colorSpace);continue}L<.5?L=.5*(L*2)**(1+10*C):L>.5&&(L=1-.5*((1-L)*2)**(1+10*C));const $=L*L,W=$*L,G=2*W-3*$+1,oe=-2*W+3*$,U=W-2*$+L,Y=W-$;let J,ne;if(e.colorSpace===su.RGB)for(let F=0;F<3;F++)J=x[F]-y[F],ne=(1-C)*J,a[k+F]=G*y[F]+oe*x[F]+U*ne+Y*ne;else if(e.colorSpace===su.HSV){const F=[],ae=[];_5(y,F),_5(x,ae),e.hSVWrap&&(F[0]-ae[0]>.5||ae[0]-F[0]>.5)&&(F[0]>ae[0]?F[0]-=1:ae[0]-=1);const re=[];for(let te=0;te<3;te++)J=ae[te]-F[te],ne=(1-C)*J,re[te]=G*F[te]+oe*ae[te]+U*ne+Y*ne,te===0&&re[te]<0&&(re[te]+=1);um(re,_),a[k]=_[0],a[k+1]=_[1],a[k+2]=_[2]}else if(e.colorSpace===su.LAB){const F=[],ae=[];_m(y,F),_m(x,ae);const re=[];for(let te=0;te<3;te++)J=ae[te]-F[te],ne=(1-C)*J,re[te]=G*F[te]+oe*ae[te]+U*ne+Y*ne;VT(re,_),a[k]=_[0],a[k+1]=_[1],a[k+2]=_[2]}else e.colorSpace===su.DIVERGING?(Tee(L,y,x,_),a[k]=_[0],a[k+1]=_[1],a[k+2]=_[2]):d0("ColorSpace set to invalid value.");for(let F=0;F<3;F++)a[k+F]=a[k+F]<0?0:a[k+F],a[k+F]=a[k+F]>1?1:a[k+F]}}},t.getUint8Table=function(n,r,i){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t.getMTime()<=e.buildTime&&e.tableSize===i&&e.tableWithAlpha!==a)return e.table;if(e.nodes.length===0)return d0("Attempting to lookup a value with no points in the function"),e.table;const o=a?4:3;(e.tableSize!==i||e.tableWithAlpha!==a)&&(e.table=new Uint8Array(i*o),e.tableSize=i,e.tableWithAlpha=a);const s=[];t.getTable(n,r,i,s);for(let c=0;c<i;c++)e.table[c*o+0]=Math.floor(s[c*3+0]*255+.5),e.table[c*o+1]=Math.floor(s[c*3+1]*255+.5),e.table[c*o+2]=Math.floor(s[c*3+2]*255+.5),a&&(e.table[c*o+3]=255);return e.buildTime.modified(),e.table},t.buildFunctionFromArray=n=>{t.removeAllPoints();const r=n.getNumberOfComponents();for(let i=0;i<n.getNumberOfTuples();i++)switch(r){case 3:{e.nodes.push({x:i,r:n.getComponent(i,0),g:n.getComponent(i,1),b:n.getComponent(i,2),midpoint:.5,sharpness:0});break}case 4:{e.nodes.push({x:n.getComponent(i,0),r:n.getComponent(i,1),g:n.getComponent(i,2),b:n.getComponent(i,3),midpoint:.5,sharpness:0});break}case 5:{e.nodes.push({x:i,r:n.getComponent(i,0),g:n.getComponent(i,1),b:n.getComponent(i,2),midpoint:n.getComponent(i,4),sharpness:n.getComponent(i,5)});break}case 6:{e.nodes.push({x:n.getComponent(i,0),r:n.getComponent(i,1),g:n.getComponent(i,2),b:n.getComponent(i,3),midpoint:n.getComponent(i,4),sharpness:n.getComponent(i,5)});break}}t.sortAndUpdateRange()},t.buildFunctionFromTable=(n,r,i,a)=>{let o=0;t.removeAllPoints(),i>1&&(o=(r-n)/(i-1));for(let s=0;s<i;s++){const c={x:n+o*s,r:a[s*3],g:a[s*3+1],b:a[s*3+2],sharpness:0,midpoint:.5};e.nodes.push(c)}t.sortAndUpdateRange()},t.getNodeValue=(n,r)=>n<0||n>=e.nodes.length?(d0("Index out of range!"),-1):(r[0]=e.nodes[n].x,r[1]=e.nodes[n].r,r[2]=e.nodes[n].g,r[3]=e.nodes[n].b,r[4]=e.nodes[n].midpoint,r[5]=e.nodes[n].sharpness,1),t.setNodeValue=(n,r)=>{if(n<0||n>=e.nodes.length)return d0("Index out of range!"),-1;const i=e.nodes[n].x;return e.nodes[n].x=r[0],e.nodes[n].r=r[1],e.nodes[n].g=r[2],e.nodes[n].b=r[3],e.nodes[n].midpoint=r[4],e.nodes[n].sharpness=r[5],i!==r[0]?t.sortAndUpdateRange():t.modified(),1},t.getNumberOfAvailableColors=()=>{if(e.indexedLookup&&t.getSize())return t.getSize();if(e.tableSize)return e.tableSize;const n=e.nodes?.length??0;return Math.max(4094,n)},t.getIndexedColor=(n,r)=>{const i=t.getSize();if(i>0&&n>=0){const o=[];t.getNodeValue(n%i,o);for(let s=0;s<3;++s)r[s]=o[s+1];r[3]=1;return}const a=t.getNanColorByReference();r[0]=a[0],r[1]=a[1],r[2]=a[2],r[3]=1},t.fillFromDataPointer=(n,r)=>{if(!(n<=0||!r)){t.removeAllPoints();for(let i=0;i<n;i++)t.addRGBPoint(r[i*4],r[i*4+1],r[i*4+2],r[i*4+3])}},t.setMappingRange=(n,r)=>{const i=[n,r],a=t.getRange();if(a[1]===i[1]&&a[0]===i[0])return;if(i[1]===i[0]){d0("attempt to set zero width color range");return}const o=(i[1]-i[0])/(a[1]-a[0]),s=i[0]-a[0]*o;for(let c=0;c<e.nodes.length;++c)e.nodes[c].x=e.nodes[c].x*o+s;e.mappingRange[0]=i[0],e.mappingRange[1]=i[1],t.modified()},t.adjustRange=n=>{const r=t.getRange(),i=[];r[0]<n[0]?(t.getColor(n[0],i),t.addRGBPoint(n[0],i[0],i[1],i[2])):(t.getColor(r[0],i),t.addRGBPoint(n[0],i[0],i[1],i[2])),r[1]>n[1]?(t.getColor(n[1],i),t.addRGBPoint(n[1],i[0],i[1],i[2])):(t.getColor(r[1],i),t.addRGBPoint(n[1],i[0],i[1],i[2])),t.sortAndUpdateRange();for(let a=0;a<e.nodes.length;)e.nodes[a].x>=n[0]&&e.nodes[a].x<=n[1]?e.nodes.splice(a,1):++a;return 1},t.estimateMinNumberOfSamples=(n,r)=>{const i=t.findMinimumXDistance();return Math.ceil((r-n)/i)},t.findMinimumXDistance=()=>{if(e.nodes.length<2)return-1;let n=Number.MAX_VALUE;for(let r=0;r<e.nodes.length-1;r++){const i=e.nodes[r+1].x-e.nodes[r].x;i<n&&(n=i)}return n},t.mapScalarsThroughTable=(n,r,i,a)=>{if(t.getSize()===0){c4t("Transfer Function Has No Points!");return}e.indexedLookup?t.mapDataIndexed(n,r,i,a):t.mapData(n,r,i,a)},t.mapData=(n,r,i,a)=>{if(t.getSize()===0){l4t("Transfer Function Has No Points!");return}const o=Math.floor(t.getAlpha()*255+.5),s=n.getNumberOfTuples(),c=n.getNumberOfComponents(),l=r.getData(),u=n.getData(),f=[];if(i===wS.RGBA)for(let d=0;d<s;d++){const h=u[d*c+a];t.getColor(h,f),l[d*4]=Math.floor(f[0]*255+.5),l[d*4+1]=Math.floor(f[1]*255+.5),l[d*4+2]=Math.floor(f[2]*255+.5),l[d*4+3]=o}if(i===wS.RGB)for(let d=0;d<s;d++){const h=u[d*c+a];t.getColor(h,f),l[d*3]=Math.floor(f[0]*255+.5),l[d*3+1]=Math.floor(f[1]*255+.5),l[d*3+2]=Math.floor(f[2]*255+.5)}if(i===wS.LUMINANCE)for(let d=0;d<s;d++){const h=u[d*c+a];t.getColor(h,f),l[d]=Math.floor(f[0]*76.5+f[1]*150.45+f[2]*28.05+.5)}if(i===wS.LUMINANCE_ALPHA)for(let d=0;d<s;d++){const h=u[d*c+a];t.getColor(h,f),l[d*2]=Math.floor(f[0]*76.5+f[1]*150.45+f[2]*28.05+.5),l[d*2+1]=o}},t.applyColorMap=n=>{const r=JSON.stringify(e.colorSpace);n.ColorSpace&&(e.colorSpace=su[n.ColorSpace.toUpperCase()],e.colorSpace===void 0&&(d0(`ColorSpace ${n.ColorSpace} not supported, using RGB instead`),e.colorSpace=su.RGB));let i=r!==JSON.stringify(e.colorSpace);const a=i||JSON.stringify(e.nanColor);if(n.NanColor)for(e.nanColor=[].concat(n.NanColor);e.nanColor.length<4;)e.nanColor.push(1);i=i||a!==JSON.stringify(e.nanColor);const o=i||JSON.stringify(e.nodes);if(n.RGBPoints){const l=n.RGBPoints.length;e.nodes=[];const u=.5,f=0;for(let d=0;d<l;d+=4)e.nodes.push({x:n.RGBPoints[d],r:n.RGBPoints[d+1],g:n.RGBPoints[d+2],b:n.RGBPoints[d+3],midpoint:u,sharpness:f})}const s=t.sortAndUpdateRange(),c=!s&&(i||o!==JSON.stringify(e.nodes));return c&&t.modified(),s||c}}const h4t={clamping:!0,colorSpace:su.RGB,hSVWrap:!0,scale:BU.LINEAR,nanColor:null,belowRangeColor:null,aboveRangeColor:null,useAboveRangeColor:!1,useBelowRangeColor:!1,allowDuplicateScalars:!1,table:null,tableSize:0,buildTime:null,nodes:null,discretize:!1,numberOfValues:256};function xxe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,h4t,n),FU.extend(t,e,n),e.table=[],e.nodes=[],e.nanColor=[.5,0,0,1],e.belowRangeColor=[0,0,0,1],e.aboveRangeColor=[1,1,1,1],e.buildTime={},se.obj(e.buildTime),se.get(t,e,["buildTime","mappingRange"]),se.setGet(t,e,["useAboveRangeColor","useBelowRangeColor","discretize","numberOfValues",{type:"enum",name:"colorSpace",enum:su},{type:"enum",name:"scale",enum:BU}]),se.setArray(t,e,["nanColor","belowRangeColor","aboveRangeColor"],4),se.getArray(t,e,["nanColor","belowRangeColor","aboveRangeColor"]),d4t(t,e)}const g4t=se.newInstance(xxe,"vtkColorTransferFunction");var yh={newInstance:g4t,extend:xxe,...yxe},p4t=[{Name:"KAAMS",IndexedColors:[1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,1,0,1,0,1,1,.63,.63,1,.67,.5,.33,1,.5,.75,.53,.35,.7,1,.75,.5],Annotations:[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11]},{ColorSpace:"Diverging",Name:"Cool to Warm",NanColor:[1,1,0],RGBPoints:[0,.23137254902,.298039215686,.752941176471,.5,.865,.865,.865,1,.705882352941,.0156862745098,.149019607843]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Cool to Warm (Extended)",NanColor:[.25,0,0],RGBPoints:[0,0,0,.34902,.03125,.039216,.062745,.380392,.0625,.062745,.117647,.411765,.09375,.090196,.184314,.45098,.125,.12549,.262745,.501961,.15625,.160784,.337255,.541176,.1875,.2,.396078,.568627,.21875,.239216,.454902,.6,.25,.286275,.521569,.65098,.28125,.337255,.592157,.701961,.3125,.388235,.654902,.74902,.34375,.466667,.737255,.819608,.375,.572549,.819608,.878431,.40625,.654902,.866667,.909804,.4375,.752941,.917647,.941176,.46875,.823529,.956863,.968627,.5,.988235,.960784,.901961,.5,.941176,.984314,.988235,.52,.988235,.945098,.85098,.54,.980392,.898039,.784314,.5625,.968627,.835294,.698039,.59375,.94902,.733333,.588235,.625,.929412,.65098,.509804,.65625,.909804,.564706,.435294,.6875,.878431,.458824,.352941,.71875,.839216,.388235,.286275,.75,.760784,.294118,.211765,.78125,.701961,.211765,.168627,.8125,.65098,.156863,.129412,.84375,.6,.094118,.094118,.875,.54902,.066667,.098039,.90625,.501961,.05098,.12549,.9375,.45098,.054902,.172549,.96875,.4,.054902,.192157,1,.34902,.070588,.211765]},{ColorSpace:"Diverging",Name:"Warm to Cool",NanColor:[1,1,0],RGBPoints:[0,.705882352941,.0156862745098,.149019607843,.5,.865,.865,.865,1,.23137254902,.298039215686,.752941176471]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Warm to Cool (Extended)",NanColor:[.250004,0,0],RGBPoints:[0,.34902,0,.129412,.025,.4,.00392157,.101961,.05,.470588,.0156863,.0901961,.075,.54902,.027451,.0705882,.1,.619608,.0627451,.0431373,.125,.690196,.12549,.0627451,.15,.741176,.184314,.0745098,.175,.788235,.266667,.0941176,.2,.811765,.345098,.113725,.225,.831373,.411765,.133333,.25,.85098,.47451,.145098,.275,.870588,.54902,.156863,.3,.878431,.619608,.168627,.325,.890196,.658824,.196078,.35,.909804,.717647,.235294,.375,.929412,.776471,.278431,.395522,.94902,.823529,.321569,.418905,.968627,.87451,.407843,.444278,.980392,.917647,.509804,.470149,.988235,.956863,.643137,.483582,.992157,.964706,.713725,.499,.988235,.980392,.870588,.5,1,1,1,.501,.913725,.988235,.937255,.516418,.827451,.980392,.886275,.531343,.764706,.980392,.866667,.546766,.658824,.980392,.843137,.564179,.572549,.964706,.835294,.587562,.423529,.941176,.87451,.60597,.262745,.901961,.862745,.629851,.0705882,.854902,.870588,.651741,.0509804,.8,.85098,.681592,.0235294,.709804,.831373,.712935,.0313725,.615686,.811765,.75,.0313725,.537255,.788235,.775,.0392157,.466667,.768627,.8,.0509804,.396078,.741176,.825,.054902,.317647,.709804,.85,.054902,.243137,.678431,.875,.0431373,.164706,.639216,.9,.0313725,.0980392,.6,.925,.0392157,.0392157,.560784,.95,.105882,.0509804,.509804,.975,.113725,.0235294,.45098,1,.12549,0,.380392]},{ColorSpace:"RGB",Name:"Rainbow Desaturated",NanColor:[1,1,0],RGBPoints:[0,.278431372549,.278431372549,.858823529412,.143,0,0,.360784313725,.285,0,1,1,.429,0,.501960784314,0,.571,1,1,0,.714,1,.380392156863,0,.857,.419607843137,0,0,1,.878431372549,.301960784314,.301960784314]},{ColorSpace:"RGB",Name:"Cold and Hot",NanColor:[1,1,0],RGBPoints:[0,0,1,1,.45,0,0,1,.5,0,0,.501960784314,.55,1,0,0,1,1,1,0]},{ColorSpace:"RGB",Name:"Black-Body Radiation",NanColor:[0,.498039215686,1],RGBPoints:[0,0,0,0,.4,.901960784314,0,0,.8,.901960784314,.901960784314,0,1,1,1,1]},{ColorSpace:"RGB",Name:"X Ray",NanColor:[1,0,0],RGBPoints:[0,1,1,1,1,0,0,0]},{ColorSpace:"RGB",Name:"Grayscale",NanColor:[1,0,0],RGBPoints:[0,0,0,0,1,1,1,1]},{ColorSpace:"RGB",Name:"BkRd",NanColor:[0,1,1],RGBPoints:[0,0,0,0,1,1,0,0]},{ColorSpace:"RGB",Name:"BkGn",NanColor:[1,0,1],RGBPoints:[0,0,0,0,1,0,1,0]},{ColorSpace:"RGB",Name:"BkBu",NanColor:[1,1,0],RGBPoints:[0,0,0,0,1,0,0,1]},{ColorSpace:"RGB",Name:"BkMa",NanColor:[0,1,0],RGBPoints:[0,0,0,0,1,1,0,1]},{ColorSpace:"RGB",Name:"BkCy",NanColor:[0,1,1],RGBPoints:[0,0,0,0,1,0,1,1]},{ColorSpace:"RGB",Name:"Black, Blue and White",NanColor:[1,1,0],RGBPoints:[0,0,0,0,.333,0,0,.501960784314,.666,0,.501960784314,1,1,1,1,1]},{ColorSpace:"RGB",Name:"Black, Orange and White",NanColor:[1,1,0],RGBPoints:[0,0,0,0,.333,.501960784314,0,0,.666,1,.501960784314,0,1,1,1,1]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Linear YGB 1211g",NanColor:[.25,0,0],RGBPoints:[0,1,.988235,.968627,.02,1,.952941,.878431,.05,.968627,.905882,.776471,.1,.94902,.898039,.647059,.15,.901961,.878431,.556863,.2,.847059,.858824,.482353,.25,.690196,.819608,.435294,.3,.513725,.768627,.384314,.35,.337255,.721569,.337255,.4,.278431,.658824,.392157,.45,.231373,.639216,.435294,.5,.203922,.6,.486275,.55,.172549,.568627,.537255,.6,.141176,.517647,.54902,.65,.133333,.458824,.541176,.7,.12549,.396078,.529412,.75,.117647,.321569,.521569,.8,.121569,.258824,.509804,.85,.133333,.227451,.501961,.9,.145098,.192157,.490196,.95,.188235,.164706,.470588,1,.258824,.196078,.439216]},{ColorSpace:"CIELAB",Creator:"Francesca Samsel",Name:"Linear Green (Gr4L)",NanColor:[.25,0,0],RGBPoints:[0,.054902,.109804,.121569,.05,.07451,.172549,.180392,.1,.086275,.231373,.219608,.15,.094118,.278431,.25098,.2,.109804,.34902,.278431,.25,.113725,.4,.278431,.3,.117647,.45098,.270588,.35,.117647,.490196,.243137,.4,.113725,.521569,.203922,.45,.109804,.54902,.152941,.5,.082353,.588235,.082353,.55,.109804,.631373,.05098,.6,.211765,.678431,.082353,.65,.317647,.721569,.113725,.7,.431373,.760784,.160784,.75,.556863,.8,.239216,.8,.666667,.839216,.294118,.85,.784314,.878431,.396078,.9,.886275,.921569,.533333,.95,.960784,.94902,.670588,1,1,.984314,.901961]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Linear Blue (8_31f)",NanColor:[.25,0,0],RGBPoints:[0,.960784,1,.980392,.05,.815686,.960784,.913725,.1,.670588,.929412,.870588,.15,.556863,.901961,.843137,.2,.478431,.870588,.823529,.25,.439216,.831373,.803922,.3,.4,.8,.788235,.35,.376471,.768627,.768627,.4,.34902,.709804,.729412,.45,.32549,.654902,.690196,.5,.301961,.607843,.658824,.55,.247059,.545098,.619608,.6,.239216,.494118,.580392,.65,.227451,.439216,.541176,.7,.227451,.403922,.521569,.75,.231373,.368627,.501961,.8,.227451,.321569,.470588,.85,.219608,.282353,.439216,.9,.192157,.235294,.4,.95,.160784,.184314,.34902,1,.133333,.12549,.301961]},{ColorSpace:"HSV",Name:"Blue to Red Rainbow",NanColor:[.498039215686,.498039215686,.498039215686],RGBPoints:[0,0,0,1,1,1,0,0]},{ColorSpace:"HSV",Name:"Red to Blue Rainbow",NanColor:[.498039215686,.498039215686,.498039215686],RGBPoints:[0,1,0,0,1,0,0,1]},{ColorSpace:"RGB",Name:"Rainbow Blended White",NanColor:[1,1,0],RGBPoints:[0,1,1,1,.17,0,0,1,.34,0,1,1,.5,0,1,0,.67,1,1,0,.84,1,0,0,1,.878431372549,0,1]},{ColorSpace:"RGB",Name:"Rainbow Blended Grey",NanColor:[1,1,0],RGBPoints:[0,.317647058824,.341176470588,.43137254902,.17,0,0,1,.34,0,1,1,.5,0,1,0,.67,1,1,0,.84,1,0,0,1,.878431372549,0,1]},{ColorSpace:"RGB",Name:"Rainbow Blended Black",NanColor:[1,1,0],RGBPoints:[0,0,0,0,.17,0,0,1,.34,0,1,1,.5,0,1,0,.67,1,1,0,.84,1,0,0,1,.878431372549,0,1]},{ColorSpace:"RGB",Name:"Blue to Yellow",NanColor:[1,0,0],RGBPoints:[0,.0392156862745,.0392156862745,.949019607843,1,.949019607843,.949019607843,.0392156862745]},{ColorSpace:"HSV",Name:"blot",RGBPoints:[0,0,0,1,.166,0,0,1,.167,1,0,1,.332,1,0,1,.333,0,1,1,.5,0,1,1,.501,0,1,0,.666,0,1,0,.667,1,1,0,.832,1,1,0,.833,1,0,0,1,1,0,0]},{ColorSpace:"Lab",Name:"CIELab Blue to Red",NanColor:[1,1,0],RGBPoints:[0,0,.6,.749019607843,1,.76862745098,.466666666667,.341176470588]},{ColorSpace:"RGB",Name:"jet",RGBPoints:[-1,0,0,.5625,-.777778,0,0,1,-.269841,0,1,1,-.015873,.5,1,.5,.238095,1,1,0,.746032,1,0,0,1,.5,0,0]},{ColorSpace:"RGB",Name:"rainbow",RGBPoints:[-1,0,0,1,-.5,0,1,1,0,0,1,0,.5,1,1,0,1,1,0,0]},{ColorSpace:"Lab",Name:"erdc_rainbow_bright",RGBPoints:[-1,.32549,.14902,.960784,-.866221,.297047,.375586,.963836,-.732441,.180302,.536818,.964627,-.598662,.1302,.649207,.929647,-.464883,.0445143,.749654,.855998,-.331104,.0271325,.830713,.721527,-.197324,.259504,.866145,.543555,-.0635452,.428364,.890725,.329819,.0702341,.568503,.898508,.187623,.204013,.738259,.890317,.0825461,.337793,.84546,.86136,.0147555,.471572,.912191,.808018,0,.605351,.962848,.710445,0,.73913,.999469,.600258,.0176284,.87291,.994156,.445975,.193912,1,.980407,.247105,.262699]},{ColorSpace:"Lab",Name:"erdc_rainbow_dark",RGBPoints:[-1,0,0,.423499,-.866221,0,.119346,.529237,-.732441,0,.238691,.634976,-.598662,0,.346852,.68788,-.464883,0,.45022,.718141,-.331104,0,.553554,.664839,-.197324,0,.651082,.519303,-.0635452,.115841,.72479,.352857,.0702341,.326771,.781195,.140187,.204013,.522765,.798524,.0284624,.337793,.703162,.788685,.00885756,.471572,.845118,.751133,0,.605351,.955734,.690825,0,.73913,.995402,.567916,.0618524,.87291,.987712,.403398,.164851,1,.980407,.247105,.262699]},{ColorSpace:"Lab",Name:"nic_CubicL",RGBPoints:[-1,.479965,.0118108,.5307,-.87451,.522213,.0551282,.706919,-.74902,.50839,.237278,.867764,-.623529,.451617,.373834,.987255,-.498039,.39365,.497255,.97506,-.372549,.328631,.599639,.891843,-.247059,.250043,.690286,.778553,-.121569,.249656,.764905,.645857,.00392157,.297954,.821466,.50449,.129412,.337509,.872595,.358447,.254902,.430011,.913789,.297079,.380392,.587191,.931381,.333353,.505882,.727937,.93591,.353742,.631373,.826403,.921081,.365066,.756863,.893201,.846317,.372662,.882353,.965347,.73884,.378506,1,.983235,.597451,.366856]},{ColorSpace:"Lab",Name:"nic_CubicYF",RGBPoints:[-1,.5151,.0482,.6697,-.87451,.520711,.168955,.800574,-.74902,.493694,.278596,.911824,-.623529,.440026,.369475,.984978,-.498039,.398932,.457593,.987053,-.372549,.350651,.540644,.929608,-.247059,.298827,.615625,.857729,-.121569,.239928,.685061,.769531,.00392157,.228832,.739349,.673287,.129412,.263297,.78608,.569988,.254902,.298107,.828337,.460214,.380392,.33092,.864071,.352674,.505882,.38306,.898169,.287309,.631373,.49023,.917481,.307961,.756863,.62372,.926026,.332309,.882353,.717458,.92527,.342476,1,.8,.9255,.3529]},{ColorSpace:"Lab",Name:"gist_earth",RGBPoints:[-1,0,0,0,-.87451,.239216,.027451,.415686,-.74902,.0901961,.254902,.556863,-.623529,.0941176,.352941,.54902,-.498039,.105882,.435294,.533333,-.372549,.12549,.52549,.501961,-.247059,.156863,.596078,.443137,-.121569,.196078,.65098,.380392,.00392157,.282353,.717647,.301961,.129412,.466667,.772549,.27451,.254902,.678431,.784314,.309804,.380392,.901961,.756863,.376471,.505882,.992157,.705882,.521569,.631373,1,.721569,.701961,.756863,1,.784314,.784314,.882353,1,.866667,.866667,1,1,1,1]},{ColorSpace:"Lab",Name:"2hot",RGBPoints:[-1,.0416667,0,0,-.873016,.208333,0,0,-.746032,.375,0,0,-.619048,.541667,0,0,-.492063,.708333,0,0,-.365079,.854137,0,0,-.238095,.937488,.039062,0,-.111111,1,.208333,0,.015873,1,.375,0,.142857,1,.541667,0,.269841,1,.708333,0,.396825,1,.858805,.03125,.52381,1,.947392,.15625,.650794,1,1,.3125,.777778,1,1,.5625,.904762,1,1,.8125,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_red2yellow_BW",RGBPoints:[-1,754296e-12,0,109827e-10,-.87451,.18285,.0264094,0,-.74902,.3066,0,0,-.623529,.422841,0,0,-.498039,.522945,0,0,-.372549,.605721,0,0,-.247059,.672502,.14168,0,-.121569,.728167,.244025,0,.00392157,.781215,.333454,0,.129412,.825,.423586,0,.254902,.855893,.516793,0,.380392,.880491,.608846,0,.505882,.910305,.695505,0,.631373,.94109,.779067,.223528,.756863,.967873,.858572,.473521,.882353,.986815,.933211,.751583,1,1,1,.999997]},{ColorSpace:"Lab",Name:"erdc_marine2gold_BW",RGBPoints:[-1,111641e-12,0,162551e-11,-.87451,.0413146,.0619808,.209857,-.74902,.0185557,.101341,.350684,-.623529,.00486405,.149847,.461054,-.498039,.0836345,.210845,.517906,-.372549,.173222,.276134,.541793,-.247059,.259857,.343877,.535869,-.121569,.362299,.408124,.504293,.00392157,.468266,.468276,.468257,.129412,.582781,.527545,.374914,.254902,.691591,.585251,.274266,.380392,.784454,.645091,.247332,.505882,.862299,.710383,.27518,.631373,.920863,.782923,.351563,.756863,.955792,.859699,.533541,.882353,.976162,.93433,.780671,1,1,1,.999983]},{ColorSpace:"Lab",Name:"erdc_blue2gold_BW",RGBPoints:[-1,0,0,0,-.87451,.0742735,.0440331,.230013,-.74902,.125276,.0258685,.415826,-.623529,.143879,.0163031,.591346,-.498039,.212261,.0627855,.705239,-.372549,.306048,.141178,.763636,-.247059,.391537,.232286,.773263,-.121569,.461734,.336633,.708321,.00392157,.54209,.427581,.590007,.129412,.61704,.508623,.460978,.254902,.702703,.579586,.309117,.380392,.790336,.644811,.170397,.505882,.870173,.710733,.117134,.631373,.93656,.781991,.157144,.756863,.965672,.862068,.409836,.882353,.985751,.936296,.714162,1,1,1,.999999]},{ColorSpace:"Lab",Name:"erdc_sapphire2gold_BW",RGBPoints:[-1,.107704,.107708,.107694,-.87451,.1851,.112354,.308554,-.74902,.236782,.114233,.48788,-.623529,.28296,.126187,.639464,-.498039,.344787,.171643,.739713,-.372549,.413325,.242371,.76913,-.247059,.481863,.3131,.719841,-.121569,.550402,.383829,.612222,.00392157,.61894,.454558,.51126,.129412,.687478,.525287,.39993,.254902,.756017,.596016,.289923,.380392,.824555,.666745,.255498,.505882,.892979,.736822,.27696,.631373,.938851,.804966,.351734,.756863,.966491,.874853,.53572,.882353,.982105,.94153,.782579,1,1,1,.999986]},{ColorSpace:"Lab",Name:"erdc_red2purple_BW",RGBPoints:[-1,0,0,0,-.87451,.167793,.0166271,.0431278,-.74902,.262608,.0107595,.0791181,-.623529,.351902,.0101858,.100926,-.498039,.441257,.0160835,.131919,-.372549,.5221,.0555972,.195625,-.247059,.593852,.104294,.310234,-.121569,.654628,.158115,.448486,.00392157,.707443,.220914,.570253,.129412,.749504,.293268,.67897,.254902,.781587,.370517,.779269,.380392,.809951,.451099,.855831,.505882,.84424,.531462,.900451,.631373,.865174,.620901,.91606,.756863,.875041,.714054,.910284,.882353,.880764,.80554,.896276,1,.887572,.887591,.887556]},{ColorSpace:"Lab",Name:"erdc_purple2pink_BW",RGBPoints:[-1,0,0,0,-.87451,.117562,.0291202,.175876,-.74902,.178368,.0458476,.285454,-.623529,.237731,.0680173,.387717,-.498039,.300877,.0956291,.484802,-.372549,.370929,.136858,.554985,-.247059,.449033,.189273,.58863,-.121569,.529971,.245796,.598587,.00392157,.609914,.300643,.610244,.129412,.697079,.351286,.616371,.254902,.785858,.401991,.617376,.380392,.862517,.45745,.64463,.505882,.91359,.525462,.705336,.631373,.932583,.61064,.767412,.756863,.922478,.706966,.817522,.882353,.901302,.803071,.856311,1,.887571,.887591,.887549]},{ColorSpace:"Lab",Name:"erdc_pbj_lin",RGBPoints:[-1,0,0,0,-.87451,.091821,.0611476,.10617,-.74902,.160311,.0900022,.192713,-.623529,.22484,.12126,.272128,-.498039,.291263,.157469,.340828,-.372549,.360015,.200388,.388903,-.247059,.437497,.250058,.387201,-.121569,.512636,.304969,.355955,.00392157,.582603,.360874,.33488,.129412,.655126,.416374,.306351,.254902,.725889,.473329,.279051,.380392,.778125,.537928,.302697,.505882,.815894,.606931,.382431,.631373,.839159,.679308,.497608,.756863,.854748,.751666,.631792,.882353,.869483,.822508,.768592,1,.887572,.887589,.887565]},{ColorSpace:"Lab",Name:"erdc_blue2green_muted",RGBPoints:[-1,.107704,.107708,.107695,-.87451,.141522,.13066,.270741,-.74902,.180123,.146119,.42308,-.623529,.210161,.169674,.551795,-.498039,.239701,.212939,.634969,-.372549,.253916,.282947,.653641,-.247059,.242791,.366933,.608521,-.121569,.226302,.446776,.52693,.00392157,.236237,.514689,.458798,.129412,.274641,.577589,.376069,.254902,.349625,.633993,.288131,.380392,.4437,.683677,.260497,.505882,.536247,.731214,.285424,.631373,.628472,.777128,.349151,.756863,.718259,.819287,.496825,.882353,.804768,.856164,.703299,1,.887571,.887591,.887548]},{ColorSpace:"Lab",Name:"erdc_blue2green_BW",RGBPoints:[-1,363578e-12,0,529374e-11,-.87451,.0539915,.0577948,.212806,-.74902,.0620393,.0758942,.388959,-.623529,.0697499,.102032,.54177,-.498039,.113295,.156156,.64334,-.372549,.152047,.243196,.670283,-.247059,.158096,.344084,.622864,-.121569,.151142,.43922,.532767,.00392157,.17155,.521588,.457719,.129412,.225861,.599141,.363997,.254902,.32328,.67007,.259083,.380392,.442344,.733697,.223754,.505882,.558409,.794941,.257411,.631373,.673875,.854344,.340822,.756863,.787244,.909326,.524717,.882353,.896483,.958063,.775914,1,1,1,.999982]},{ColorSpace:"Lab",Name:"GREEN-WHITE_LINEAR",RGBPoints:[-1,0,0,0,-.87451,0,.062745,0,-.74902,0,.12549,0,-.623529,0,.188235,0,-.498039,0,.25098,0,-.372549,0,.313725,0,-.247059,0,.376471,0,-.121569,.094118,.439216,0,.00392157,.196078,.501961,0,.129412,.294118,.564706,0,.254902,.396078,.627451,0,.380392,.498039,.690196,0,.505882,.6,.752941,.145098,.631373,.701961,.815686,.364706,.756863,.8,.878431,.580392,.882353,.901961,.941176,.796078,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_green2yellow_BW",RGBPoints:[-1,0,0,0,-.87451,0,.105542,.0603919,-.74902,0,.159454,.104148,-.623529,0,.219502,.15542,-.498039,0,.282276,.203811,-.372549,0,.346331,.235652,-.247059,0,.411765,.235428,-.121569,0,.477177,.217977,.00392157,.0593644,.541635,.21361,.129412,.233081,.604722,.210591,.254902,.369803,.664942,.226536,.380392,.498446,.722367,.288237,.505882,.601929,.782244,.380815,.631373,.703207,.840497,.512134,.756863,.803186,.896433,.674462,.882353,.903834,.950266,.846715,1,1,1,.999981]},{ColorSpace:"Lab",Name:"blue2cyan",RGBPoints:[-1,0,0,0,-.87451,0,.152941,.364706,-.74902,0,.254902,.470588,-.623529,0,.34902,.572549,-.498039,0,.443137,.670588,-.372549,0,.537255,.772549,-.247059,0,.627451,.870588,-.121569,0,.717647,.964706,.00392157,.0784314,.772549,1,.129412,.207843,.858824,1,.254902,.32549,.941176,1,.380392,.45098,1,1,.505882,.560784,1,1,.631373,.662745,1,1,.756863,.760784,1,1,.882353,.870588,1,1,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_blue2cyan_BW",RGBPoints:[-1,405298e-12,0,59012e-10,-.87451,.0207526,.0740933,.18093,-.74902,0,.121033,.30343,-.623529,0,.166892,.416095,-.498039,0,.216768,.524796,-.372549,.0164769,.275471,.608585,-.247059,.0544527,.344824,.659267,-.121569,.0880643,.419118,.688675,.00392157,.127938,.492556,.720256,.129412,.149476,.566946,.756918,.254902,.188961,.641333,.792122,.380392,.245482,.715336,.827609,.505882,.329216,.786235,.874761,.631373,.453558,.852803,.918466,.756863,.626281,.910493,.954,.882353,.82257,.958709,.980146,1,1,1,.999989]},{ColorSpace:"Lab",Name:"erdc_blue_BW",RGBPoints:[-1,0,0,0,-.87451,.0425591,.0763529,.150682,-.74902,.0569472,.119154,.275403,-.623529,.0635978,.164772,.395427,-.498039,.0774342,.213851,.510014,-.372549,.106815,.267034,.615102,-.247059,.122093,.324649,.720068,-.121569,.160851,.387068,.806956,.00392157,.213754,.453516,.878012,.129412,.26722,.524656,.932436,.254902,.326844,.599279,.968038,.380392,.403403,.674712,.984784,.505882,.499703,.745519,1,.631373,.615055,.813983,1,.756863,.74405,.879228,1,.882353,.877909,.941913,1,1,1,1,.999996]},{ColorSpace:"Lab",Name:"BLUE-WHITE",RGBPoints:[-1,0,0,0,-.87451,0,0,.082353,-.74902,0,0,.168627,-.623529,0,0,.254902,-.498039,0,0,.337255,-.372549,0,0,.423529,-.247059,0,0,.509804,-.121569,0,.101961,.592157,.00392157,0,.203922,.678431,.129412,0,.301961,.764706,.254902,0,.403922,.85098,.380392,0,.505882,.933333,.505882,0,.603922,1,.631373,.254902,.705882,1,.756863,.509804,.807843,1,.882353,.764706,.905882,1,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_purple_BW",RGBPoints:[-1,4264e-11,0,620844e-12,-.87451,.100579,.0593111,.145666,-.74902,.167794,.0889224,.254953,-.623529,.231446,.123339,.360511,-.498039,.296699,.163027,.461278,-.372549,.363211,.209286,.55306,-.247059,.431136,.260776,.637195,-.121569,.498202,.320012,.705799,.00392157,.567456,.380459,.778091,.129412,.629381,.445284,.8448,.254902,.688373,.517374,.895694,.380392,.74891,.590906,.93976,.505882,.805017,.667956,.977626,.631373,.850914,.752618,.992396,.756863,.89724,.838454,.994093,.882353,.948461,.922603,.994449,1,1,1,.999967]},{ColorSpace:"Lab",Name:"erdc_magenta_BW",RGBPoints:[-1,0,0,254023e-10,-.87451,.128696,.0456782,.11635,-.74902,.228133,.0476299,.201452,-.623529,.327273,.0374065,.282107,-.498039,.420953,.0408166,.35709,-.372549,.511562,.0642203,.430511,-.247059,.599552,.102686,.504257,-.121569,.684646,.150536,.579429,.00392157,.765817,.205978,.656062,.129412,.839176,.27229,.731807,.254902,.89536,.357594,.797309,.380392,.930238,.457825,.846984,.505882,.945921,.564536,.880571,.631373,.948995,.670753,.902279,.756863,.947124,.772819,.918171,.882353,.947265,.869424,.934352,1,.954719,.95475,.954726]},{ColorSpace:"Lab",Name:"magenta",RGBPoints:[-1,0,0,0,-.87451,.364706,0,.152941,-.74902,.470588,0,.254902,-.623529,.572549,0,.34902,-.498039,.670588,0,.443137,-.372549,.772549,0,.537255,-.247059,.870588,0,.627451,-.121569,.964706,0,.717647,.00392157,1,.0784314,.772549,.129412,1,.207843,.858824,.254902,1,.32549,.941176,.380392,1,.45098,1,.505882,1,.560784,1,.631373,1,.662745,1,.756863,1,.760784,1,.882353,1,.870588,1,1,1,1,1]},{ColorSpace:"Lab",Name:"RED-PURPLE",RGBPoints:[-1,0,0,0,-.87451,.188235,0,.007843,-.74902,.345098,0,.035294,-.623529,.439216,0,.098039,-.498039,.533333,0,.152941,-.372549,.627451,.015686,.211765,-.247059,.721569,.031373,.266667,-.121569,.8,.047059,.329412,.00392157,.862745,.047059,.403922,.129412,.941176,.062745,.466667,.254902,.988235,.078431,.54902,.380392,.988235,.141176,.643137,.505882,.988235,.25098,.729412,.631373,.988235,.376471,.811765,.756863,.988235,.54902,.886275,.882353,.988235,.752941,.952941,1,.996078,.996078,.996078]},{ColorSpace:"Lab",Name:"erdc_red_BW",RGBPoints:[-1,0,0,0,-.87451,.147204,.0480135,.0401815,-.74902,.253411,.0617478,.0301333,-.623529,.356059,.0746331,.0446897,-.498039,.457731,.0934935,.0636931,-.372549,.557199,.122714,.0860013,-.247059,.665179,.144238,.105585,-.121569,.763833,.187056,.138326,.00392157,.847035,.254558,.189407,.129412,.905663,.345937,.258215,.254902,.941431,.447111,.346277,.380392,.962608,.546927,.457571,.505882,.987833,.637276,.569944,.631373,.994202,.732176,.687958,.756863,.993304,.826268,.800567,.882353,.994413,.917205,.906393,1,1,1,.999979]},{ColorSpace:"Lab",Name:"RED_TEMPERATURE",RGBPoints:[-1,0,0,0,-.87451,.090196,0,0,-.74902,.180392,0,0,-.623529,.270588,0,0,-.498039,.360784,0,0,-.372549,.45098,0,0,-.247059,.545098,0,0,-.121569,.635294,0,0,.00392157,.72549,.058824,0,.129412,.815686,.176471,0,.254902,.905882,.294118,0,.380392,1,.411765,0,.505882,1,.533333,.027451,.631373,1,.65098,.27451,.756863,1,.768627,.521569,.882353,1,.886275,.768627,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_orange_BW",RGBPoints:[-1,0,0,253806e-10,-.87451,.135871,.0593824,0,-.74902,.224328,.0907216,0,-.623529,.318083,.119647,0,-.498039,.414443,.150246,0,-.372549,.511077,.184884,0,-.247059,.605501,.226033,0,-.121569,.695274,.275491,0,.00392157,.777826,.334445,0,.129412,.851498,.402441,0,.254902,.915899,.47759,602975e-9,.380392,.971984,.557882,.0361443,.505882,1,.641287,.135967,.631373,1,.725198,.27997,.756863,1,.808205,.438135,.882353,1,.89306,.587036,1,1,.977928,.721599]},{ColorSpace:"Lab",Name:"heated_object",RGBPoints:[-1,0,0,0,-.87451,.34902,.0862745,0,-.74902,.45098,.172549,0,-.623529,.52549,.231373,0,-.498039,.580392,.278431,0,-.372549,.623529,.313725,0,-.247059,.670588,.352941,0,-.121569,.717647,.392157,0,.00392157,.772549,.439216,0,.129412,.839216,.494118,0,.254902,.901961,.541176,0,.380392,.968627,.6,0,.505882,1,.658824,0,.631373,1,.721569,0,.756863,1,.827451,.298039,.882353,1,.976471,.72549,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_gold_BW",RGBPoints:[-1,0,0,190933e-10,-.87451,.128363,.0636265,0,-.74902,.193795,.111057,0,-.623529,.25976,.15987,0,-.498039,.328546,.210589,0,-.372549,.399726,.26332,0,-.247059,.472969,.318261,0,-.121569,.546245,.375827,0,.00392157,.61745,.436719,0,.129412,.685545,.501113,0,.254902,.749578,.568799,0,.380392,.80962,.6394,0,.505882,.865572,.712699,.10257,.631373,.917709,.787569,.233665,.756863,.966914,.863138,.369608,.882353,1,.939405,.496104,1,.999225,1,.612275]},{ColorSpace:"Lab",Name:"erdc_brown_BW",RGBPoints:[-1,33216e-11,0,483629e-11,-.87451,.14693,.0518172,0,-.74902,.225806,.0814996,0,-.623529,.301681,.111452,0,-.498039,.370487,.150664,0,-.372549,.43108,.199477,0,-.247059,.4849,.255107,0,-.121569,.536798,.313486,0,.00392157,.59286,.371167,0,.129412,.653119,.428135,0,.254902,.714589,.485917,.0379541,.380392,.774667,.54565,.116634,.505882,.831222,.608047,.183895,.631373,.880305,.674199,.260298,.756863,.922314,.742472,.367086,.882353,.959408,.811222,.497258,1,.993548,.875183,.622093]},{ColorSpace:"Lab",Name:"copper_Matlab",RGBPoints:[-1,0,0,0,-.87451,.0784314,.0501961,.0313725,-.74902,.156863,.100392,.0627451,-.623529,.235294,.150588,.0941176,-.498039,.313725,.200784,.12549,-.372549,.392157,.25098,.156863,-.247059,.470588,.301176,.188235,-.121569,.54902,.351373,.219608,.00392157,.627451,.401569,.25098,.129412,.705882,.451765,.282353,.254902,.784314,.501961,.313725,.380392,.862745,.552157,.345098,.505882,.941176,.602353,.376471,.631373,1,.652549,.407843,.756863,1,.702745,.439216,.882353,1,.752941,.470588,1,1,.8,.5]},{ColorSpace:"Lab",Name:"pink_Matlab",RGBPoints:[-1,0,0,0,-.87451,.312416,.204524,.204524,-.74902,.441822,.289241,.289241,-.623529,.54112,.354246,.354246,-.498039,.624831,.409048,.409048,-.372549,.698582,.45733,.45733,-.247059,.764404,.502282,.500979,-.121569,.791292,.591516,.54112,.00392157,.817297,.66895,.578481,.129412,.842499,.738308,.613572,.254902,.866968,.801687,.646762,.380392,.890766,.86041,.678329,.505882,.913944,.913944,.711254,.631373,.936549,.936549,.79459,.756863,.958621,.958621,.869979,.882353,.980196,.980196,.939336,1,1,1,1]},{ColorSpace:"Lab",Name:"bone_Matlab",RGBPoints:[-1,0,0,0,-.87451,.054902,.054902,.075817,-.74902,.109804,.109804,.151634,-.623529,.164706,.164706,.227451,-.498039,.219608,.219608,.303268,-.372549,.27451,.27451,.379085,-.247059,.329412,.329902,.454412,-.121569,.384314,.405719,.509314,.00392157,.439216,.481536,.564216,.129412,.494118,.557353,.619118,.254902,.54902,.63317,.67402,.380392,.603922,.708987,.728922,.505882,.660294,.783824,.783824,.631373,.746569,.838725,.838725,.756863,.832843,.893627,.893627,.882353,.919118,.948529,.948529,1,1,1,1]},{ColorSpace:"Lab",Name:"gray_Matlab",RGBPoints:[-1,0,0,0,-.87451,.0627451,.0627451,.0627451,-.74902,.12549,.12549,.12549,-.623529,.188235,.188235,.188235,-.498039,.25098,.25098,.25098,-.372549,.313725,.313725,.313725,-.247059,.376471,.376471,.376471,-.121569,.439216,.439216,.439216,.00392157,.501961,.501961,.501961,.129412,.564706,.564706,.564706,.254902,.627451,.627451,.627451,.380392,.690196,.690196,.690196,.505882,.752941,.752941,.752941,.631373,.815686,.815686,.815686,.756863,.878431,.878431,.878431,.882353,.941176,.941176,.941176,1,1,1,1]},{ColorSpace:"Lab",Name:"Purples",RGBPoints:[-1,.247059,0,.490196,-.87451,.288397,.07677,.525629,-.74902,.32975,.153587,.561092,-.623529,.373057,.236263,.600461,-.498039,.416363,.319,.639923,-.372549,.459669,.405613,.685198,-.247059,.503345,.491534,.730058,-.121569,.562399,.54862,.757616,.00392157,.621453,.606075,.785544,.129412,.680508,.674971,.824914,.254902,.739562,.743406,.863899,.380392,.798616,.800492,.893426,.505882,.85684,.856655,.922491,.631373,.898178,.894056,.942176,.756863,.938654,.930919,.961646,.882353,.964245,.958478,.977393,1,.988235,.984314,.992157]},{ColorSpace:"Lab",Name:"Blues",RGBPoints:[-1,.031373,.188235,.419608,-.87451,.031373,.253195,.516063,-.74902,.031757,.318139,.612149,-.623529,.080969,.38113,.661361,-.498039,.130427,.444152,.710327,-.372549,.195386,.509112,.743791,-.247059,.260715,.573841,.777209,-.121569,.341423,.628958,.808704,.00392157,.422745,.684075,.839892,.129412,.523137,.739193,.861546,.254902,.622684,.793464,.883429,.380392,.701423,.826928,.910988,.505882,.778685,.8603,.937993,.631373,.825928,.891795,.953741,.756863,.87328,.923291,.969489,.882353,.922491,.954787,.985236,1,.968627,.984314,1]},{ColorSpace:"Lab",Name:"Greens",RGBPoints:[-1,0,.266667,.105882,-.87451,0,.347374,.139346,-.74902,538e-6,.427912,.172933,-.623529,.069435,.486967,.222145,-.498039,.138178,.546082,.271326,-.372549,.197232,.609073,.31857,-.247059,.257255,.671742,.365859,-.121569,.357647,.720953,.415071,.00392157,.45767,.769919,.465021,.129412,.546251,.811257,.537855,.254902,.634295,.852211,.610688,.380392,.709097,.883706,.683522,.505882,.78316,.914833,.755894,.631373,.842215,.938454,.818885,.756863,.899977,.961538,.880692,.882353,.935409,.975317,.92203,1,.968627,.988235,.960784]},{ColorSpace:"Lab",Name:"PuBu",RGBPoints:[-1,.301961,0,.294118,-.87451,.404321,.029527,.390573,-.74902,.50599,.059592,.486782,-.623529,.519769,.158016,.551742,-.498039,.533456,.256194,.616301,-.372549,.54133,.33887,.655671,-.247059,.54902,.421592,.695087,-.121569,.54902,.506236,.736424,.00392157,.550127,.590573,.777701,.129412,.585559,.665375,.81707,.254902,.622145,.739023,.855825,.380392,.687105,.784298,.879446,.505882,.752065,.829758,.903253,.631373,.817024,.87897,.930811,.756863,.880907,.927213,.957832,.882353,.926182,.958708,.975548,1,.968627,.988235,.992157]},{ColorSpace:"Lab",Name:"BuPu",RGBPoints:[-1,.007843,.219608,.345098,-.87451,.01178,.286536,.449427,-.74902,.015702,.35328,.553479,-.623529,.01767,.396586,.622376,-.498039,.021115,.4402,.690688,-.372549,.11757,.503191,.722184,-.247059,.214625,.565859,.753633,-.121569,.336671,.615071,.78316,.00392157,.457978,.663975,.812503,.129412,.556401,.703345,.836125,.254902,.65421,.742714,.859669,.380392,.736886,.782084,.881323,.505882,.81827,.821638,.903068,.631373,.873387,.864944,.92669,.756863,.927536,.907605,.949988,.882353,.964937,.9391,.967705,1,1,.968627,.984314]},{ColorSpace:"Lab",Name:"BuGn",RGBPoints:[-1,.031373,.25098,.505882,-.87451,.031373,.329719,.590527,-.74902,.031911,.408397,.674787,-.623529,.100807,.479262,.710219,-.498039,.169704,.550219,.745744,-.372549,.238601,.62699,.787082,-.247059,.307958,.703114,.826759,-.121569,.39654,.752326,.797232,.00392157,.485121,.801046,.767705,.129412,.573702,.83451,.738178,.254902,.661592,.867743,.711034,.380392,.732457,.895302,.74253,.505882,.801845,.922307,.774579,.631373,.841215,.938055,.817885,.756863,.880907,.95391,.861084,.882353,.926182,.971626,.902422,1,.968627,.988235,.941176]},{ColorSpace:"Lab",Name:"GnBu",RGBPoints:[-1,0,.266667,.105882,-.87451,0,.347374,.139346,-.74902,538e-6,.427912,.172933,-.623529,.069435,.486967,.222145,-.498039,.138178,.546175,.272095,-.372549,.197232,.615071,.368551,-.247059,.256609,.683276,.464867,-.121569,.329443,.722645,.555417,.00392157,.403137,.762138,.645413,.129412,.503529,.805444,.718247,.254902,.603922,.848597,.790465,.380392,.704314,.887966,.847551,.505882,.802307,.926321,.903714,.631373,.851519,.944037,.941115,.756863,.899977,.961538,.976901,.882353,.935409,.975317,.984775,1,.968627,.988235,.992157]},{ColorSpace:"Lab",Name:"GnBuPu",RGBPoints:[-1,.003922,.27451,.211765,-.87451,.003922,.349312,.280661,-.74902,.003937,.423852,.349773,-.623529,.005905,.46519,.446228,-.498039,.009443,.506344,.542837,-.372549,.111803,.535871,.649135,-.247059,.214025,.565859,.753633,-.121569,.310481,.615071,.78316,.00392157,.407797,.663975,.812503,.129412,.531811,.703345,.836125,.254902,.65421,.742714,.859669,.380392,.736886,.782084,.881323,.505882,.81827,.821176,.902884,.631373,.873387,.854641,.922568,.756863,.927536,.888535,.942361,.882353,.964937,.929873,.964014,1,1,.968627,.984314]},{ColorSpace:"Lab",Name:"BuGnYl",RGBPoints:[-1,.031373,.113725,.345098,-.87451,.088458,.159,.463206,-.74902,.145052,.204567,.5807,-.623529,.139146,.287243,.620069,-.498039,.13318,.370196,.659562,-.372549,.123337,.470588,.706805,-.247059,.115386,.570335,.753126,-.121569,.186251,.643168,.761,.00392157,.258716,.71514,.768074,.129412,.380761,.760415,.750358,.254902,.503576,.806075,.732795,.380392,.645306,.861192,.719016,.505882,.783899,.91511,.705606,.631373,.858701,.944637,.6997,.756863,.931349,.973303,.698424,.882353,.966782,.987082,.777163,1,1,1,.85098]},{ColorSpace:"Lab",Name:"PuRd",RGBPoints:[-1,.286275,0,.415686,-.87451,.38273,.001968,.441276,-.74902,.479231,.003922,.466774,-.623529,.581592,.003922,.480554,-.498039,.683799,.00549,.494887,-.372549,.776317,.105882,.544098,-.247059,.867866,.206321,.592618,-.121569,.919047,.308681,.612303,.00392157,.968812,.411226,.632603,.129412,.974717,.519493,.671972,.254902,.980546,.626451,.71065,.380392,.984483,.701253,.732303,.505882,.988328,.77504,.755617,.631373,.990296,.828189,.812703,.756863,.992372,.880907,.869035,.882353,.996309,.926182,.912341,1,1,.968627,.952941]},{ColorSpace:"Lab",Name:"RdPu",RGBPoints:[-1,.403922,0,.121569,-.87451,.500377,0,.192434,-.74902,.596909,277e-6,.263037,-.623529,.703206,.035709,.300438,-.498039,.808612,.071296,.338854,-.372549,.857824,.116571,.441215,-.247059,.905513,.163552,.54293,-.121569,.889765,.281661,.617732,.00392157,.873156,.39897,.691611,.129412,.82985,.491488,.736886,.254902,.789081,.583237,.781853,.380392,.810734,.656071,.819254,.505882,.833126,.729181,.85684,.631373,.870527,.80792,.898178,.756863,.907605,.884398,.938331,.882353,.9391,.921799,.958016,1,.968627,.956863,.976471]},{ColorSpace:"Lab",Name:"Oranges",RGBPoints:[-1,.498039,.152941,.015686,-.87451,.57481,.182468,.013718,-.74902,.651765,.212042,.011734,-.623529,.752157,.247474,.007797,-.498039,.851719,.283368,.004475,-.372549,.898962,.348328,.039908,-.247059,.945652,.413426,.076401,-.121569,.969273,.484291,.157109,.00392157,.992157,.554971,.238185,.129412,.992157,.619931,.330704,.254902,.992157,.684967,.423837,.380392,.992157,.751895,.532103,.505882,.992249,.817716,.639354,.631373,.994218,.861023,.725967,.756863,.996186,.903576,.810965,.882353,.998155,.933103,.868051,1,1,.960784,.921569]},{ColorSpace:"Lab",Name:"Reds",RGBPoints:[-1,.403922,0,.05098,-.87451,.525967,.029527,.066728,-.74902,.647643,.058962,.082476,-.623529,.722445,.076678,.098224,-.498039,.797186,.095194,.114187,-.372549,.868051,.164091,.143714,-.247059,.937809,.233541,.173933,-.121569,.96143,.326059,.232987,.00392157,.984375,.418147,.292657,.129412,.986344,.496886,.371396,.254902,.988235,.575702,.450673,.380392,.988235,.656409,.543191,.505882,.98842,.736747,.635894,.631373,.992357,.809581,.732349,.756863,.996186,.880692,.826759,.882353,.998155,.92203,.885813,1,1,.960784,.941176]},{ColorSpace:"Lab",Name:"RdOr",RGBPoints:[-1,.498039,0,0,-.87451,.6004,0,0,-.74902,.702514,738e-6,477e-6,-.623529,.773379,.095225,.061499,-.498039,.843875,.189865,.12283,-.372549,.891119,.294195,.203537,-.247059,.937855,.397924,.283137,-.121569,.963445,.476663,.316601,.00392157,.988297,.555771,.351665,.129412,.990265,.646321,.436309,.254902,.992157,.735256,.519646,.380392,.992157,.784468,.570827,.505882,.992249,.833218,.623483,.631373,.994218,.872587,.706159,.756863,.996186,.911419,.788189,.882353,.998155,.940946,.859054,1,1,.968627,.92549]},{ColorSpace:"Lab",Name:"BrOrYl",RGBPoints:[-1,.4,.145098,.023529,-.87451,.500392,.174625,.019592,-.74902,.600784,.204291,.015656,-.623529,.701176,.251534,.011719,-.498039,.800984,.299146,.008397,-.372549,.863975,.370012,.043829,-.247059,.926321,.441107,.0794,-.121569,.961753,.521815,.120738,.00392157,.996078,.602645,.163122,.129412,.996078,.68729,.237924,.254902,.996078,.771011,.314879,.380392,.996078,.832034,.444798,.505882,.996171,.892042,.572595,.631373,.998139,.931411,.65724,.756863,1,.969489,.741669,.882353,1,.985236,.822376,1,1,1,.898039]},{ColorSpace:"Lab",Name:"RdOrYl",RGBPoints:[-1,.501961,0,.14902,-.87451,.622038,0,.14902,-.74902,.741761,4e-4,.148866,-.623529,.816563,.05158,.129181,-.498039,.890965,.10356,.110235,-.372549,.940177,.205921,.137793,-.247059,.988281,.308789,.165536,-.121569,.99025,.432803,.200969,.00392157,.992218,.555217,.236278,.129412,.994187,.628051,.267774,.254902,.996078,.701038,.301269,.380392,.996078,.777809,.383945,.505882,.996171,.852826,.466621,.631373,.998139,.892195,.549296,.756863,1,.931349,.632188,.882353,1,.966782,.7188,1,1,1,.8]},{ColorSpace:"Lab",Name:"CIELab_blue2red",RGBPoints:[-1,0,.6,.74902,1,.76863,.46667,.34118]},{ColorSpace:"Lab",Name:"blue2yellow",RGBPoints:[-1,0,0,1,0,.5,.5,.5,1,1,1,0]},{ColorSpace:"Lab",Name:"erdc_blue2gold",RGBPoints:[-1,.175119,.0438468,1,-.874016,.22383,.159771,.94557,-.748031,.27254,.233611,.891216,-.622047,.321251,.296526,.836857,-.496063,.369962,.354296,.782359,-.370079,.418672,.409139,.72754,-.244094,.467383,.462152,.672148,-.11811,.51609,.51396,.615825,.00787402,.572863,.55452,.559172,.133858,.630269,.593822,.517729,.259843,.689588,.624668,.47446,.385827,.745394,.656113,.428638,.511811,.798624,.688104,.379105,.637795,.849926,.720593,.323834,.76378,.899765,.753543,.258657,.889764,.948487,.78692,.171778,1,.990413,.816451,.00729848]},{ColorSpace:"Lab",Name:"erdc_blue2yellow",RGBPoints:[-1,.0830122,0,.495617,-.87451,.141973,.0551288,.57363,-.74902,.193048,.110258,.604561,-.623529,.234231,.165386,.57643,-.498039,.275413,.220515,.548299,-.372549,.316596,.275644,.520169,-.247059,.357778,.330773,.492038,-.121569,.398961,.385901,.463908,.00392157,.449929,.438487,.426815,.129412,.511572,.488299,.379944,.254902,.581222,.53603,.325741,.380392,.650871,.583761,.271538,.505882,.720521,.631493,.217335,.631373,.79017,.679224,.163132,.756863,.85982,.726955,.108929,.882353,.910254,.774159,.14112,1,.927513,.81759,.306289]},{ColorSpace:"Lab",Name:"erdc_cyan2orange",RGBPoints:[-1,.0471513,.213874,.414329,-.87451,.0674702,.256648,.439027,-.74902,.0959957,.299331,.462089,-.623529,.132428,.341872,.483212,-.498039,.188743,.38277,.500597,-.372549,.268511,.420229,.512179,-.247059,.352945,.455602,.519101,-.121569,.43893,.489368,.521538,.00392157,.522445,.522495,.522436,.129412,.600089,.555682,.53205,.254902,.67988,.587981,.539163,.380392,.761011,.619586,.544439,.505882,.84278,.650741,.548567,.631373,.910713,.687347,.557822,.756863,.952232,.734972,.577775,.882353,.975642,.789858,.604868,1,.990752,.843643,.632857]},{ColorSpace:"Lab",Name:"erdc_purple2green",RGBPoints:[-1,.235006,.0483128,.530899,-.87451,.302968,.108419,.552391,-.74902,.360241,.166059,.569502,-.623529,.406746,.226782,.579373,-.498039,.444073,.28964,.582094,-.372549,.473648,.353774,.577947,-.247059,.497636,.418154,.567911,-.121569,.519086,.481741,.553968,.00392157,.542884,.542914,.542875,.129412,.566303,.603989,.527499,.254902,.595218,.662965,.516857,.380392,.628641,.720701,.510673,.505882,.665373,.777849,.508165,.631373,.704182,.834921,.508303,.756863,.743846,.892328,.50999,.882353,.783158,.950422,.512181,1,.818617,1,.513888]},{ColorSpace:"Lab",Name:"erdc_purple2green_dark",RGBPoints:[-1,.107656,0,.428682,-.87451,.1924,0,.449799,-.74902,.255118,.0648939,.466726,-.623529,.304256,.133066,.476703,-.498039,.343202,.19716,.479793,-.372549,.373876,.260353,.476241,-.247059,.398497,.322872,.466953,-.121569,.420016,.384252,.453785,.00392157,.44319,.443216,.443186,.129412,.465553,.502139,.428233,.254902,.492959,.559151,.417591,.380392,.524654,.615092,.411016,.505882,.55959,.670583,.40779,.631373,.596614,.726102,.406948,.756863,.634544,.782032,.407439,.882353,.672183,.838703,.408237,1,.706131,.892759,.408452]},{ColorSpace:"Lab",Name:"coolwarm",RGBPoints:[-1,.229806,.298718,.753683,-.875,.303869,.406535,.844959,-.75,.383013,.509419,.917388,-.625,.466667,.604563,.968155,-.5,.552953,.688929,.995376,-.375,.639176,.7596,.998151,-.25,.722193,.813953,.976575,-.125,.798692,.849786,.931689,0,.865395,.86541,.865396,.125,.924128,.827385,.774508,.25,.958853,.769768,.678008,.375,.969954,.694267,.579375,.5,.958003,.602842,.481776,.625,.923945,.497309,.38797,.75,.869187,.378313,.300267,.875,.795632,.241284,.220526,1,.705673,.0155562,.150233]},{ColorSpace:"Lab",Name:"BuRd",RGBPoints:[-1,.019608,.188235,.380392,-.87451,.088504,.321107,.564937,-.74902,.163399,.444983,.697501,-.623529,.247059,.555709,.754095,-.498039,.420684,.676432,.818685,-.372549,.606459,.789773,.880277,-.247059,.761476,.868512,.924567,-.121569,.878047,.925721,.951942,.00392157,.969089,.966474,.964937,.129412,.983852,.897578,.846828,.254902,.982468,.800692,.706113,.380392,.960323,.66782,.536332,.505882,.894579,.503806,.399769,.631373,.81707,.33218,.281046,.756863,.728489,.155017,.197386,.882353,.576932,.055363,.14925,1,.403922,0,.121569]},{ColorSpace:"Lab",Name:"Spectral_lowBlue",RGBPoints:[-1,.368627,.309804,.635294,-.87451,.260361,.450058,.70173,-.74902,.248058,.591311,.717186,-.623529,.376009,.734025,.658132,-.498039,.537947,.814764,.64506,-.372549,.702345,.879585,.636678,-.247059,.84752,.938639,.607151,-.121569,.940408,.976163,.656055,.00392157,.999923,.997616,.745021,.129412,.997463,.921338,.61707,.254902,.995002,.824606,.499885,.380392,.992541,.701576,.39654,.505882,.973472,.547405,.318108,.631373,.937793,.398539,.270127,.756863,.861515,.282891,.299654,.882353,.746482,.144637,.288812,1,.619608,.003922,.258824]},{ColorSpace:"Lab",Name:"GnRP",RGBPoints:[-1,0,.266667,.105882,-.87451,.066436,.394617,.174779,-.74902,.168858,.524567,.25767,-.623529,.323875,.657439,.361015,-.498039,.504883,.772318,.506344,-.372549,.678431,.870127,.654902,-.247059,.803922,.921799,.780392,-.121569,.897116,.951942,.882814,.00392157,.967397,.965936,.967474,.129412,.928028,.879815,.930565,.254902,.866052,.780777,.882891,.380392,.77501,.665129,.821376,.505882,.675663,.537024,.737024,.631373,.57847,.396155,.645982,.756863,.492349,.223914,.547559,.882353,.375548,.096886,.423299,1,.25098,0,.294118]},{ColorSpace:"Lab",Name:"GYPi",RGBPoints:[-1,.152941,.392157,.098039,-.87451,.246444,.505344,.117724,-.74902,.351942,.614533,.161399,-.623529,.474971,.717878,.240138,-.498039,.611995,.811226,.392849,-.372549,.746328,.893118,.565321,-.247059,.859516,.94233,.747405,-.121569,.928105,.96386,.875663,.00392157,.969089,.966859,.968012,.129412,.983852,.910265,.948328,.254902,.979239,.833218,.914648,.380392,.949712,.729873,.862976,.505882,.905652,.58293,.763552,.631373,.85521,.410073,.652211,.756863,.793695,.183699,.531642,.882353,.683737,.063899,.420761,1,.556863,.003922,.321569]},{ColorSpace:"Lab",Name:"GnYlRd",RGBPoints:[-1,0,.407843,.215686,-.87451,.063975,.525952,.277201,-.74902,.177932,.633064,.332718,-.623529,.364937,.724106,.379469,-.498039,.527951,.797155,.40223,-.372549,.678431,.862822,.433449,-.247059,.803922,.916955,.514648,-.121569,.909419,.961861,.625067,.00392157,.999923,.997616,.745021,.129412,.997463,.921338,.61707,.254902,.995002,.824606,.499885,.380392,.992541,.701576,.39654,.505882,.973472,.547405,.318108,.631373,.939023,.389927,.245521,.756863,.867666,.239831,.176624,.882353,.762399,.110727,.151326,1,.647059,0,.14902]},{ColorSpace:"Lab",Name:"GBBr",RGBPoints:[-1,0,.235294,.188235,-.87451,.002461,.338639,.301423,-.74902,.055902,.448981,.417609,-.623529,.183852,.56955,.538178,-.498039,.357785,.700115,.660746,-.372549,.540177,.819531,.77624,-.247059,.714879,.890888,.864821,-.121569,.851134,.934564,.922645,.00392157,.960861,.959785,.95694,.129412,.963322,.927797,.83391,.254902,.939946,.868897,.68935,.380392,.883353,.775394,.517109,.505882,.808074,.625836,.324106,.631373,.717647,.476355,.15494,.756863,.592157,.358247,.06882,.882353,.458593,.26436,.031142,1,.329412,.188235,.019608]},{ColorSpace:"Lab",Name:"PuOr",RGBPoints:[-1,.498039,.231373,.031373,-.87451,.62599,.30273,.026451,-.74902,.746943,.387082,.037524,-.623529,.85767,.490427,.071972,-.498039,.936409,.617762,.236371,-.372549,.992695,.743099,.43291,-.247059,.995156,.841523,.63714,-.121569,.985313,.913802,.813687,.00392157,.966244,.966398,.967705,.129412,.889965,.89504,.938178,.254902,.806151,.804306,.894656,.380392,.712649,.688658,.833141,.505882,.594233,.554325,.744637,.631373,.474894,.404229,.652364,.756863,.366628,.217224,.563783,.882353,.266436,.089965,.434833,1,.176471,0,.294118]},{ColorSpace:"Lab",Name:"PRGn",RGBPoints:[-1,.25098,0,.294118,-.87451,.383852,.103345,.431911,-.74902,.497732,.234679,.55371,-.623529,.583852,.40692,.652134,-.498039,.681968,.545175,.742561,-.372549,.7807,.672357,.825221,-.247059,.871742,.788005,.886736,-.121569,.930488,.885198,.932872,.00392157,.966321,.968089,.965859,.129412,.892503,.950865,.877278,.254902,.796078,.91857,.772549,.380392,.670588,.866897,.647059,.505882,.493195,.765398,.496655,.631373,.314187,.649135,.354556,.756863,.15917,.516263,.251211,.882353,.062284,.386621,.170473,1,0,.266667,.105882]},{ColorSpace:"Lab",Name:"PiYG",RGBPoints:[-1,.556863,.003922,.321569,-.87451,.692195,.067897,.427374,-.74902,.797539,.197847,.539177,-.623529,.859054,.424221,.659746,-.498039,.908574,.592618,.770319,-.372549,.951557,.736332,.866205,-.247059,.981084,.839677,.917878,-.121569,.98293,.913802,.949558,.00392157,.96732,.968474,.965629,.129412,.92549,.963552,.869666,.254902,.852441,.939254,.736025,.380392,.739254,.890042,.553941,.505882,.60323,.805536,.382238,.631373,.467282,.711419,.235217,.756863,.344252,.608074,.156478,.882353,.2406,.49827,.116494,1,.152941,.392157,.098039]},{ColorSpace:"Lab",Name:"OrPu",RGBPoints:[-1,.176471,0,.294118,-.87451,.272434,.095963,.444214,-.74902,.373395,.228912,.56932,-.623529,.481661,.415917,.657901,-.498039,.601922,.562937,.750481,-.372549,.718493,.695886,.836986,-.247059,.811995,.811534,.898501,-.121569,.894733,.8995,.940023,.00392157,.969166,.966859,.963629,.129412,.98639,.910265,.803691,.254902,.995002,.835371,.624375,.380392,.992541,.736947,.420146,.505882,.931949,.609458,.224221,.631373,.85075,.483968,.069819,.756863,.740023,.380623,.035371,.882353,.617993,.29827,.026759,1,.498039,.231373,.031373]},{ColorSpace:"Lab",Name:"BrBG",RGBPoints:[-1,.329412,.188235,.019608,-.87451,.467205,.269435,.031911,-.74902,.6,.365629,.074202,-.623529,.72549,.483737,.160323,-.498039,.812995,.635832,.336409,-.372549,.88689,.781238,.527874,-.247059,.943483,.87474,.700115,-.121569,.963168,.929796,.841599,.00392157,.957247,.959938,.959554,.129412,.84406,.932872,.920185,.254902,.70396,.886428,.859285,.380392,.529258,.815071,.770704,.505882,.346251,.691811,.653057,.631373,.175855,.562015,.530642,.756863,.047905,.441446,.410073,.882353,.002307,.33218,.294348,1,0,.235294,.188235]},{ColorSpace:"Lab",Name:"GyRd",RGBPoints:[-1,.101961,.101961,.101961,-.87451,.227451,.227451,.227451,-.74902,.359939,.359939,.359939,-.623529,.502653,.502653,.502653,-.498039,.631373,.631373,.631373,-.372549,.749865,.749865,.749865,-.247059,.843368,.843368,.843368,-.121569,.926105,.926105,.926105,.00392157,.999846,.997232,.995694,.129412,.994925,.908651,.857901,.254902,.982468,.800692,.706113,.380392,.960323,.66782,.536332,.505882,.894579,.503806,.399769,.631373,.81707,.33218,.281046,.756863,.728489,.155017,.197386,.882353,.576932,.055363,.14925,1,.403922,0,.121569]},{ColorSpace:"Lab",Name:"erdc_divHi_purpleGreen",RGBPoints:[-1,.297553,0,.489074,-.87451,.40259,.151146,.567754,-.74902,.516038,.284843,.658231,-.623529,.629783,.423646,.750938,-.498039,.735198,.563697,.835956,-.372549,.82408,.695541,.903582,-.247059,.889091,.807454,.944862,-.121569,.92334,.886917,.951839,.00392157,.921045,.921084,.921003,.129412,.877324,.907455,.845381,.254902,.797649,.849713,.734695,.380392,.691646,.75964,.600532,.505882,.568981,.649159,.453807,.631373,.438945,.529756,.304259,.756863,.30973,.412001,.158303,.882353,.187078,.305111,.00251458,1,.101655,.220836,0]},{ColorSpace:"Lab",Name:"erdc_divHi_purpleGreen_dim",RGBPoints:[-1,.404088,.131038,.592767,-.87451,.486469,.230957,.651243,-.74902,.575165,.339335,.717723,-.623529,.662741,.454332,.784263,-.498039,.742071,.570213,.842918,-.372549,.806935,.678992,.886227,-.247059,.852219,.771315,.90763,-.121569,.873345,.837327,.901572,.00392157,.866783,.86682,.866745,.129412,.82839,.858225,.796812,.254902,.762578,.814287,.700202,.380392,.676429,.744229,.585735,.505882,.577033,.65732,.461526,.631373,.47128,.562476,.33476,.756863,.365461,.467957,.21076,.882353,.264758,.381138,.0878313,1,.182591,.312249,0]},{ColorSpace:"Lab",Name:"erdc_divLow_icePeach",RGBPoints:[-1,.480048,.817441,.998056,-.87451,.425898,.726921,.883187,-.74902,.366682,.629445,.761936,-.623529,.308756,.531002,.640217,-.498039,.258021,.43705,.523433,-.372549,.219244,.352381,.416348,-.247059,.195127,.281032,.322979,-.121569,.186286,.22627,.246525,.00392157,.192352,.19236,.192364,.129412,.255927,.214469,.191756,.254902,.340459,.254426,.206666,.380392,.444655,.309315,.234029,.505882,.565353,.376004,.270969,.631373,.697917,.450748,.314293,.756863,.836657,.529064,.360227,.882353,.972695,.614884,.413123,1,1,.705904,.472699]},{ColorSpace:"Lab",Name:"erdc_divLow_purpleGreen",RGBPoints:[-1,.956034,.666487,.952663,-.87451,.874457,.572698,.936352,-.74902,.753465,.488253,.909063,-.623529,.63309,.413507,.763833,-.498039,.514491,.345878,.620015,-.372549,.405008,.288141,.484376,-.247059,.311388,.241986,.363556,-.121569,.238722,.209044,.263449,.00392157,.192352,.192366,.192362,.129412,.200379,.233201,.168618,.254902,.230151,.291737,.165227,.380392,.279481,.366076,.178607,.505882,.344927,.453267,.205703,.631373,.421554,.549449,.242643,.756863,.503334,.649999,.284377,.882353,.583497,.749672,.324969,1,.650705,.837228,.356264]},{ColorSpace:"Lab",Name:"Haze_green",RGBPoints:[-1,1,.835294,.886275,-.87451,.937255,.756863,.870443,-.74902,.875817,.666376,.857807,-.623529,.778359,.583007,.808134,-.498039,.676253,.494118,.745098,-.372549,.561365,.390123,.682353,-.247059,.438344,.262745,.621496,-.121569,.321133,.141031,.558751,.00392157,.203922,.0217865,.495861,.129412,.265505,.129412,.433261,.254902,.311692,.255338,.37008,.380392,.356282,.377342,.310821,.505882,.39971,.488889,.258243,.631373,.442556,.604357,.205519,.756863,.48671,.71968,.152941,.882353,.529847,.830356,.100944,1,.572549,.933333,.054902]},{ColorSpace:"Lab",Name:"Haze_lime",RGBPoints:[-1,.704034,.784196,1,-.87451,.633111,.691418,.956078,-.74902,.564021,.600606,.912157,-.623529,.496827,.51189,.868235,-.498039,.43157,.425416,.824314,-.372549,.368248,.341347,.780392,-.247059,.306767,.259855,.736471,-.121569,.246862,.181069,.692549,.00392157,.191619,.109542,.648627,.129412,.257404,.194031,.604706,.254902,.321794,.278775,.560784,.380392,.387909,.364617,.516863,.505882,.456569,.451881,.472941,.631373,.527424,.540773,.42902,.756863,.599759,.631427,.385098,.882353,.673065,.723898,.341176,1,.742751,.812252,.3]},{ColorSpace:"RGB",Name:"Haze",RGBPoints:[-1,1,.835294,.996078,-.00392157,.023529,.141176,.498039,.00392157,.015686,.137255,.494118,1,.984314,.764706,0]},{ColorSpace:"Lab",Name:"Haze_cyan",RGBPoints:[-1,.956863,1,.835294,-.87451,.933188,.921714,.760784,-.74902,.870588,.803486,.671605,-.623529,.807843,.684096,.583297,-.498039,.745098,.569208,.494118,-.372549,.682353,.437763,.390123,-.247059,.621496,.288163,.262745,-.121569,.558751,.144517,.141031,.00392157,.495861,.0217865,.0413943,.129412,.433261,.137255,.129412,.254902,.37008,.263181,.255338,.380392,.306318,.381845,.372694,.505882,.243137,.503994,.494263,.631373,.180392,.629484,.619753,.756863,.117647,.754975,.747131,.882353,.054902,.876398,.866812,1,0,.988235,.976471]},{ColorSpace:"Lab",Name:"nic_Edge",RGBPoints:[-1,.191208,.191208,.191208,-.87451,.239484,.00545035,.614821,-.74902,.220593,.0617459,.863547,-.623529,.17509,.278988,.97794,-.498039,.143526,.576069,.998553,-.372549,.166456,.871883,.96594,-.247059,.376202,.993555,.981833,-.121569,.681996,.991297,.999239,.00392157,.954172,.952734,.94374,.129412,.999735,.99301,.662896,.254902,.979399,.991466,.357973,.380392,.968771,.854967,.162659,.505882,.999245,.556697,.144323,.631373,.973959,.26223,.177946,.756863,.852358,.0526707,.222974,.882353,.593889,.00912724,.238855,1,.191208,.191208,.191208]},{ColorSpace:"Lab",Name:"erdc_iceFire_H",RGBPoints:[-1,405432e-12,0,590122e-11,-.87451,0,.120401,.302675,-.74902,0,.216583,.524574,-.623529,.0552475,.345025,.6595,-.498039,.128047,.492588,.720288,-.372549,.188955,.641309,.792092,-.247059,.327673,.784935,.873434,-.121569,.60824,.892164,.935547,.00392157,.881371,.912178,.818099,.129412,.951407,.835621,.449279,.254902,.904481,.690489,0,.380392,.85407,.510864,0,.505882,.777093,.33018,88199e-8,.631373,.672862,.139087,.00269398,.756863,.508815,0,0,.882353,.299417,366289e-9,547829e-9,1,.0157519,.00332021,455569e-13]},{ColorSpace:"Lab",Name:"erdc_iceFire_L",RGBPoints:[-1,.870485,.913768,.832905,-.87451,.586919,.887865,.934003,-.74902,.31583,.776442,.867858,-.623529,.18302,.632034,.787722,-.498039,.117909,.484134,.713825,-.372549,.0507239,.335979,.654741,-.247059,0,.209874,.511832,-.121569,0,.114689,.28935,.00392157,.0157519,.00332021,455569e-13,.129412,.312914,0,0,.254902,.520865,0,0,.380392,.680105,.15255,.0025996,.505882,.785109,.339479,797922e-9,.631373,.857354,.522494,0,.756863,.910974,.699774,0,.882353,.951921,.842817,.478545,1,.881371,.912178,.818099]},{ColorSpace:"RGB",Name:"hsv",RGBPoints:[-1,1,0,0,-.666666,1,0,1,-.333333,0,0,1,0,0,1,1,.33333,0,1,0,.66666,1,1,0,1,1,0,0]},{ColorSpace:"Lab",Name:"hue_L60",RGBPoints:[-1,.964784,.400592,.349549,-.87451,.964915,.372498,.53785,-.74902,.892353,.401039,.759569,-.623529,.79263,.446956,.903017,-.498039,.682208,.49954,.966673,-.372549,.56392,.553082,.968836,-.247059,.442031,.606396,.901601,-.121569,.305499,.65701,.765784,.00392157,.197251,.687914,.620914,.129412,.193882,.701887,.472654,.254902,.249866,.706123,.320005,.380392,.35132,.697417,.202919,.505882,.498097,.669467,.125232,.631373,.637477,.626239,.107431,.756863,.762115,.56872,.155812,.882353,.889434,.481116,.240445,1,.964784,.400592,.349549]},{IndexedColors:[0,0,0,.8941176470588236,.1019607843137255,.1098039215686274,.2156862745098039,.4941176470588236,.7215686274509804,.3019607843137255,.6862745098039216,.2901960784313726,.596078431372549,.3058823529411765,.6392156862745098,1,.4980392156862745,0,.6509803921568628,.3372549019607843,.1568627450980392],Name:"Spectrum",NanColor:[.6509803921568628,.3372549019607843,.1568627450980392]},{IndexedColors:[.4745098039215686,.09019607843137255,.09019607843137255,.7098039215686275,.00392156862745098,.00392156862745098,.9372549019607843,.2784313725490196,.09803921568627451,.9764705882352941,.5137254901960784,.1411764705882353,1,.7058823529411765,0,1,.8980392156862745,.02352941176470588],Name:"Warm",NanColor:[1,.8980392156862745,.02352941176470588]},{IndexedColors:[.4588235294117647,.6941176470588235,.00392156862745098,.3450980392156863,.5019607843137255,.1607843137254902,.3137254901960784,.8431372549019608,.7490196078431373,.1098039215686274,.5843137254901961,.803921568627451,.2313725490196079,.407843137254902,.6705882352941176,.6039215686274509,.407843137254902,1,.3725490196078431,.2,.5019607843137255],Name:"Cool",NanColor:[.3725490196078431,.2,.5019607843137255]},{IndexedColors:[.2313725490196079,.407843137254902,.6705882352941176,.1098039215686274,.5843137254901961,.803921568627451,.3058823529411765,.8509803921568627,.9176470588235294,.4509803921568628,.6039215686274509,.8352941176470589,.2588235294117647,.2392156862745098,.6627450980392157,.3137254901960784,.3294117647058823,.5294117647058824,.06274509803921569,.1647058823529412,.3215686274509804],Name:"Blues",NanColor:[.06274509803921569,.1647058823529412,.3215686274509804]},{IndexedColors:[.1098039215686274,.5843137254901961,.803921568627451,.2313725490196079,.407843137254902,.6705882352941176,.4,.2431372549019608,.7176470588235294,.6352941176470588,.3294117647058823,.8117647058823529,.8705882352941177,.3803921568627451,.807843137254902,.8627450980392157,.3803921568627451,.5843137254901961,.2392156862745098,.06274509803921569,.3215686274509804],Name:"Wild Flower",NanColor:[.2392156862745098,.06274509803921569,.3215686274509804]},{IndexedColors:[.396078431372549,.4862745098039216,.2156862745098039,.4588235294117647,.6941176470588235,.00392156862745098,.6980392156862745,.7294117647058823,.1882352941176471,1,.8980392156862745,.02352941176470588,1,.7058823529411765,0,.9764705882352941,.5137254901960784,.1411764705882353],Name:"Citrus",NanColor:[.9764705882352941,.5137254901960784,.1411764705882353]},{IndexedColors:[.4980392156862745,.2313725490196079,.03137254901960784,.7019607843137254,.3450980392156863,.02352941176470588,.8784313725490196,.5098039215686274,.0784313725490196,.9921568627450981,.7215686274509804,.3882352941176471,.996078431372549,.8784313725490196,.7137254901960784,.9686274509803922,.9686274509803922,.9686274509803922,.8470588235294118,.8549019607843137,.9215686274509803,.6980392156862745,.6705882352941176,.8235294117647058,.5019607843137255,.4509803921568628,.6745098039215687,.3294117647058823,.1529411764705882,.5333333333333333,.1764705882352941,0,.2941176470588235],Name:"Brewer Diverging Purple-Orange (11)",NanColor:[.1764705882352941,0,.2941176470588235]},{IndexedColors:[.4980392156862745,.2313725490196079,.03137254901960784,.7019607843137254,.3450980392156863,.02352941176470588,.8784313725490196,.5098039215686274,.0784313725490196,.9921568627450981,.7215686274509804,.3882352941176471,.996078431372549,.8784313725490196,.7137254901960784,.8470588235294118,.8549019607843137,.9215686274509803,.6980392156862745,.6705882352941176,.8235294117647058,.5019607843137255,.4509803921568628,.6745098039215687,.3294117647058823,.1529411764705882,.5333333333333333,.1764705882352941,0,.2941176470588235],Name:"Brewer Diverging Purple-Orange (10)",NanColor:[.1764705882352941,0,.2941176470588235]},{IndexedColors:[.7019607843137254,.3450980392156863,.02352941176470588,.8784313725490196,.5098039215686274,.0784313725490196,.9921568627450981,.7215686274509804,.3882352941176471,.996078431372549,.8784313725490196,.7137254901960784,.9686274509803922,.9686274509803922,.9686274509803922,.8470588235294118,.8549019607843137,.9215686274509803,.6980392156862745,.6705882352941176,.8235294117647058,.5019607843137255,.4509803921568628,.6745098039215687,.3294117647058823,.1529411764705882,.5333333333333333],Name:"Brewer Diverging Purple-Orange (9)",NanColor:[.3294117647058823,.1529411764705882,.5333333333333333]},{IndexedColors:[.7019607843137254,.3450980392156863,.02352941176470588,.8784313725490196,.5098039215686274,.0784313725490196,.9921568627450981,.7215686274509804,.3882352941176471,.996078431372549,.8784313725490196,.7137254901960784,.8470588235294118,.8549019607843137,.9215686274509803,.6980392156862745,.6705882352941176,.8235294117647058,.5019607843137255,.4509803921568628,.6745098039215687,.3294117647058823,.1529411764705882,.5333333333333333],Name:"Brewer Diverging Purple-Orange (8)",NanColor:[.3294117647058823,.1529411764705882,.5333333333333333]},{IndexedColors:[.7019607843137254,.3450980392156863,.02352941176470588,.9450980392156862,.6392156862745098,.2509803921568627,.996078431372549,.8784313725490196,.7137254901960784,.9686274509803922,.9686274509803922,.9686274509803922,.8470588235294118,.8549019607843137,.9215686274509803,.6,.5568627450980392,.7647058823529411,.3294117647058823,.1529411764705882,.5333333333333333],Name:"Brewer Diverging Purple-Orange (7)",NanColor:[.3294117647058823,.1529411764705882,.5333333333333333]},{IndexedColors:[.7019607843137254,.3450980392156863,.02352941176470588,.9450980392156862,.6392156862745098,.2509803921568627,.996078431372549,.8784313725490196,.7137254901960784,.8470588235294118,.8549019607843137,.9215686274509803,.6,.5568627450980392,.7647058823529411,.3294117647058823,.1529411764705882,.5333333333333333],Name:"Brewer Diverging Purple-Orange (6)",NanColor:[.3294117647058823,.1529411764705882,.5333333333333333]},{IndexedColors:[.9019607843137255,.3803921568627451,.00392156862745098,.9921568627450981,.7215686274509804,.3882352941176471,.9686274509803922,.9686274509803922,.9686274509803922,.6980392156862745,.6705882352941176,.8235294117647058,.3686274509803922,.2352941176470588,.6],Name:"Brewer Diverging Purple-Orange (5)",NanColor:[.3686274509803922,.2352941176470588,.6]},{IndexedColors:[.9019607843137255,.3803921568627451,.00392156862745098,.9921568627450981,.7215686274509804,.3882352941176471,.6980392156862745,.6705882352941176,.8235294117647058,.3686274509803922,.2352941176470588,.6],Name:"Brewer Diverging Purple-Orange (4)",NanColor:[.3686274509803922,.2352941176470588,.6]},{IndexedColors:[.9450980392156862,.6392156862745098,.2509803921568627,.9686274509803922,.9686274509803922,.9686274509803922,.6,.5568627450980392,.7647058823529411],Name:"Brewer Diverging Purple-Orange (3)",NanColor:[.6,.5568627450980392,.7647058823529411]},{IndexedColors:[.6196078431372549,.00392156862745098,.2588235294117647,.8352941176470589,.2431372549019608,.3098039215686275,.9568627450980393,.4274509803921568,.2627450980392157,.9921568627450981,.6823529411764706,.3803921568627451,.996078431372549,.8784313725490196,.5450980392156862,1,1,.7490196078431373,.9019607843137255,.9607843137254902,.596078431372549,.6705882352941176,.8666666666666667,.6431372549019608,.4,.7607843137254902,.6470588235294118,.196078431372549,.5333333333333333,.7411764705882353,.3686274509803922,.3098039215686275,.6352941176470588],Name:"Brewer Diverging Spectral (11)",NanColor:[.3686274509803922,.3098039215686275,.6352941176470588]},{IndexedColors:[.6196078431372549,.00392156862745098,.2588235294117647,.8352941176470589,.2431372549019608,.3098039215686275,.9568627450980393,.4274509803921568,.2627450980392157,.9921568627450981,.6823529411764706,.3803921568627451,.996078431372549,.8784313725490196,.5450980392156862,.9019607843137255,.9607843137254902,.596078431372549,.6705882352941176,.8666666666666667,.6431372549019608,.4,.7607843137254902,.6470588235294118,.196078431372549,.5333333333333333,.7411764705882353,.3686274509803922,.3098039215686275,.6352941176470588],Name:"Brewer Diverging Spectral (10)",NanColor:[.3686274509803922,.3098039215686275,.6352941176470588]},{IndexedColors:[.8352941176470589,.2431372549019608,.3098039215686275,.9568627450980393,.4274509803921568,.2627450980392157,.9921568627450981,.6823529411764706,.3803921568627451,.996078431372549,.8784313725490196,.5450980392156862,1,1,.7490196078431373,.9019607843137255,.9607843137254902,.596078431372549,.6705882352941176,.8666666666666667,.6431372549019608,.4,.7607843137254902,.6470588235294118,.196078431372549,.5333333333333333,.7411764705882353],Name:"Brewer Diverging Spectral (9)",NanColor:[.196078431372549,.5333333333333333,.7411764705882353]},{IndexedColors:[.8352941176470589,.2431372549019608,.3098039215686275,.9568627450980393,.4274509803921568,.2627450980392157,.9921568627450981,.6823529411764706,.3803921568627451,.996078431372549,.8784313725490196,.5450980392156862,.9019607843137255,.9607843137254902,.596078431372549,.6705882352941176,.8666666666666667,.6431372549019608,.4,.7607843137254902,.6470588235294118,.196078431372549,.5333333333333333,.7411764705882353],Name:"Brewer Diverging Spectral (8)",NanColor:[.196078431372549,.5333333333333333,.7411764705882353]},{IndexedColors:[.8352941176470589,.2431372549019608,.3098039215686275,.9882352941176471,.5529411764705883,.3490196078431372,.996078431372549,.8784313725490196,.5450980392156862,1,1,.7490196078431373,.9019607843137255,.9607843137254902,.596078431372549,.6,.8352941176470589,.5803921568627451,.196078431372549,.5333333333333333,.7411764705882353],Name:"Brewer Diverging Spectral (7)",NanColor:[.196078431372549,.5333333333333333,.7411764705882353]},{IndexedColors:[.8352941176470589,.2431372549019608,.3098039215686275,.9882352941176471,.5529411764705883,.3490196078431372,.996078431372549,.8784313725490196,.5450980392156862,.9019607843137255,.9607843137254902,.596078431372549,.6,.8352941176470589,.5803921568627451,.196078431372549,.5333333333333333,.7411764705882353],Name:"Brewer Diverging Spectral (6)",NanColor:[.196078431372549,.5333333333333333,.7411764705882353]},{IndexedColors:[.8431372549019608,.09803921568627451,.1098039215686274,.9921568627450981,.6823529411764706,.3803921568627451,1,1,.7490196078431373,.6705882352941176,.8666666666666667,.6431372549019608,.1686274509803922,.5137254901960784,.7294117647058823],Name:"Brewer Diverging Spectral (5)",NanColor:[.1686274509803922,.5137254901960784,.7294117647058823]},{IndexedColors:[.8431372549019608,.09803921568627451,.1098039215686274,.9921568627450981,.6823529411764706,.3803921568627451,.6705882352941176,.8666666666666667,.6431372549019608,.1686274509803922,.5137254901960784,.7294117647058823],Name:"Brewer Diverging Spectral (4)",NanColor:[.1686274509803922,.5137254901960784,.7294117647058823]},{IndexedColors:[.9882352941176471,.5529411764705883,.3490196078431372,1,1,.7490196078431373,.6,.8352941176470589,.5803921568627451],Name:"Brewer Diverging Spectral (3)",NanColor:[.6,.8352941176470589,.5803921568627451]},{IndexedColors:[.3294117647058823,.1882352941176471,.0196078431372549,.5490196078431373,.3176470588235294,.0392156862745098,.7490196078431373,.5058823529411764,.1764705882352941,.8745098039215686,.7607843137254902,.4901960784313725,.9647058823529412,.9098039215686274,.7647058823529411,.9607843137254902,.9607843137254902,.9607843137254902,.7803921568627451,.9176470588235294,.8980392156862745,.5019607843137255,.803921568627451,.7568627450980392,.207843137254902,.592156862745098,.5607843137254902,.00392156862745098,.4,.3686274509803922,0,.2352941176470588,.1882352941176471],Name:"Brewer Diverging Brown-Blue-Green (11)",NanColor:[0,.2352941176470588,.1882352941176471]},{IndexedColors:[.3294117647058823,.1882352941176471,.0196078431372549,.5490196078431373,.3176470588235294,.0392156862745098,.7490196078431373,.5058823529411764,.1764705882352941,.8745098039215686,.7607843137254902,.4901960784313725,.9647058823529412,.9098039215686274,.7647058823529411,.7803921568627451,.9176470588235294,.8980392156862745,.5019607843137255,.803921568627451,.7568627450980392,.207843137254902,.592156862745098,.5607843137254902,.00392156862745098,.4,.3686274509803922,0,.2352941176470588,.1882352941176471],Name:"Brewer Diverging Brown-Blue-Green (10)",NanColor:[0,.2352941176470588,.1882352941176471]},{IndexedColors:[.5490196078431373,.3176470588235294,.0392156862745098,.7490196078431373,.5058823529411764,.1764705882352941,.8745098039215686,.7607843137254902,.4901960784313725,.9647058823529412,.9098039215686274,.7647058823529411,.9607843137254902,.9607843137254902,.9607843137254902,.7803921568627451,.9176470588235294,.8980392156862745,.5019607843137255,.803921568627451,.7568627450980392,.207843137254902,.592156862745098,.5607843137254902,.00392156862745098,.4,.3686274509803922],Name:"Brewer Diverging Brown-Blue-Green (9)",NanColor:[.00392156862745098,.4,.3686274509803922]},{IndexedColors:[.5490196078431373,.3176470588235294,.0392156862745098,.7490196078431373,.5058823529411764,.1764705882352941,.8745098039215686,.7607843137254902,.4901960784313725,.9647058823529412,.9098039215686274,.7647058823529411,.7803921568627451,.9176470588235294,.8980392156862745,.5019607843137255,.803921568627451,.7568627450980392,.207843137254902,.592156862745098,.5607843137254902,.00392156862745098,.4,.3686274509803922],Name:"Brewer Diverging Brown-Blue-Green (8)",NanColor:[.00392156862745098,.4,.3686274509803922]},{IndexedColors:[.5490196078431373,.3176470588235294,.0392156862745098,.8470588235294118,.7019607843137254,.396078431372549,.9647058823529412,.9098039215686274,.7647058823529411,.9607843137254902,.9607843137254902,.9607843137254902,.7803921568627451,.9176470588235294,.8980392156862745,.3529411764705883,.7058823529411765,.6745098039215687,.00392156862745098,.4,.3686274509803922],Name:"Brewer Diverging Brown-Blue-Green (7)",NanColor:[.00392156862745098,.4,.3686274509803922]},{IndexedColors:[.5490196078431373,.3176470588235294,.0392156862745098,.8470588235294118,.7019607843137254,.396078431372549,.9647058823529412,.9098039215686274,.7647058823529411,.7803921568627451,.9176470588235294,.8980392156862745,.3529411764705883,.7058823529411765,.6745098039215687,.00392156862745098,.4,.3686274509803922],Name:"Brewer Diverging Brown-Blue-Green (6)",NanColor:[.00392156862745098,.4,.3686274509803922]},{IndexedColors:[.6509803921568628,.3803921568627451,.1019607843137255,.8745098039215686,.7607843137254902,.4901960784313725,.9607843137254902,.9607843137254902,.9607843137254902,.5019607843137255,.803921568627451,.7568627450980392,.00392156862745098,.5215686274509804,.4431372549019608],Name:"Brewer Diverging Brown-Blue-Green (5)",NanColor:[.00392156862745098,.5215686274509804,.4431372549019608]},{IndexedColors:[.6509803921568628,.3803921568627451,.1019607843137255,.8745098039215686,.7607843137254902,.4901960784313725,.5019607843137255,.803921568627451,.7568627450980392,.00392156862745098,.5215686274509804,.4431372549019608],Name:"Brewer Diverging Brown-Blue-Green (4)",NanColor:[.00392156862745098,.5215686274509804,.4431372549019608]},{IndexedColors:[.8470588235294118,.7019607843137254,.396078431372549,.9607843137254902,.9607843137254902,.9607843137254902,.3529411764705883,.7058823529411765,.6745098039215687],Name:"Brewer Diverging Brown-Blue-Green (3)",NanColor:[.3529411764705883,.7058823529411765,.6745098039215687]},{IndexedColors:[.9686274509803922,.9882352941176471,.9921568627450981,.8980392156862745,.9607843137254902,.9764705882352941,.8,.9254901960784314,.9019607843137255,.6,.8470588235294118,.788235294117647,.4,.7607843137254902,.6431372549019608,.2549019607843137,.6823529411764706,.4627450980392157,.1372549019607843,.5450980392156862,.2705882352941176,0,.4274509803921568,.1725490196078431,0,.2666666666666667,.1058823529411765],Name:"Brewer Sequential Blue-Green (9)",NanColor:[0,.2666666666666667,.1058823529411765]},{IndexedColors:[.9686274509803922,.9882352941176471,.9921568627450981,.8980392156862745,.9607843137254902,.9764705882352941,.8,.9254901960784314,.9019607843137255,.6,.8470588235294118,.788235294117647,.4,.7607843137254902,.6431372549019608,.2549019607843137,.6823529411764706,.4627450980392157,.1372549019607843,.5450980392156862,.2705882352941176,0,.3450980392156863,.1411764705882353],Name:"Brewer Sequential Blue-Green (8)",NanColor:[0,.3450980392156863,.1411764705882353]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.8,.9254901960784314,.9019607843137255,.8,.9254901960784314,.9019607843137255,.4,.7607843137254902,.6431372549019608,.2549019607843137,.6823529411764706,.4627450980392157,.1372549019607843,.5450980392156862,.2705882352941176,0,.3450980392156863,.1411764705882353],Name:"Brewer Sequential Blue-Green (7)",NanColor:[0,.3450980392156863,.1411764705882353]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.8,.9254901960784314,.9019607843137255,.6,.8470588235294118,.788235294117647,.4,.7607843137254902,.6431372549019608,.1725490196078431,.6352941176470588,.3725490196078431,0,.4274509803921568,.1725490196078431],Name:"Brewer Sequential Blue-Green (6)",NanColor:[0,.4274509803921568,.1725490196078431]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.6980392156862745,.8862745098039215,.8862745098039215,.4,.7607843137254902,.6431372549019608,.1725490196078431,.6352941176470588,.3725490196078431,0,.4274509803921568,.1725490196078431],Name:"Brewer Sequential Blue-Green (5)",NanColor:[0,.4274509803921568,.1725490196078431]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.6980392156862745,.8862745098039215,.8862745098039215,.4,.7607843137254902,.6431372549019608,.1372549019607843,.5450980392156862,.2705882352941176],Name:"Brewer Sequential Blue-Green (4)",NanColor:[.1372549019607843,.5450980392156862,.2705882352941176]},{IndexedColors:[.8980392156862745,.9607843137254902,.9764705882352941,.6,.8470588235294118,.788235294117647,.1725490196078431,.6352941176470588,.3725490196078431],Name:"Brewer Sequential Blue-Green (3)",NanColor:[.1725490196078431,.6352941176470588,.3725490196078431]},{IndexedColors:[1,1,.8980392156862745,1,.9686274509803922,.7372549019607844,.996078431372549,.8901960784313725,.5686274509803921,.996078431372549,.7686274509803922,.3098039215686275,.996078431372549,.6,.1607843137254902,.9254901960784314,.4392156862745098,.0784313725490196,.8,.2980392156862745,.00784313725490196,.6,.203921568627451,.01568627450980392,.4,.1450980392156863,.02352941176470588],Name:"Brewer Sequential Yellow-Orange-Brown (9)",NanColor:[.4,.1450980392156863,.02352941176470588]},{IndexedColors:[1,1,.8980392156862745,1,.9686274509803922,.7372549019607844,.996078431372549,.8901960784313725,.5686274509803921,.996078431372549,.7686274509803922,.3098039215686275,.996078431372549,.6,.1607843137254902,.9254901960784314,.4392156862745098,.0784313725490196,.8,.2980392156862745,.00784313725490196,.5490196078431373,.1764705882352941,.01568627450980392],Name:"Brewer Sequential Yellow-Orange-Brown (8)",NanColor:[.5490196078431373,.1764705882352941,.01568627450980392]},{IndexedColors:[1,1,.8313725490196079,.996078431372549,.8901960784313725,.5686274509803921,.996078431372549,.7686274509803922,.3098039215686275,.996078431372549,.6,.1607843137254902,.9254901960784314,.4392156862745098,.0784313725490196,.8,.2980392156862745,.00784313725490196,.5490196078431373,.1764705882352941,.01568627450980392],Name:"Brewer Sequential Yellow-Orange-Brown (7)",NanColor:[.5490196078431373,.1764705882352941,.01568627450980392]},{IndexedColors:[1,1,.8313725490196079,.996078431372549,.8901960784313725,.5686274509803921,.996078431372549,.7686274509803922,.3098039215686275,.996078431372549,.6,.1607843137254902,.8509803921568627,.3725490196078431,.05490196078431372,.6,.203921568627451,.01568627450980392],Name:"Brewer Sequential Yellow-Orange-Brown (6)",NanColor:[.6,.203921568627451,.01568627450980392]},{IndexedColors:[1,1,.8313725490196079,.996078431372549,.8509803921568627,.5568627450980392,.996078431372549,.6,.1607843137254902,.8509803921568627,.3725490196078431,.05490196078431372,.6,.203921568627451,.01568627450980392],Name:"Brewer Sequential Yellow-Orange-Brown (5)",NanColor:[.6,.203921568627451,.01568627450980392]},{IndexedColors:[1,1,.8313725490196079,.996078431372549,.8509803921568627,.5568627450980392,.996078431372549,.6,.1607843137254902,.8,.2980392156862745,.00784313725490196],Name:"Brewer Sequential Yellow-Orange-Brown (4)",NanColor:[.8,.2980392156862745,.00784313725490196]},{IndexedColors:[1,.9686274509803922,.7372549019607844,.996078431372549,.7686274509803922,.3098039215686275,.8509803921568627,.3725490196078431,.05490196078431372],Name:"Brewer Sequential Yellow-Orange-Brown (3)",NanColor:[.8509803921568627,.3725490196078431,.05490196078431372]},{IndexedColors:[.9686274509803922,.9882352941176471,.9921568627450981,.8784313725490196,.9254901960784314,.9568627450980393,.7490196078431373,.8274509803921568,.9019607843137255,.6196078431372549,.7372549019607844,.8549019607843137,.5490196078431373,.5882352941176471,.7764705882352941,.5490196078431373,.4196078431372549,.6941176470588235,.5333333333333333,.2549019607843137,.615686274509804,.5058823529411764,.05882352941176471,.4862745098039216,.3019607843137255,0,.2941176470588235],Name:"Brewer Sequential Blue-Purple (9)",NanColor:[.3019607843137255,0,.2941176470588235]},{IndexedColors:[.9686274509803922,.9882352941176471,.9921568627450981,.8784313725490196,.9254901960784314,.9568627450980393,.7490196078431373,.8274509803921568,.9019607843137255,.6196078431372549,.7372549019607844,.8549019607843137,.5490196078431373,.5882352941176471,.7764705882352941,.5490196078431373,.4196078431372549,.6941176470588235,.5333333333333333,.2549019607843137,.615686274509804,.4313725490196079,.00392156862745098,.4196078431372549],Name:"Brewer Sequential Blue-Purple (8)",NanColor:[.4313725490196079,.00392156862745098,.4196078431372549]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.7490196078431373,.8274509803921568,.9019607843137255,.6196078431372549,.7372549019607844,.8549019607843137,.5490196078431373,.5882352941176471,.7764705882352941,.5490196078431373,.4196078431372549,.6941176470588235,.5333333333333333,.2549019607843137,.615686274509804,.4313725490196079,.00392156862745098,.4196078431372549],Name:"Brewer Sequential Blue-Purple (7)",NanColor:[.4313725490196079,.00392156862745098,.4196078431372549]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.7490196078431373,.8274509803921568,.9019607843137255,.6196078431372549,.7372549019607844,.8549019607843137,.5490196078431373,.5882352941176471,.7764705882352941,.5333333333333333,.3372549019607843,.6549019607843137,.5058823529411764,.05882352941176471,.4862745098039216],Name:"Brewer Sequential Blue-Purple (6)",NanColor:[.5058823529411764,.05882352941176471,.4862745098039216]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.7019607843137254,.803921568627451,.8901960784313725,.5490196078431373,.5882352941176471,.7764705882352941,.5333333333333333,.3372549019607843,.6549019607843137,.5058823529411764,.05882352941176471,.4862745098039216],Name:"Brewer Sequential Blue-Purple (5)",NanColor:[.5058823529411764,.05882352941176471,.4862745098039216]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.7019607843137254,.803921568627451,.8901960784313725,.5490196078431373,.5882352941176471,.7764705882352941,.5333333333333333,.2549019607843137,.615686274509804],Name:"Brewer Sequential Blue-Purple (4)",NanColor:[.5333333333333333,.2549019607843137,.615686274509804]},{IndexedColors:[.8784313725490196,.9254901960784314,.9568627450980393,.6196078431372549,.7372549019607844,.8549019607843137,.5333333333333333,.3372549019607843,.6549019607843137],Name:"Brewer Sequential Blue-Purple (3)",NanColor:[.5333333333333333,.3372549019607843,.6549019607843137]},{IndexedColors:[.4980392156862745,.788235294117647,.4980392156862745,.7450980392156863,.6823529411764706,.8313725490196079,.9921568627450981,.7529411764705882,.5254901960784314,1,1,.6,.2196078431372549,.4235294117647059,.6901960784313725,.9411764705882353,.00784313725490196,.4980392156862745,.7490196078431373,.3568627450980392,.09019607843137255,.4,.4,.4],Name:"Brewer Qualitative Accent",NanColor:[.4,.4,.4]},{IndexedColors:[.1058823529411765,.6196078431372549,.4666666666666667,.8509803921568627,.3725490196078431,.00784313725490196,.4588235294117647,.4392156862745098,.7019607843137254,.9058823529411765,.1607843137254902,.5411764705882353,.4,.6509803921568628,.1176470588235294,.9019607843137255,.6705882352941176,.00784313725490196,.6509803921568628,.4627450980392157,.1137254901960784,.4,.4,.4],Name:"Brewer Qualitative Dark2",NanColor:[.4,.4,.4]},{IndexedColors:[.4,.7607843137254902,.6470588235294118,.9882352941176471,.5529411764705883,.3843137254901961,.5529411764705883,.6274509803921569,.796078431372549,.9058823529411765,.5411764705882353,.7647058823529411,.6509803921568628,.8470588235294118,.3294117647058823,1,.8509803921568627,.1843137254901961,.8980392156862745,.7686274509803922,.5803921568627451,.7019607843137254,.7019607843137254,.7019607843137254],Name:"Brewer Qualitative Set2",NanColor:[.7019607843137254,.7019607843137254,.7019607843137254]},{IndexedColors:[.7019607843137254,.8862745098039215,.803921568627451,.9921568627450981,.803921568627451,.6745098039215687,.796078431372549,.8352941176470589,.9098039215686274,.9568627450980393,.792156862745098,.8941176470588236,.9019607843137255,.9607843137254902,.788235294117647,1,.9490196078431372,.6823529411764706,.9450980392156862,.8862745098039215,.8,.8,.8,.8],Name:"Brewer Qualitative Pastel2",NanColor:[.8,.8,.8]},{IndexedColors:[.984313725490196,.7058823529411765,.6823529411764706,.7019607843137254,.803921568627451,.8901960784313725,.8,.9215686274509803,.7725490196078432,.8705882352941177,.796078431372549,.8941176470588236,.996078431372549,.8509803921568627,.6509803921568628,1,1,.8,.8980392156862745,.8470588235294118,.7411764705882353,.9921568627450981,.8549019607843137,.9254901960784314,.9490196078431372,.9490196078431372,.9490196078431372],Name:"Brewer Qualitative Pastel1",NanColor:[.9490196078431372,.9490196078431372,.9490196078431372]},{IndexedColors:[.8941176470588236,.1019607843137255,.1098039215686274,.2156862745098039,.4941176470588236,.7215686274509804,.3019607843137255,.6862745098039216,.2901960784313726,.596078431372549,.3058823529411765,.6392156862745098,1,.4980392156862745,0,1,1,.2,.6509803921568628,.3372549019607843,.1568627450980392,.9686274509803922,.5058823529411764,.7490196078431373,.6,.6,.6],Name:"Brewer Qualitative Set1",NanColor:[.6,.6,.6]},{IndexedColors:[.6509803921568628,.807843137254902,.8901960784313725,.1215686274509804,.4705882352941176,.7058823529411765,.6980392156862745,.8745098039215686,.5411764705882353,.2,.6274509803921569,.1725490196078431,.984313725490196,.6039215686274509,.6,.8901960784313725,.1019607843137255,.1098039215686274,.9921568627450981,.7490196078431373,.4352941176470588,1,.4980392156862745,0,.792156862745098,.6980392156862745,.8392156862745098,.4156862745098039,.2392156862745098,.6039215686274509,1,1,.6],Name:"Brewer Qualitative Paired",NanColor:[1,1,.6]},{IndexedColors:[.5529411764705883,.8274509803921568,.7803921568627451,1,1,.7019607843137254,.7450980392156863,.7294117647058823,.8549019607843137,.984313725490196,.5019607843137255,.4470588235294118,.5019607843137255,.6941176470588235,.8274509803921568,.9921568627450981,.7058823529411765,.3843137254901961,.7019607843137254,.8705882352941177,.4117647058823529,.9882352941176471,.803921568627451,.8980392156862745,.8509803921568627,.8509803921568627,.8509803921568627,.7372549019607844,.5019607843137255,.7411764705882353,.8,.9215686274509803,.7725490196078432,1,.9294117647058824,.4352941176470588],Name:"Brewer Qualitative Set3",NanColor:[1,.9294117647058824,.4352941176470588]},{IndexedColors:[1,0,0,1,.862745,0,0,.695201,0],Name:"Traffic Lights",NanColor:[.803922,0,.803922]},{IndexedColors:[.908659,.604013,.581857,1,.862745,0,0,.695201,0],Name:"Traffic Lights For Deuteranopes",NanColor:[.803922,0,.803922]},{IndexedColors:[.4196078431372549,0,.07058823529411765,.9019607843137255,.9411764705882353,.0196078431372549,.01568627450980392,.6196078431372549,.00784313725490196],Name:"Traffic Lights For Deuteranopes 2",NanColor:[.803922,0,.803922]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Muted Blue-Green",NanColor:[.25,0,0],RGBPoints:[0,.109804,.27451,.301961,.02,.129412,.309804,.341176,.05,.14902,.341176,.380392,.1,.188235,.403922,.458824,.15,.227451,.447059,.521569,.2,.290196,.494118,.588235,.25,.368627,.552941,.670588,.3,.458824,.619608,.74902,.35,.588235,.713725,.85098,.4,.72549,.815686,.941176,.45,.831373,.882353,.980392,.475,.909804,.933333,1,.5,.980392,.984314,1,.5,.996078,1,.94902,.5,1,1,.980392,.5,.980392,.984314,1,.525,.972549,.988235,.890196,.55,.917647,.960784,.835294,.6,.835294,.921569,.772549,.65,.768627,.901961,.737255,.7,.670588,.831373,.654902,.75,.576471,.760784,.584314,.8,.498039,.678431,.521569,.85,.392157,.560784,.427451,.9,.294118,.45098,.333333,.95,.211765,.34902,.254902,1,.152941,.278431,.196078]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Green-Blue Asymmetric Divergent (62Blbc)",NanColor:[.25,0,0],RGBPoints:[0,.121569,.2,.145098,.05,.196078,.301961,.223529,.1,.258824,.4,.278431,.2,.341176,.54902,.341176,.25,.419608,.619608,.376471,.3,.545098,.701961,.392157,.35,.643137,.780392,.403922,.4,.729412,.819608,.45098,.45,.811765,.870588,.521569,.5,.898039,.909804,.564706,.55,.941176,.92549,.686275,.6,.960784,.94902,.776471,.64,1,1,1,.65,.890196,.988235,.972549,.7,.721569,.894118,.901961,.75,.631373,.823529,.839216,.8,.517647,.662745,.701961,.85,.384314,.494118,.54902,.9,.298039,.360784,.45098,.95,.223529,.25098,.34902,.99,.156863,.172549,.25098,1,.137255,.137255,.188235]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Asymmtrical Earth Tones (6_21b)",NanColor:[.25,0,0],RGBPoints:[0,.141176,.14902,.2,.05,.215686,.258824,.321569,.1,.243137,.368627,.380392,.15,.27451,.439216,.4,.2,.32549,.501961,.384314,.25,.403922,.6,.419608,.3,.486275,.701961,.454902,.35,.556863,.74902,.494118,.4,.670588,.8,.545098,.5,.854902,.901961,.631373,.55,.92549,.941176,.694118,.6,.960784,.94902,.776471,.65,.988235,.968627,.909804,.7,.839216,.815686,.772549,.75,.701961,.662745,.615686,.8,.6,.529412,.478431,.85,.501961,.403922,.360784,.9,.439216,.313725,.290196,1,.301961,.164706,.176471]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Yellow 15",NanColor:[.25,0,0],RGBPoints:[0,1,1,.988235,.002,1,1,.988235,.05,.984314,.988235,.843137,.1,.988235,.988235,.741176,.15,.980392,.968627,.654902,.2,.980392,.945098,.576471,.25,.968627,.905882,.486275,.3,.968627,.862745,.388235,.35,.960784,.803922,.286275,.4,.94902,.741176,.219608,.45,.941176,.678431,.14902,.5,.929412,.607843,.094118,.55,.921569,.545098,.054902,.6,.909804,.486275,.035294,.65,.890196,.411765,.019608,.7,.8,.305882,0,.75,.760784,.239216,0,.8,.678431,.180392,.011765,.85,.6,.121569,.023529,.9,.501961,.054902,.031373,.95,.4,.039216,.058824,1,.301961,.047059,.090196]},{ColorSpace:"Diverging",Name:"Magma (matplotlib)",NanColor:[0,1,0],Source:"https://github.com/BIDS/colormap/blob/master/colormaps.py",License:"CC0",Creator:"Nathaniel J. Smith & Stefan van der Walt",RGBPoints:[0,.001462,466e-6,.013866,.003922,.002258,.001295,.018331,.007843,.003279,.002305,.023708,.011765,.004512,.00349,.029965,.015686,.00595,.004843,.03713,.019608,.007588,.006356,.044973,.023529,.009426,.008022,.052844,.027451,.011465,.009828,.06075,.031373,.013708,.011771,.068667,.035294,.016156,.01384,.076603,.039216,.018815,.016026,.084584,.043137,.021692,.01832,.09261,.047059,.024792,.020715,.100676,.05098,.028123,.023201,.108787,.054902,.031696,.025765,.116965,.058824,.03552,.028397,.125209,.062745,.039608,.03109,.133515,.066667,.04383,.03383,.141886,.070588,.048062,.036607,.150327,.07451,.05232,.039407,.158841,.078431,.056615,.04216,.167446,.082353,.060949,.044794,.176129,.086275,.06533,.047318,.184892,.090196,.069764,.049726,.193735,.094118,.074257,.052017,.20266,.098039,.078815,.054184,.211667,.101961,.083446,.056225,.220755,.105882,.088155,.058133,.229922,.109804,.092949,.059904,.239164,.113725,.097833,.061531,.248477,.117647,.102815,.06301,.257854,.121569,.107899,.064335,.267289,.12549,.113094,.065492,.276784,.129412,.118405,.066479,.286321,.133333,.123833,.067295,.295879,.137255,.12938,.067935,.305443,.141176,.135053,.068391,.315,.145098,.140858,.068654,.324538,.14902,.146785,.068738,.334011,.152941,.152839,.068637,.343404,.156863,.159018,.068354,.352688,.160784,.165308,.067911,.361816,.164706,.171713,.067305,.370771,.168627,.178212,.066576,.379497,.172549,.184801,.065732,.387973,.176471,.19146,.064818,.396152,.180392,.198177,.063862,.404009,.184314,.204935,.062907,.411514,.188235,.211718,.061992,.418647,.192157,.218512,.061158,.425392,.196078,.225302,.060445,.431742,.2,.232077,.059889,.437695,.203922,.238826,.059517,.443256,.207843,.245543,.059352,.448436,.211765,.25222,.059415,.453248,.215686,.258857,.059706,.45771,.219608,.265447,.060237,.46184,.223529,.271994,.060994,.46566,.227451,.278493,.061978,.46919,.231373,.284951,.063168,.472451,.235294,.291366,.064553,.475462,.239216,.29774,.066117,.478243,.243137,.304081,.067835,.480812,.247059,.310382,.069702,.483186,.25098,.316654,.07169,.48538,.254902,.322899,.073782,.487408,.258824,.329114,.075972,.489287,.262745,.335308,.078236,.491024,.266667,.341482,.080564,.492631,.270588,.347636,.082946,.494121,.27451,.353773,.085373,.495501,.278431,.359898,.087831,.496778,.282353,.366012,.090314,.49796,.286275,.372116,.092816,.499053,.290196,.378211,.095332,.500067,.294118,.384299,.097855,.501002,.298039,.390384,.100379,.501864,.301961,.396467,.102902,.502658,.305882,.402548,.10542,.503386,.309804,.408629,.10793,.504052,.313725,.414709,.110431,.504662,.317647,.420791,.11292,.505215,.321569,.426877,.115395,.505714,.32549,.432967,.117855,.50616,.329412,.439062,.120298,.506555,.333333,.445163,.122724,.506901,.337255,.451271,.125132,.507198,.341176,.457386,.127522,.507448,.345098,.463508,.129893,.507652,.34902,.46964,.132245,.507809,.352941,.47578,.134577,.507921,.356863,.481929,.136891,.507989,.360784,.488088,.139186,.508011,.364706,.494258,.141462,.507988,.368627,.500438,.143719,.50792,.372549,.506629,.145958,.507806,.376471,.512831,.148179,.507648,.380392,.519045,.150383,.507443,.384314,.52527,.152569,.507192,.388235,.531507,.154739,.506895,.392157,.537755,.156894,.506551,.396078,.544015,.159033,.506159,.4,.550287,.161158,.505719,.403922,.556571,.163269,.50523,.407843,.562866,.165368,.504692,.411765,.569172,.167454,.504105,.415686,.57549,.16953,.503466,.419608,.581819,.171596,.502777,.423529,.588158,.173652,.502035,.427451,.594508,.175701,.501241,.431373,.600868,.177743,.500394,.435294,.607238,.179779,.499492,.439216,.613617,.181811,.498536,.443137,.620005,.18384,.497524,.447059,.626401,.185867,.496456,.45098,.632805,.187893,.495332,.454902,.639216,.189921,.49415,.458824,.645633,.191952,.49291,.462745,.652056,.193986,.491611,.466667,.658483,.196027,.490253,.470588,.664915,.198075,.488836,.47451,.671349,.200133,.487358,.478431,.677786,.202203,.485819,.482353,.684224,.204286,.484219,.486275,.690661,.206384,.482558,.490196,.697098,.208501,.480835,.494118,.703532,.210638,.479049,.498039,.709962,.212797,.477201,.501961,.716387,.214982,.47529,.505882,.722805,.217194,.473316,.509804,.729216,.219437,.471279,.513725,.735616,.221713,.46918,.517647,.742004,.224025,.467018,.521569,.748378,.226377,.464794,.52549,.754737,.228772,.462509,.529412,.761077,.231214,.460162,.533333,.767398,.233705,.457755,.537255,.773695,.236249,.455289,.541176,.779968,.238851,.452765,.545098,.786212,.241514,.450184,.54902,.792427,.244242,.447543,.552941,.798608,.24704,.444848,.556863,.804752,.249911,.442102,.560784,.810855,.252861,.439305,.564706,.816914,.255895,.436461,.568627,.822926,.259016,.433573,.572549,.828886,.262229,.430644,.576471,.834791,.26554,.427671,.580392,.840636,.268953,.424666,.584314,.846416,.272473,.421631,.588235,.852126,.276106,.418573,.592157,.857763,.279857,.415496,.596078,.86332,.283729,.412403,.6,.868793,.287728,.409303,.603922,.874176,.291859,.406205,.607843,.879464,.296125,.403118,.611765,.884651,.30053,.400047,.615686,.889731,.305079,.397002,.619608,.8947,.309773,.393995,.623529,.899552,.314616,.391037,.627451,.904281,.31961,.388137,.631373,.908884,.324755,.385308,.635294,.913354,.330052,.382563,.639216,.917689,.3355,.379915,.643137,.921884,.341098,.377376,.647059,.925937,.346844,.374959,.65098,.929845,.352734,.372677,.654902,.933606,.358764,.370541,.658824,.937221,.364929,.368567,.662745,.940687,.371224,.366762,.666667,.944006,.377643,.365136,.670588,.94718,.384178,.363701,.67451,.95021,.39082,.362468,.678431,.953099,.397563,.361438,.682353,.955849,.4044,.360619,.686275,.958464,.411324,.360014,.690196,.960949,.418323,.35963,.694118,.96331,.42539,.359469,.698039,.965549,.432519,.359529,.701961,.967671,.439703,.35981,.705882,.96968,.446936,.360311,.709804,.971582,.45421,.36103,.713725,.973381,.46152,.361965,.717647,.975082,.468861,.363111,.721569,.97669,.476226,.364466,.72549,.97821,.483612,.366025,.729412,.979645,.491014,.367783,.733333,.981,.498428,.369734,.737255,.982279,.505851,.371874,.741176,.983485,.51328,.374198,.745098,.984622,.520713,.376698,.74902,.985693,.528148,.379371,.752941,.9867,.535582,.38221,.756863,.987646,.543015,.38521,.760784,.988533,.550446,.388365,.764706,.989363,.557873,.391671,.768627,.990138,.565296,.395122,.772549,.990871,.572706,.398714,.776471,.991558,.580107,.402441,.780392,.992196,.587502,.406299,.784314,.992785,.594891,.410283,.788235,.993326,.602275,.41439,.792157,.993834,.609644,.418613,.796078,.994309,.616999,.42295,.8,.994738,.62435,.427397,.803922,.995122,.631696,.431951,.807843,.99548,.639027,.436607,.811765,.99581,.646344,.441361,.815686,.996096,.653659,.446213,.819608,.996341,.660969,.45116,.823529,.99658,.668256,.456192,.827451,.996775,.675541,.461314,.831373,.996925,.682828,.466526,.835294,.997077,.690088,.471811,.839216,.997186,.697349,.477182,.843137,.997254,.704611,.482635,.847059,.997325,.711848,.488154,.85098,.997351,.719089,.493755,.854902,.997351,.726324,.499428,.858824,.997341,.733545,.505167,.862745,.997285,.740772,.510983,.866667,.997228,.747981,.516859,.870588,.997138,.75519,.522806,.87451,.997019,.762398,.528821,.878431,.996898,.769591,.534892,.882353,.996727,.776795,.541039,.886275,.996571,.783977,.547233,.890196,.996369,.791167,.553499,.894118,.996162,.798348,.55982,.898039,.995932,.805527,.566202,.901961,.99568,.812706,.572645,.905882,.995424,.819875,.57914,.909804,.995131,.827052,.585701,.913725,.994851,.834213,.592307,.917647,.994524,.841387,.598983,.921569,.994222,.84854,.605696,.92549,.993866,.855711,.612482,.929412,.993545,.862859,.619299,.933333,.99317,.870024,.626189,.937255,.992831,.877168,.633109,.941176,.99244,.88433,.640099,.945098,.992089,.89147,.647116,.94902,.991688,.898627,.654202,.952941,.991332,.905763,.661309,.956863,.99093,.912915,.668481,.960784,.99057,.920049,.675675,.964706,.990175,.927196,.682926,.968627,.989815,.934329,.690198,.972549,.989434,.94147,.697519,.976471,.989077,.948604,.704863,.980392,.988717,.955742,.712242,.984314,.988367,.962878,.719649,.988235,.988033,.970012,.727077,.992157,.987691,.977154,.734536,.996078,.987387,.984288,.742002,1,.987053,.991438,.749504]},{ColorSpace:"Diverging",Name:"Inferno (matplotlib)",NanColor:[0,1,0],Source:"https://github.com/BIDS/colormap/blob/master/colormaps.py",License:"CC0",Creator:"Nathaniel J. Smith & Stefan van der Walt",RGBPoints:[0,.001462,466e-6,.013866,.003922,.002267,.00127,.01857,.007843,.003299,.002249,.024239,.011765,.004547,.003392,.030909,.015686,.006006,.004692,.038558,.019608,.007676,.006136,.046836,.023529,.009561,.007713,.055143,.027451,.011663,.009417,.06346,.031373,.013995,.011225,.071862,.035294,.016561,.013136,.080282,.039216,.019373,.015133,.088767,.043137,.022447,.017199,.097327,.047059,.025793,.019331,.10593,.05098,.029432,.021503,.114621,.054902,.033385,.023702,.123397,.058824,.037668,.025921,.132232,.062745,.042253,.028139,.141141,.066667,.046915,.030324,.150164,.070588,.051644,.032474,.159254,.07451,.056449,.034569,.168414,.078431,.06134,.03659,.177642,.082353,.066331,.038504,.186962,.086275,.071429,.040294,.196354,.090196,.076637,.041905,.205799,.094118,.081962,.043328,.215289,.098039,.087411,.044556,.224813,.101961,.09299,.045583,.234358,.105882,.098702,.046402,.243904,.109804,.104551,.047008,.25343,.113725,.110536,.047399,.262912,.117647,.116656,.047574,.272321,.121569,.122908,.047536,.281624,.12549,.129285,.047293,.290788,.129412,.135778,.046856,.299776,.133333,.142378,.046242,.308553,.137255,.149073,.045468,.317085,.141176,.15585,.044559,.325338,.145098,.162689,.043554,.333277,.14902,.169575,.042489,.340874,.152941,.176493,.041402,.348111,.156863,.183429,.040329,.354971,.160784,.190367,.039309,.361447,.164706,.197297,.0384,.367535,.168627,.204209,.037632,.373238,.172549,.211095,.03703,.378563,.176471,.217949,.036615,.383522,.180392,.224763,.036405,.388129,.184314,.231538,.036405,.3924,.188235,.238273,.036621,.396353,.192157,.244967,.037055,.400007,.196078,.25162,.037705,.403378,.2,.258234,.038571,.406485,.203922,.26481,.039647,.409345,.207843,.271347,.040922,.411976,.211765,.27785,.042353,.414392,.215686,.284321,.043933,.416608,.219608,.290763,.045644,.418637,.223529,.297178,.04747,.420491,.227451,.303568,.049396,.422182,.231373,.309935,.051407,.423721,.235294,.316282,.05349,.425116,.239216,.32261,.055634,.426377,.243137,.328921,.057827,.427511,.247059,.335217,.06006,.428524,.25098,.3415,.062325,.429425,.254902,.347771,.064616,.430217,.258824,.354032,.066925,.430906,.262745,.360284,.069247,.431497,.266667,.366529,.071579,.431994,.270588,.372768,.073915,.4324,.27451,.379001,.076253,.432719,.278431,.385228,.078591,.432955,.282353,.391453,.080927,.433109,.286275,.397674,.083257,.433183,.290196,.403894,.08558,.433179,.294118,.410113,.087896,.433098,.298039,.416331,.090203,.432943,.301961,.422549,.092501,.432714,.305882,.428768,.09479,.432412,.309804,.434987,.097069,.432039,.313725,.441207,.099338,.431594,.317647,.447428,.101597,.43108,.321569,.453651,.103848,.430498,.32549,.459875,.106089,.429846,.329412,.4661,.108322,.429125,.333333,.472328,.110547,.428334,.337255,.478558,.112764,.427475,.341176,.484789,.114974,.426548,.345098,.491022,.117179,.425552,.34902,.497257,.119379,.424488,.352941,.503493,.121575,.423356,.356863,.50973,.123769,.422156,.360784,.515967,.12596,.420887,.364706,.522206,.12815,.419549,.368627,.528444,.130341,.418142,.372549,.534683,.132534,.416667,.376471,.54092,.134729,.415123,.380392,.547157,.136929,.413511,.384314,.553392,.139134,.411829,.388235,.559624,.141346,.410078,.392157,.565854,.143567,.408258,.396078,.572081,.145797,.406369,.4,.578304,.148039,.404411,.403922,.584521,.150294,.402385,.407843,.590734,.152563,.40029,.411765,.59694,.154848,.398125,.415686,.603139,.157151,.395891,.419608,.60933,.159474,.393589,.423529,.615513,.161817,.391219,.427451,.621685,.164184,.388781,.431373,.627847,.166575,.386276,.435294,.633998,.168992,.383704,.439216,.640135,.171438,.381065,.443137,.64626,.173914,.378359,.447059,.652369,.176421,.375586,.45098,.658463,.178962,.372748,.454902,.66454,.181539,.369846,.458824,.670599,.184153,.366879,.462745,.676638,.186807,.363849,.466667,.682656,.189501,.360757,.470588,.688653,.192239,.357603,.47451,.694627,.195021,.354388,.478431,.700576,.197851,.351113,.482353,.7065,.200728,.347777,.486275,.712396,.203656,.344383,.490196,.718264,.206636,.340931,.494118,.724103,.20967,.337424,.498039,.729909,.212759,.333861,.501961,.735683,.215906,.330245,.505882,.741423,.219112,.326576,.509804,.747127,.222378,.322856,.513725,.752794,.225706,.319085,.517647,.758422,.229097,.315266,.521569,.76401,.232554,.311399,.52549,.769556,.236077,.307485,.529412,.775059,.239667,.303526,.533333,.780517,.243327,.299523,.537255,.785929,.247056,.295477,.541176,.791293,.250856,.29139,.545098,.796607,.254728,.287264,.54902,.801871,.258674,.283099,.552941,.807082,.262692,.278898,.556863,.812239,.266786,.274661,.560784,.817341,.270954,.27039,.564706,.822386,.275197,.266085,.568627,.827372,.279517,.26175,.572549,.832299,.283913,.257383,.576471,.837165,.288385,.252988,.580392,.841969,.292933,.248564,.584314,.846709,.297559,.244113,.588235,.851384,.30226,.239636,.592157,.855992,.307038,.235133,.596078,.860533,.311892,.230606,.6,.865006,.316822,.226055,.603922,.869409,.321827,.221482,.607843,.873741,.326906,.216886,.611765,.878001,.33206,.212268,.615686,.882188,.337287,.207628,.619608,.886302,.342586,.202968,.623529,.890341,.347957,.198286,.627451,.894305,.353399,.193584,.631373,.898192,.358911,.18886,.635294,.902003,.364492,.184116,.639216,.905735,.37014,.17935,.643137,.90939,.375856,.174563,.647059,.912966,.381636,.169755,.65098,.916462,.387481,.164924,.654902,.919879,.393389,.16007,.658824,.923215,.399359,.155193,.662745,.92647,.405389,.150292,.666667,.929644,.411479,.145367,.670588,.932737,.417627,.140417,.67451,.935747,.423831,.13544,.678431,.938675,.430091,.130438,.682353,.941521,.436405,.125409,.686275,.944285,.442772,.120354,.690196,.946965,.449191,.115272,.694118,.949562,.45566,.110164,.698039,.952075,.462178,.105031,.701961,.954506,.468744,.099874,.705882,.956852,.475356,.094695,.709804,.959114,.482014,.089499,.713725,.961293,.488716,.084289,.717647,.963387,.495462,.079073,.721569,.965397,.502249,.073859,.72549,.967322,.509078,.068659,.729412,.969163,.515946,.063488,.733333,.970919,.522853,.058367,.737255,.97259,.529798,.053324,.741176,.974176,.53678,.048392,.745098,.975677,.543798,.043618,.74902,.977092,.55085,.03905,.752941,.978422,.557937,.034931,.756863,.979666,.565057,.031409,.760784,.980824,.572209,.028508,.764706,.981895,.579392,.02625,.768627,.982881,.586606,.024661,.772549,.983779,.593849,.02377,.776471,.984591,.601122,.023606,.780392,.985315,.608422,.024202,.784314,.985952,.61575,.025592,.788235,.986502,.623105,.027814,.792157,.986964,.630485,.030908,.796078,.987337,.63789,.034916,.8,.987622,.64532,.039886,.803922,.987819,.652773,.045581,.807843,.987926,.66025,.05175,.811765,.987945,.667748,.058329,.815686,.987874,.675267,.065257,.819608,.987714,.682807,.072489,.823529,.987464,.690366,.07999,.827451,.987124,.697944,.087731,.831373,.986694,.70554,.095694,.835294,.986175,.713153,.103863,.839216,.985566,.720782,.112229,.843137,.984865,.728427,.120785,.847059,.984075,.736087,.129527,.85098,.983196,.743758,.138453,.854902,.982228,.751442,.147565,.858824,.981173,.759135,.156863,.862745,.980032,.766837,.166353,.866667,.978806,.774545,.176037,.870588,.977497,.782258,.185923,.87451,.976108,.789974,.196018,.878431,.974638,.797692,.206332,.882353,.973088,.805409,.216877,.886275,.971468,.813122,.227658,.890196,.969783,.820825,.238686,.894118,.968041,.828515,.249972,.898039,.966243,.836191,.261534,.901961,.964394,.843848,.273391,.905882,.962517,.851476,.285546,.909804,.960626,.859069,.29801,.913725,.95872,.866624,.31082,.917647,.956834,.874129,.323974,.921569,.954997,.881569,.337475,.92549,.953215,.888942,.351369,.929412,.951546,.896226,.365627,.933333,.950018,.903409,.380271,.937255,.948683,.910473,.395289,.941176,.947594,.917399,.410665,.945098,.946809,.924168,.426373,.94902,.946392,.930761,.442367,.952941,.946403,.937159,.458592,.956863,.946903,.943348,.47497,.960784,.947937,.949318,.491426,.964706,.949545,.955063,.50786,.968627,.95174,.960587,.524203,.972549,.954529,.965896,.540361,.976471,.957896,.971003,.556275,.980392,.961812,.975924,.571925,.984314,.966249,.980678,.587206,.988235,.971162,.985282,.602154,.992157,.976511,.989753,.61676,.996078,.982257,.994109,.631017,1,.988362,.998364,.644924]},{ColorSpace:"Diverging",Name:"Plasma (matplotlib)",NanColor:[0,1,0],Source:"https://github.com/BIDS/colormap/blob/master/colormaps.py",License:"CC0",Creator:"Nathaniel J. Smith & Stefan van der Walt",RGBPoints:[0,.050383,.029803,.527975,.003922,.063536,.028426,.533124,.007843,.075353,.027206,.538007,.011765,.086222,.026125,.542658,.015686,.096379,.025165,.547103,.019608,.10598,.024309,.551368,.023529,.115124,.023556,.555468,.027451,.123903,.022878,.559423,.031373,.132381,.022258,.56325,.035294,.140603,.021687,.566959,.039216,.148607,.021154,.570562,.043137,.156421,.020651,.574065,.047059,.16407,.020171,.577478,.05098,.171574,.019706,.580806,.054902,.17895,.019252,.584054,.058824,.186213,.018803,.587228,.062745,.193374,.018354,.59033,.066667,.200445,.017902,.593364,.070588,.207435,.017442,.596333,.07451,.21435,.016973,.599239,.078431,.221197,.016497,.602083,.082353,.227983,.016007,.604867,.086275,.234715,.015502,.607592,.090196,.241396,.014979,.610259,.094118,.248032,.014439,.612868,.098039,.254627,.013882,.615419,.101961,.261183,.013308,.617911,.105882,.267703,.012716,.620346,.109804,.274191,.012109,.622722,.113725,.280648,.011488,.625038,.117647,.287076,.010855,.627295,.121569,.293478,.010213,.62949,.12549,.299855,.009561,.631624,.129412,.30621,.008902,.633694,.133333,.312543,.008239,.6357,.137255,.318856,.007576,.63764,.141176,.32515,.006915,.639512,.145098,.331426,.006261,.641316,.14902,.337683,.005618,.643049,.152941,.343925,.004991,.64471,.156863,.35015,.004382,.646298,.160784,.356359,.003798,.64781,.164706,.362553,.003243,.649245,.168627,.368733,.002724,.650601,.172549,.374897,.002245,.651876,.176471,.381047,.001814,.653068,.180392,.387183,.001434,.654177,.184314,.393304,.001114,.655199,.188235,.399411,859e-6,.656133,.192157,.405503,678e-6,.656977,.196078,.41158,577e-6,.65773,.2,.417642,564e-6,.65839,.203922,.423689,646e-6,.658956,.207843,.429719,831e-6,.659425,.211765,.435734,.001127,.659797,.215686,.441732,.00154,.660069,.219608,.447714,.00208,.66024,.223529,.453677,.002755,.66031,.227451,.459623,.003574,.660277,.231373,.46555,.004545,.660139,.235294,.471457,.005678,.659897,.239216,.477344,.00698,.659549,.243137,.48321,.00846,.659095,.247059,.489055,.010127,.658534,.25098,.494877,.01199,.657865,.254902,.500678,.014055,.657088,.258824,.506454,.016333,.656202,.262745,.512206,.018833,.655209,.266667,.517933,.021563,.654109,.270588,.523633,.024532,.652901,.27451,.529306,.027747,.651586,.278431,.534952,.031217,.650165,.282353,.54057,.03495,.64864,.286275,.546157,.038954,.64701,.290196,.551715,.043136,.645277,.294118,.557243,.047331,.643443,.298039,.562738,.051545,.641509,.301961,.568201,.055778,.639477,.305882,.573632,.060028,.637349,.309804,.579029,.064296,.635126,.313725,.584391,.068579,.632812,.317647,.589719,.072878,.630408,.321569,.595011,.07719,.627917,.32549,.600266,.081516,.625342,.329412,.605485,.085854,.622686,.333333,.610667,.090204,.619951,.337255,.615812,.094564,.61714,.341176,.620919,.098934,.614257,.345098,.625987,.103312,.611305,.34902,.631017,.107699,.608287,.352941,.636008,.112092,.605205,.356863,.640959,.116492,.602065,.360784,.645872,.120898,.598867,.364706,.650746,.125309,.595617,.368627,.65558,.129725,.592317,.372549,.660374,.134144,.588971,.376471,.665129,.138566,.585582,.380392,.669845,.142992,.582154,.384314,.674522,.147419,.578688,.388235,.67916,.151848,.575189,.392157,.683758,.156278,.57166,.396078,.688318,.160709,.568103,.4,.69284,.165141,.564522,.403922,.697324,.169573,.560919,.407843,.701769,.174005,.557296,.411765,.706178,.178437,.553657,.415686,.710549,.182868,.550004,.419608,.714883,.187299,.546338,.423529,.719181,.191729,.542663,.427451,.723444,.196158,.538981,.431373,.72767,.200586,.535293,.435294,.731862,.205013,.531601,.439216,.736019,.209439,.527908,.443137,.740143,.213864,.524216,.447059,.744232,.218288,.520524,.45098,.748289,.222711,.516834,.454902,.752312,.227133,.513149,.458824,.756304,.231555,.509468,.462745,.760264,.235976,.505794,.466667,.764193,.240396,.502126,.470588,.76809,.244817,.498465,.47451,.771958,.249237,.494813,.478431,.775796,.253658,.491171,.482353,.779604,.258078,.487539,.486275,.783383,.2625,.483918,.490196,.787133,.266922,.480307,.494118,.790855,.271345,.476706,.498039,.794549,.27577,.473117,.501961,.798216,.280197,.469538,.505882,.801855,.284626,.465971,.509804,.805467,.289057,.462415,.513725,.809052,.293491,.45887,.517647,.812612,.297928,.455338,.521569,.816144,.302368,.451816,.52549,.819651,.306812,.448306,.529412,.823132,.311261,.444806,.533333,.826588,.315714,.441316,.537255,.830018,.320172,.437836,.541176,.833422,.324635,.434366,.545098,.836801,.329105,.430905,.54902,.840155,.33358,.427455,.552941,.843484,.338062,.424013,.556863,.846788,.342551,.420579,.560784,.850066,.347048,.417153,.564706,.853319,.351553,.413734,.568627,.856547,.356066,.410322,.572549,.85975,.360588,.406917,.576471,.862927,.365119,.403519,.580392,.866078,.36966,.400126,.584314,.869203,.374212,.396738,.588235,.872303,.378774,.393355,.592157,.875376,.383347,.389976,.596078,.878423,.387932,.3866,.6,.881443,.392529,.383229,.603922,.884436,.397139,.37986,.607843,.887402,.401762,.376494,.611765,.89034,.406398,.37313,.615686,.89325,.411048,.369768,.619608,.896131,.415712,.366407,.623529,.898984,.420392,.363047,.627451,.901807,.425087,.359688,.631373,.904601,.429797,.356329,.635294,.907365,.434524,.35297,.639216,.910098,.439268,.34961,.643137,.9128,.444029,.346251,.647059,.915471,.448807,.34289,.65098,.918109,.453603,.339529,.654902,.920714,.458417,.336166,.658824,.923287,.463251,.332801,.662745,.925825,.468103,.329435,.666667,.928329,.472975,.326067,.670588,.930798,.477867,.322697,.67451,.933232,.48278,.319325,.678431,.93563,.487712,.315952,.682353,.93799,.492667,.312575,.686275,.940313,.497642,.309197,.690196,.942598,.502639,.305816,.694118,.944844,.507658,.302433,.698039,.947051,.512699,.299049,.701961,.949217,.517763,.295662,.705882,.951344,.52285,.292275,.709804,.953428,.52796,.288883,.713725,.95547,.533093,.28549,.717647,.957469,.53825,.282096,.721569,.959424,.543431,.278701,.72549,.961336,.548636,.275305,.729412,.963203,.553865,.271909,.733333,.965024,.559118,.268513,.737255,.966798,.564396,.265118,.741176,.968526,.5697,.261721,.745098,.970205,.575028,.258325,.74902,.971835,.580382,.254931,.752941,.973416,.585761,.25154,.756863,.974947,.591165,.248151,.760784,.976428,.596595,.244767,.764706,.977856,.602051,.241387,.768627,.979233,.607532,.238013,.772549,.980556,.613039,.234646,.776471,.981826,.618572,.231287,.780392,.983041,.624131,.227937,.784314,.984199,.629718,.224595,.788235,.985301,.63533,.221265,.792157,.986345,.640969,.217948,.796078,.987332,.646633,.214648,.8,.98826,.652325,.211364,.803922,.989128,.658043,.2081,.807843,.989935,.663787,.204859,.811765,.990681,.669558,.201642,.815686,.991365,.675355,.198453,.819608,.991985,.681179,.195295,.823529,.992541,.68703,.19217,.827451,.993032,.692907,.189084,.831373,.993456,.69881,.186041,.835294,.993814,.704741,.183043,.839216,.994103,.710698,.180097,.843137,.994324,.716681,.177208,.847059,.994474,.722691,.174381,.85098,.994553,.728728,.171622,.854902,.994561,.734791,.168938,.858824,.994495,.74088,.166335,.862745,.994355,.746995,.163821,.866667,.994141,.753137,.161404,.870588,.993851,.759304,.159092,.87451,.993482,.765499,.156891,.878431,.993033,.77172,.154808,.882353,.992505,.777967,.152855,.886275,.991897,.784239,.151042,.890196,.991209,.790537,.149377,.894118,.990439,.796859,.14787,.898039,.989587,.803205,.146529,.901961,.988648,.809579,.145357,.905882,.987621,.815978,.144363,.909804,.986509,.822401,.143557,.913725,.985314,.828846,.142945,.917647,.984031,.835315,.142528,.921569,.982653,.841812,.142303,.92549,.98119,.848329,.142279,.929412,.979644,.854866,.142453,.933333,.977995,.861432,.142808,.937255,.976265,.868016,.143351,.941176,.974443,.874622,.144061,.945098,.97253,.88125,.144923,.94902,.970533,.887896,.145919,.952941,.968443,.894564,.147014,.956863,.966271,.901249,.14818,.960784,.964021,.90795,.14937,.964706,.961681,.914672,.15052,.968627,.959276,.921407,.151566,.972549,.956808,.928152,.152409,.976471,.954287,.934908,.152921,.980392,.951726,.941671,.152925,.984314,.949151,.948435,.152178,.988235,.946602,.95519,.150328,.992157,.944152,.961916,.146861,.996078,.941896,.96859,.140956,1,.940015,.975158,.131326]},{ColorSpace:"Diverging",Name:"Viridis (matplotlib)",NanColor:[1,0,0],Source:"https://github.com/BIDS/colormap/blob/master/colormaps.py",License:"CC0",Creator:"Eric Firing",RGBPoints:[0,.267004,.004874,.329415,.003922,.26851,.009605,.335427,.007843,.269944,.014625,.341379,.011765,.271305,.019942,.347269,.015686,.272594,.025563,.353093,.019608,.273809,.031497,.358853,.023529,.274952,.037752,.364543,.027451,.276022,.044167,.370164,.031373,.277018,.050344,.375715,.035294,.277941,.056324,.381191,.039216,.278791,.062145,.386592,.043137,.279566,.067836,.391917,.047059,.280267,.073417,.397163,.05098,.280894,.078907,.402329,.054902,.281446,.08432,.407414,.058824,.281924,.089666,.412415,.062745,.282327,.094955,.417331,.066667,.282656,.100196,.42216,.070588,.28291,.105393,.426902,.07451,.283091,.110553,.431554,.078431,.283197,.11568,.436115,.082353,.283229,.120777,.440584,.086275,.283187,.125848,.44496,.090196,.283072,.130895,.449241,.094118,.282884,.13592,.453427,.098039,.282623,.140926,.457517,.101961,.28229,.145912,.46151,.105882,.281887,.150881,.465405,.109804,.281412,.155834,.469201,.113725,.280868,.160771,.472899,.117647,.280255,.165693,.476498,.121569,.279574,.170599,.479997,.12549,.278826,.17549,.483397,.129412,.278012,.180367,.486697,.133333,.277134,.185228,.489898,.137255,.276194,.190074,.493001,.141176,.275191,.194905,.496005,.145098,.274128,.199721,.498911,.14902,.273006,.20452,.501721,.152941,.271828,.209303,.504434,.156863,.270595,.214069,.507052,.160784,.269308,.218818,.509577,.164706,.267968,.223549,.512008,.168627,.26658,.228262,.514349,.172549,.265145,.232956,.516599,.176471,.263663,.237631,.518762,.180392,.262138,.242286,.520837,.184314,.260571,.246922,.522828,.188235,.258965,.251537,.524736,.192157,.257322,.25613,.526563,.196078,.255645,.260703,.528312,.2,.253935,.265254,.529983,.203922,.252194,.269783,.531579,.207843,.250425,.27429,.533103,.211765,.248629,.278775,.534556,.215686,.246811,.283237,.535941,.219608,.244972,.287675,.53726,.223529,.243113,.292092,.538516,.227451,.241237,.296485,.539709,.231373,.239346,.300855,.540844,.235294,.237441,.305202,.541921,.239216,.235526,.309527,.542944,.243137,.233603,.313828,.543914,.247059,.231674,.318106,.544834,.25098,.229739,.322361,.545706,.254902,.227802,.326594,.546532,.258824,.225863,.330805,.547314,.262745,.223925,.334994,.548053,.266667,.221989,.339161,.548752,.270588,.220057,.343307,.549413,.27451,.21813,.347432,.550038,.278431,.21621,.351535,.550627,.282353,.214298,.355619,.551184,.286275,.212395,.359683,.55171,.290196,.210503,.363727,.552206,.294118,.208623,.367752,.552675,.298039,.206756,.371758,.553117,.301961,.204903,.375746,.553533,.305882,.203063,.379716,.553925,.309804,.201239,.38367,.554294,.313725,.19943,.387607,.554642,.317647,.197636,.391528,.554969,.321569,.19586,.395433,.555276,.32549,.1941,.399323,.555565,.329412,.192357,.403199,.555836,.333333,.190631,.407061,.556089,.337255,.188923,.41091,.556326,.341176,.187231,.414746,.556547,.345098,.185556,.41857,.556753,.34902,.183898,.422383,.556944,.352941,.182256,.426184,.55712,.356863,.180629,.429975,.557282,.360784,.179019,.433756,.55743,.364706,.177423,.437527,.557565,.368627,.175841,.44129,.557685,.372549,.174274,.445044,.557792,.376471,.172719,.448791,.557885,.380392,.171176,.45253,.557965,.384314,.169646,.456262,.55803,.388235,.168126,.459988,.558082,.392157,.166617,.463708,.558119,.396078,.165117,.467423,.558141,.4,.163625,.471133,.558148,.403922,.162142,.474838,.55814,.407843,.160665,.47854,.558115,.411765,.159194,.482237,.558073,.415686,.157729,.485932,.558013,.419608,.15627,.489624,.557936,.423529,.154815,.493313,.55784,.427451,.153364,.497,.557724,.431373,.151918,.500685,.557587,.435294,.150476,.504369,.55743,.439216,.149039,.508051,.55725,.443137,.147607,.511733,.557049,.447059,.14618,.515413,.556823,.45098,.144759,.519093,.556572,.454902,.143343,.522773,.556295,.458824,.141935,.526453,.555991,.462745,.140536,.530132,.555659,.466667,.139147,.533812,.555298,.470588,.13777,.537492,.554906,.47451,.136408,.541173,.554483,.478431,.135066,.544853,.554029,.482353,.133743,.548535,.553541,.486275,.132444,.552216,.553018,.490196,.131172,.555899,.552459,.494118,.129933,.559582,.551864,.498039,.128729,.563265,.551229,.501961,.127568,.566949,.550556,.505882,.126453,.570633,.549841,.509804,.125394,.574318,.549086,.513725,.124395,.578002,.548287,.517647,.123463,.581687,.547445,.521569,.122606,.585371,.546557,.52549,.121831,.589055,.545623,.529412,.121148,.592739,.544641,.533333,.120565,.596422,.543611,.537255,.120092,.600104,.54253,.541176,.119738,.603785,.5414,.545098,.119512,.607464,.540218,.54902,.119423,.611141,.538982,.552941,.119483,.614817,.537692,.556863,.119699,.61849,.536347,.560784,.120081,.622161,.534946,.564706,.120638,.625828,.533488,.568627,.12138,.629492,.531973,.572549,.122312,.633153,.530398,.576471,.123444,.636809,.528763,.580392,.12478,.640461,.527068,.584314,.126326,.644107,.525311,.588235,.128087,.647749,.523491,.592157,.130067,.651384,.521608,.596078,.132268,.655014,.519661,.6,.134692,.658636,.517649,.603922,.137339,.662252,.515571,.607843,.14021,.665859,.513427,.611765,.143303,.669459,.511215,.615686,.146616,.67305,.508936,.619608,.150148,.676631,.506589,.623529,.153894,.680203,.504172,.627451,.157851,.683765,.501686,.631373,.162016,.687316,.499129,.635294,.166383,.690856,.496502,.639216,.170948,.694384,.493803,.643137,.175707,.6979,.491033,.647059,.180653,.701402,.488189,.65098,.185783,.704891,.485273,.654902,.19109,.708366,.482284,.658824,.196571,.711827,.479221,.662745,.202219,.715272,.476084,.666667,.20803,.718701,.472873,.670588,.214,.722114,.469588,.67451,.220124,.725509,.466226,.678431,.226397,.728888,.462789,.682353,.232815,.732247,.459277,.686275,.239374,.735588,.455688,.690196,.24607,.73891,.452024,.694118,.252899,.742211,.448284,.698039,.259857,.745492,.444467,.701961,.266941,.748751,.440573,.705882,.274149,.751988,.436601,.709804,.281477,.755203,.432552,.713725,.288921,.758394,.428426,.717647,.296479,.761561,.424223,.721569,.304148,.764704,.419943,.72549,.311925,.767822,.415586,.729412,.319809,.770914,.411152,.733333,.327796,.77398,.40664,.737255,.335885,.777018,.402049,.741176,.344074,.780029,.397381,.745098,.35236,.783011,.392636,.74902,.360741,.785964,.387814,.752941,.369214,.788888,.382914,.756863,.377779,.791781,.377939,.760784,.386433,.794644,.372886,.764706,.395174,.797475,.367757,.768627,.404001,.800275,.362552,.772549,.412913,.803041,.357269,.776471,.421908,.805774,.35191,.780392,.430983,.808473,.346476,.784314,.440137,.811138,.340967,.788235,.449368,.813768,.335384,.792157,.458674,.816363,.329727,.796078,.468053,.818921,.323998,.8,.477504,.821444,.318195,.803922,.487026,.823929,.312321,.807843,.496615,.826376,.306377,.811765,.506271,.828786,.300362,.815686,.515992,.831158,.294279,.819608,.525776,.833491,.288127,.823529,.535621,.835785,.281908,.827451,.545524,.838039,.275626,.831373,.555484,.840254,.269281,.835294,.565498,.84243,.262877,.839216,.575563,.844566,.256415,.843137,.585678,.846661,.249897,.847059,.595839,.848717,.243329,.85098,.606045,.850733,.236712,.854902,.616293,.852709,.230052,.858824,.626579,.854645,.223353,.862745,.636902,.856542,.21662,.866667,.647257,.8584,.209861,.870588,.657642,.860219,.203082,.87451,.668054,.861999,.196293,.878431,.678489,.863742,.189503,.882353,.688944,.865448,.182725,.886275,.699415,.867117,.175971,.890196,.709898,.868751,.169257,.894118,.720391,.87035,.162603,.898039,.730889,.871916,.156029,.901961,.741388,.873449,.149561,.905882,.751884,.874951,.143228,.909804,.762373,.876424,.137064,.913725,.772852,.877868,.131109,.917647,.783315,.879285,.125405,.921569,.79376,.880678,.120005,.92549,.804182,.882046,.114965,.929412,.814576,.883393,.110347,.933333,.82494,.88472,.106217,.937255,.83527,.886029,.102646,.941176,.845561,.887322,.099702,.945098,.85581,.888601,.097452,.94902,.866013,.889868,.095953,.952941,.876168,.891125,.09525,.956863,.886271,.892374,.095374,.960784,.89632,.893616,.096335,.964706,.906311,.894855,.098125,.968627,.916242,.896091,.100717,.972549,.926106,.89733,.104071,.976471,.935904,.89857,.108131,.980392,.945636,.899815,.112838,.984314,.9553,.901065,.118128,.988235,.964894,.902323,.123941,.992157,.974417,.90359,.130215,.996078,.983868,.904867,.136897,1,.993248,.906157,.143936]},{ShowIndexedColorActiveValues:1,IndexedColors:[.07,.5,.7,1,1,1,.85,1,1,.8,.5,1,.76,1,0,1,.71,.71,.5,.5,.5,.05,.05,1,1,.05,.05,.7,1,1,.7,.89,.96,.67,.36,.95,.54,1,0,.75,.65,.65,.5,.6,.6,1,.5,0,1,1,.19,.12,.94,.12,.5,.82,.89,.56,.25,.83,.24,1,0,.9,.9,.9,.75,.76,.78,.65,.65,.67,.54,.6,.78,.61,.48,.78,.5,.48,.78,.44,.48,.78,.36,.48,.76,1,.48,.38,.49,.5,.69,.76,.56,.56,.4,.56,.56,.74,.5,.89,1,.63,0,.65,.16,.16,.36,.72,.82,.44,.18,.69,0,1,0,.58,1,1,.58,.88,.88,.45,.76,.79,.33,.71,.71,.23,.62,.62,.14,.56,.56,.04,.49,.55,0,.41,.52,.88,.88,1,1,.85,.56,.65,.46,.45,.4,.5,.5,.62,.39,.71,.83,.48,0,.58,0,.58,.26,.62,.69,.34,.09,.56,0,.79,0,.44,.83,1,1,1,.78,.85,1,.78,.78,1,.78,.64,1,.78,.56,1,.78,.38,1,.78,.27,1,.78,.19,1,.78,.12,1,.78,0,1,.61,0,.9,.46,0,.83,.32,0,.75,.22,0,.67,.14,.3,.76,1,.3,.65,1,.13,.58,.84,.15,.49,.67,.15,.4,.59,.09,.33,.53,.96,.93,.82,.8,.82,.12,.71,.71,.76,.65,.33,.3,.34,.35,.38,.62,.31,.71,.67,.36,0,.46,.31,.27,.26,.51,.59,.26,0,.4,0,.49,0,.44,.67,.98,0,.73,1,0,.63,1,0,.56,1,0,.5,1,0,.42,1,.33,.36,.95,.47,.36,.89,.54,.31,.89,.63,.21,.83,.7,.12,.83,.7,.12,.73,.7,.05,.65,.74,.05,.53,.78,0,.4,.8,0,.35,.82,0,.31,.85,0,.27,.88,0,.22,.9,0,.18,.91,0,.15,.92,0,.14,.93,0,.13,.94,0,.12,.95,0,.11,.96,0,.1,.97,0,.09,.98,0,.08,.99,0,.07,1,0,.06],Annotations:[0,"Xx",1,"H",2,"He",3,"Li",4,"Be",5,"B",6,"C",7,"N",8,"O",9,"F",10,"Ne",11,"Na",12,"Mg",13,"Al",14,"Si",15,"P",16,"S",17,"Cl",18,"Ar",19,"K",20,"Ca",21,"Sc",22,"Ti",23,"V",24,"Cr",25,"Mn",26,"Fe",27,"Co",28,"Ni",29,"Cu",30,"Zn",31,"Ga",32,"Ge",33,"As",34,"Se",35,"Br",36,"Kr",37,"Rb",38,"Sr",39,"Y",40,"Zr",41,"Nb",42,"Mo",43,"Tc",44,"Ru",45,"Rh",46,"Pd",47,"Ag",48,"Cd",49,"In",50,"Sn",51,"Sb",52,"Te",53,"I",54,"Xe",55,"Cs",56,"Ba",57,"La",58,"Ce",59,"Pr",60,"Nd",61,"Pm",62,"Sm",63,"Eu",64,"Gd",65,"Tb",66,"Dy",67,"Ho",68,"Er",69,"Tm",70,"Yb",71,"Lu",72,"Hf",73,"Ta",74,"W",75,"Re",76,"Os",77,"Ir",78,"Pt",79,"Au",80,"Hg",81,"Tl",82,"Pb",83,"Bi",84,"Po",85,"At",86,"Rn",87,"Fr",88,"Ra",89,"Ac",90,"Th",91,"Pa",92,"U",93,"Np",94,"Pu",95,"Am",96,"Cm",97,"Bk",98,"Cf",99,"Es",100,"Fm",101,"Md",102,"No",103,"Lr",104,"Rf",105,"Db",106,"Sg",107,"Bh",108,"Hs",109,"Mt",110,"Ds",111,"Rg",112,"Cn",113,"Uut",114,"Uuq",115,"Uup",116,"Uuh",117,"Uus",118,"Uuo"],Name:"BlueObeliskElements"}];const Fy=Object.create(null);p4t.filter(t=>t.RGBPoints).filter(t=>t.ColorSpace!=="CIELAB").forEach(t=>{Fy[t.Name]=t});const By=Object.keys(Fy);By.sort();function m4t(t){return Fy[t]}function v4t(t){!t.RGBPoints||t.ColorSpace==="CIELAB"||(Fy[t.Name]||(By.push(t.Name),By.sort()),Fy[t.Name]=t)}function y4t(t){const e=By.indexOf(t);e>-1&&By.splice(e,1),delete Fy[t]}var qw={addPreset:v4t,removePresetByName:y4t,getPresetByName:m4t,rgbPresetNames:By};const{vtkErrorMacro:bS}=se;function x4t(t,e){e.classHierarchy.push("vtkPiecewiseFunction"),t.getSize=()=>e.nodes.length,t.getType=()=>{let n,r=0,i=0;e.nodes.length>0&&(r=e.nodes[0].y);for(let a=1;a<e.nodes.length;a++){if(n=e.nodes[a].y,n!==r)if(n>r)switch(i){case 0:case 1:i=1;break;case 2:default:i=3;break}else switch(i){case 0:case 2:i=2;break;case 1:default:i=3;break}if(r=n,i===3)break}switch(i){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";case 3:default:return"Varied"}},t.getDataPointer=()=>{const n=e.nodes.length;if(e.function=null,n>0){e.function=[];for(let r=0;r<n;r++)e.function[2*r]=e.nodes[r].x,e.function[2*r+1]=e.nodes[r].y}return e.function},t.getFirstNonZeroValue=()=>{if(e.nodes.length===0)return 0;let n=1,r=0,i=0;for(;i<e.nodes.length;i++)if(e.nodes[i].y!==0){n=0;break}return n?r=Number.MAX_VALUE:i>0?r=e.nodes[i-1].x:e.clamping?r=-Number.MAX_VALUE:r=e.nodes[0].x,r},t.getNodeValue=(n,r)=>{const i=e.nodes.length;return n<0||n>=i?(bS("Index out of range!"),-1):(r[0]=e.nodes[n].x,r[1]=e.nodes[n].y,r[2]=e.nodes[n].midpoint,r[3]=e.nodes[n].sharpness,1)},t.setNodeValue=(n,r)=>{const i=e.nodes.length;if(n<0||n>=i)return bS("Index out of range!"),-1;const a=e.nodes[n].x;return e.nodes[n].x=r[0],e.nodes[n].y=r[1],e.nodes[n].midpoint=r[2],e.nodes[n].sharpness=r[3],a!==r[0]?t.sortAndUpdateRange():t.modified(),1},t.addPoint=(n,r)=>t.addPointLong(n,r,.5,0),t.addPointLong=(n,r,i,a)=>{if(i<0||i>1)return bS("Midpoint outside range [0.0, 1.0]"),-1;if(a<0||a>1)return bS("Sharpness outside range [0.0, 1.0]"),-1;e.allowDuplicateScalars||t.removePoint(n);const o={x:n,y:r,midpoint:i,sharpness:a};e.nodes.push(o),t.sortAndUpdateRange();let s;for(s=0;s<e.nodes.length&&e.nodes[s].x!==n;s++);return s<e.nodes.length?s:-1},t.setNodes=n=>{e.nodes!==n&&(e.nodes=n,t.sortAndUpdateRange())},t.sortAndUpdateRange=()=>{e.nodes.sort((r,i)=>r.x-i.x),t.updateRange()||t.modified()},t.updateRange=()=>{const n=e.range.slice(),r=e.nodes.length;return r?(e.range[0]=e.nodes[0].x,e.range[1]=e.nodes[r-1].x):(e.range[0]=0,e.range[1]=0),n[0]===e.range[0]&&n[1]===e.range[1]?!1:(t.modified(),!0)},t.removePoint=n=>{let r;for(r=0;r<e.nodes.length&&e.nodes[r].x!==n;r++);if(r>=e.nodes.length)return-1;const i=r;let a=!1;return e.nodes.splice(r,1),(r===0||r===e.nodes.length)&&(a=t.updateRange()),a||t.modified(),i},t.removeAllPoints=()=>{e.nodes=[],t.sortAndUpdateRange()},t.addSegment=(n,r,i,a)=>{t.sortAndUpdateRange();for(let o=0;o<e.nodes.length;)e.nodes[o].x>=n&&e.nodes[o].x<=i?e.nodes.splice(o,1):o++;t.addPoint(n,r,.5,0),t.addPoint(i,a,.5,0)},t.getValue=n=>{const r=[];return t.getTable(n,n,1,r),r[0]},t.adjustRange=n=>{if(n.length<2)return 0;const r=t.getRange();r[0]<n[0]?t.addPoint(n[0],t.getValue(n[0])):t.addPoint(n[0],t.getValue(r[0])),r[1]>n[1]?t.addPoint(n[1],t.getValue(n[1])):t.addPoint(n[1],t.getValue(r[1])),t.sortAndUpdateRange();for(let i=0;i<e.nodes.length;)e.nodes[i].x>=n[0]&&e.nodes[i].x<=n[1]?e.nodes.splice(i,1):++i;return t.sortAndUpdateRange(),1},t.estimateMinNumberOfSamples=(n,r)=>{const i=t.findMinimumXDistance();return Math.ceil((r-n)/i)},t.findMinimumXDistance=()=>{const n=e.nodes.length;if(n<2)return-1;let r=e.nodes[1].x-e.nodes[0].x;for(let i=0;i<n-1;i++){const a=e.nodes[i+1].x-e.nodes[i].x;a<r&&(r=a)}return r},t.getTable=function(n,r,i,a){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,s,c=0;const l=e.nodes.length;let u=0;l!==0&&(u=e.nodes[l-1].y);let f=0,d=0,h=0,m=0,p=0,y=0,x=0;for(s=0;s<i;s++){const S=o*s;for(i>1?f=n+s/(i-1)*(r-n):f=.5*(n+r);c<l&&f>e.nodes[c].x;)c++,c<l&&(d=e.nodes[c-1].x,h=e.nodes[c].x,m=e.nodes[c-1].y,p=e.nodes[c].y,y=e.nodes[c-1].midpoint,x=e.nodes[c-1].sharpness,y<1e-5&&(y=1e-5),y>.99999&&(y=.99999));if(c>=l)a[S]=e.clamping?u:0;else if(c===0)a[S]=e.clamping?e.nodes[0].y:0;else{let C=(f-d)/(h-d);if(C<y?C=.5*C/y:C=.5+.5*(C-y)/(1-y),x>.99)if(C<.5){a[S]=m;continue}else{a[S]=p;continue}if(x<.01){a[S]=(1-C)*m+C*p;continue}C<.5?C=.5*(C*2)**(1+10*x):C>.5&&(C=1-.5*((1-C)*2)**(1+10*x));const _=C*C,T=_*C,O=2*T-3*_+1,M=-2*T+3*_,I=T-2*_+C,V=T-_,k=p-m,L=(1-x)*k;a[S]=O*m+M*p+I*L+V*L;const $=m<p?m:p,W=m>p?m:p;a[S]=a[S]<$?$:a[S],a[S]=a[S]>W?W:a[S]}}}}const w4t={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function wxe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,w4t,n),se.obj(t,e),e.nodes=[],se.setGet(t,e,["allowDuplicateScalars","clamping"]),se.setArray(t,e,["range"],2),se.getArray(t,e,["range"]),x4t(t,e)}const b4t=se.newInstance(wxe,"vtkPiecewiseFunction");var l1={newInstance:b4t,extend:wxe},hr=1e-6,xa=typeof Float32Array<"u"?Float32Array:Array,S4t=Math.PI/180;function C4t(t){return t*S4t}function jT(t,e){return Math.abs(t-e)<=hr*Math.max(1,Math.abs(t),Math.abs(e))}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function zU(){var t=new xa(9);return xa!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function FE(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function _4t(t){var e=new xa(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function T4t(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function T5(t,e,n,r,i,a,o,s,c){var l=new xa(9);return l[0]=t,l[1]=e,l[2]=n,l[3]=r,l[4]=i,l[5]=a,l[6]=o,l[7]=s,l[8]=c,l}function bxe(t,e,n,r,i,a,o,s,c,l){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t}function vf(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function GU(t,e){if(t===e){var n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function g3(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],f=u*o-s*l,d=-u*a+s*c,h=l*a-o*c,m=n*f+r*d+i*h;return m?(m=1/m,t[0]=f*m,t[1]=(-u*r+i*l)*m,t[2]=(s*r-i*o)*m,t[3]=d*m,t[4]=(u*n-i*c)*m,t[5]=(-s*n+i*a)*m,t[6]=h*m,t[7]=(-l*n+r*c)*m,t[8]=(o*n-r*a)*m,t):null}function E4t(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8];return t[0]=o*u-s*l,t[1]=i*l-r*u,t[2]=r*s-i*o,t[3]=s*c-a*u,t[4]=n*u-i*c,t[5]=i*a-n*s,t[6]=a*l-o*c,t[7]=r*c-n*l,t[8]=n*o-r*a,t}function am(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8];return e*(l*a-o*c)+n*(-l*i+o*s)+r*(c*i-a*s)}function zy(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3],s=e[4],c=e[5],l=e[6],u=e[7],f=e[8],d=n[0],h=n[1],m=n[2],p=n[3],y=n[4],x=n[5],S=n[6],C=n[7],_=n[8];return t[0]=d*r+h*o+m*l,t[1]=d*i+h*s+m*u,t[2]=d*a+h*c+m*f,t[3]=p*r+y*o+x*l,t[4]=p*i+y*s+x*u,t[5]=p*a+y*c+x*f,t[6]=S*r+C*o+_*l,t[7]=S*i+C*s+_*u,t[8]=S*a+C*c+_*f,t}function O4t(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3],s=e[4],c=e[5],l=e[6],u=e[7],f=e[8],d=n[0],h=n[1];return t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=d*r+h*o+l,t[7]=d*i+h*s+u,t[8]=d*a+h*c+f,t}function D4t(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3],s=e[4],c=e[5],l=e[6],u=e[7],f=e[8],d=Math.sin(n),h=Math.cos(n);return t[0]=h*r+d*o,t[1]=h*i+d*s,t[2]=h*a+d*c,t[3]=h*o-d*r,t[4]=h*s-d*i,t[5]=h*c-d*a,t[6]=l,t[7]=u,t[8]=f,t}function M4t(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function R4t(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function I4t(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function N4t(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function P4t(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function k4t(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n+n,s=r+r,c=i+i,l=n*o,u=r*o,f=r*s,d=i*o,h=i*s,m=i*c,p=a*o,y=a*s,x=a*c;return t[0]=1-f-m,t[3]=u-x,t[6]=d+y,t[1]=u+x,t[4]=1-l-m,t[7]=h-p,t[2]=d-y,t[5]=h+p,t[8]=1-l-f,t}function A4t(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],f=e[9],d=e[10],h=e[11],m=e[12],p=e[13],y=e[14],x=e[15],S=n*s-r*o,C=n*c-i*o,_=n*l-a*o,T=r*c-i*s,O=r*l-a*s,M=i*l-a*c,I=u*p-f*m,V=u*y-d*m,k=u*x-h*m,L=f*y-d*p,$=f*x-h*p,W=d*x-h*y,G=S*W-C*$+_*L+T*k-O*V+M*I;return G?(G=1/G,t[0]=(s*W-c*$+l*L)*G,t[1]=(c*k-o*W-l*V)*G,t[2]=(o*$-s*k+l*I)*G,t[3]=(i*$-r*W-a*L)*G,t[4]=(n*W-i*k+a*V)*G,t[5]=(r*k-n*$-a*I)*G,t[6]=(p*M-y*O+x*T)*G,t[7]=(y*_-m*M-x*C)*G,t[8]=(m*O-p*_+x*S)*G,t):null}function L4t(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function V4t(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function $4t(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function j4t(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t}function Sxe(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}function U4t(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t}function F4t(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t}function B4t(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function z4t(t,e){var n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],f=e[0],d=e[1],h=e[2],m=e[3],p=e[4],y=e[5],x=e[6],S=e[7],C=e[8];return Math.abs(n-f)<=hr*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(r-d)<=hr*Math.max(1,Math.abs(r),Math.abs(d))&&Math.abs(i-h)<=hr*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-m)<=hr*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(o-p)<=hr*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(s-y)<=hr*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(c-x)<=hr*Math.max(1,Math.abs(c),Math.abs(x))&&Math.abs(l-S)<=hr*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(u-C)<=hr*Math.max(1,Math.abs(u),Math.abs(C))}var G4t=zy,W4t=Sxe;const H4t=Object.freeze(Object.defineProperty({__proto__:null,add:j4t,adjoint:E4t,clone:_4t,copy:T4t,create:zU,determinant:am,equals:z4t,exactEquals:B4t,frob:$4t,fromMat2d:P4t,fromMat4:FE,fromQuat:k4t,fromRotation:I4t,fromScaling:N4t,fromTranslation:R4t,fromValues:T5,identity:vf,invert:g3,mul:G4t,multiply:zy,multiplyScalar:U4t,multiplyScalarAndAdd:F4t,normalFromMat4:A4t,projection:L4t,rotate:D4t,scale:M4t,set:bxe,str:V4t,sub:W4t,subtract:Sxe,translate:O4t,transpose:GU},Symbol.toStringTag,{value:"Module"}));function Td(){var t=new xa(16);return xa!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function q4t(t){var e=new xa(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function pa(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Cxe(t,e,n,r,i,a,o,s,c,l,u,f,d,h,m,p){var y=new xa(16);return y[0]=t,y[1]=e,y[2]=n,y[3]=r,y[4]=i,y[5]=a,y[6]=o,y[7]=s,y[8]=c,y[9]=l,y[10]=u,y[11]=f,y[12]=d,y[13]=h,y[14]=m,y[15]=p,y}function K4t(t,e,n,r,i,a,o,s,c,l,u,f,d,h,m,p,y){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=f,t[11]=d,t[12]=h,t[13]=m,t[14]=p,t[15]=y,t}function sn(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function cr(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],a=e[6],o=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[11]=e[14],t[12]=i,t[13]=o,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Na(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],f=e[9],d=e[10],h=e[11],m=e[12],p=e[13],y=e[14],x=e[15],S=n*s-r*o,C=n*c-i*o,_=n*l-a*o,T=r*c-i*s,O=r*l-a*s,M=i*l-a*c,I=u*p-f*m,V=u*y-d*m,k=u*x-h*m,L=f*y-d*p,$=f*x-h*p,W=d*x-h*y,G=S*W-C*$+_*L+T*k-O*V+M*I;return G?(G=1/G,t[0]=(s*W-c*$+l*L)*G,t[1]=(i*$-r*W-a*L)*G,t[2]=(p*M-y*O+x*T)*G,t[3]=(d*O-f*M-h*T)*G,t[4]=(c*k-o*W-l*V)*G,t[5]=(n*W-i*k+a*V)*G,t[6]=(y*_-m*M-x*C)*G,t[7]=(u*M-d*_+h*C)*G,t[8]=(o*$-s*k+l*I)*G,t[9]=(r*k-n*$-a*I)*G,t[10]=(m*O-p*_+x*S)*G,t[11]=(f*_-u*O-h*S)*G,t[12]=(s*V-o*L-c*I)*G,t[13]=(n*L-r*V+i*I)*G,t[14]=(p*C-m*T-y*S)*G,t[15]=(u*T-f*C+d*S)*G,t):null}function Y4t(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],f=e[9],d=e[10],h=e[11],m=e[12],p=e[13],y=e[14],x=e[15];return t[0]=s*(d*x-h*y)-f*(c*x-l*y)+p*(c*h-l*d),t[1]=-(r*(d*x-h*y)-f*(i*x-a*y)+p*(i*h-a*d)),t[2]=r*(c*x-l*y)-s*(i*x-a*y)+p*(i*l-a*c),t[3]=-(r*(c*h-l*d)-s*(i*h-a*d)+f*(i*l-a*c)),t[4]=-(o*(d*x-h*y)-u*(c*x-l*y)+m*(c*h-l*d)),t[5]=n*(d*x-h*y)-u*(i*x-a*y)+m*(i*h-a*d),t[6]=-(n*(c*x-l*y)-o*(i*x-a*y)+m*(i*l-a*c)),t[7]=n*(c*h-l*d)-o*(i*h-a*d)+u*(i*l-a*c),t[8]=o*(f*x-h*p)-u*(s*x-l*p)+m*(s*h-l*f),t[9]=-(n*(f*x-h*p)-u*(r*x-a*p)+m*(r*h-a*f)),t[10]=n*(s*x-l*p)-o*(r*x-a*p)+m*(r*l-a*s),t[11]=-(n*(s*h-l*f)-o*(r*h-a*f)+u*(r*l-a*s)),t[12]=-(o*(f*y-d*p)-u*(s*y-c*p)+m*(s*d-c*f)),t[13]=n*(f*y-d*p)-u*(r*y-i*p)+m*(r*d-i*f),t[14]=-(n*(s*y-c*p)-o*(r*y-i*p)+m*(r*c-i*s)),t[15]=n*(s*d-c*f)-o*(r*d-i*f)+u*(r*c-i*s),t}function X4t(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],f=t[10],d=t[11],h=t[12],m=t[13],p=t[14],y=t[15],x=e*o-n*a,S=e*s-r*a,C=e*c-i*a,_=n*s-r*o,T=n*c-i*o,O=r*c-i*s,M=l*m-u*h,I=l*p-f*h,V=l*y-d*h,k=u*p-f*m,L=u*y-d*m,$=f*y-d*p;return x*$-S*L+C*k+_*V-T*I+O*M}function Xn(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3],s=e[4],c=e[5],l=e[6],u=e[7],f=e[8],d=e[9],h=e[10],m=e[11],p=e[12],y=e[13],x=e[14],S=e[15],C=n[0],_=n[1],T=n[2],O=n[3];return t[0]=C*r+_*s+T*f+O*p,t[1]=C*i+_*c+T*d+O*y,t[2]=C*a+_*l+T*h+O*x,t[3]=C*o+_*u+T*m+O*S,C=n[4],_=n[5],T=n[6],O=n[7],t[4]=C*r+_*s+T*f+O*p,t[5]=C*i+_*c+T*d+O*y,t[6]=C*a+_*l+T*h+O*x,t[7]=C*o+_*u+T*m+O*S,C=n[8],_=n[9],T=n[10],O=n[11],t[8]=C*r+_*s+T*f+O*p,t[9]=C*i+_*c+T*d+O*y,t[10]=C*a+_*l+T*h+O*x,t[11]=C*o+_*u+T*m+O*S,C=n[12],_=n[13],T=n[14],O=n[15],t[12]=C*r+_*s+T*f+O*p,t[13]=C*i+_*c+T*d+O*y,t[14]=C*a+_*l+T*h+O*x,t[15]=C*o+_*u+T*m+O*S,t}function Ma(t,e,n){var r=n[0],i=n[1],a=n[2],o,s,c,l,u,f,d,h,m,p,y,x;return e===t?(t[12]=e[0]*r+e[4]*i+e[8]*a+e[12],t[13]=e[1]*r+e[5]*i+e[9]*a+e[13],t[14]=e[2]*r+e[6]*i+e[10]*a+e[14],t[15]=e[3]*r+e[7]*i+e[11]*a+e[15]):(o=e[0],s=e[1],c=e[2],l=e[3],u=e[4],f=e[5],d=e[6],h=e[7],m=e[8],p=e[9],y=e[10],x=e[11],t[0]=o,t[1]=s,t[2]=c,t[3]=l,t[4]=u,t[5]=f,t[6]=d,t[7]=h,t[8]=m,t[9]=p,t[10]=y,t[11]=x,t[12]=o*r+u*i+m*a+e[12],t[13]=s*r+f*i+p*a+e[13],t[14]=c*r+d*i+y*a+e[14],t[15]=l*r+h*i+x*a+e[15]),t}function Ed(t,e,n){var r=n[0],i=n[1],a=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Hu(t,e,n,r){var i=r[0],a=r[1],o=r[2],s=Math.hypot(i,a,o),c,l,u,f,d,h,m,p,y,x,S,C,_,T,O,M,I,V,k,L,$,W,G,oe;return s<hr?null:(s=1/s,i*=s,a*=s,o*=s,c=Math.sin(n),l=Math.cos(n),u=1-l,f=e[0],d=e[1],h=e[2],m=e[3],p=e[4],y=e[5],x=e[6],S=e[7],C=e[8],_=e[9],T=e[10],O=e[11],M=i*i*u+l,I=a*i*u+o*c,V=o*i*u-a*c,k=i*a*u-o*c,L=a*a*u+l,$=o*a*u+i*c,W=i*o*u+a*c,G=a*o*u-i*c,oe=o*o*u+l,t[0]=f*M+p*I+C*V,t[1]=d*M+y*I+_*V,t[2]=h*M+x*I+T*V,t[3]=m*M+S*I+O*V,t[4]=f*k+p*L+C*$,t[5]=d*k+y*L+_*$,t[6]=h*k+x*L+T*$,t[7]=m*k+S*L+O*$,t[8]=f*W+p*G+C*oe,t[9]=d*W+y*G+_*oe,t[10]=h*W+x*G+T*oe,t[11]=m*W+S*G+O*oe,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function WU(t,e,n){var r=Math.sin(n),i=Math.cos(n),a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],f=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=a*i+l*r,t[5]=o*i+u*r,t[6]=s*i+f*r,t[7]=c*i+d*r,t[8]=l*i-a*r,t[9]=u*i-o*r,t[10]=f*i-s*r,t[11]=d*i-c*r,t}function HU(t,e,n){var r=Math.sin(n),i=Math.cos(n),a=e[0],o=e[1],s=e[2],c=e[3],l=e[8],u=e[9],f=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*i-l*r,t[1]=o*i-u*r,t[2]=s*i-f*r,t[3]=c*i-d*r,t[8]=a*r+l*i,t[9]=o*r+u*i,t[10]=s*r+f*i,t[11]=c*r+d*i,t}function qU(t,e,n){var r=Math.sin(n),i=Math.cos(n),a=e[0],o=e[1],s=e[2],c=e[3],l=e[4],u=e[5],f=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*i+l*r,t[1]=o*i+u*r,t[2]=s*i+f*r,t[3]=c*i+d*r,t[4]=l*i-a*r,t[5]=u*i-o*r,t[6]=f*i-s*r,t[7]=d*i-c*r,t}function p3(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function KU(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function YU(t,e,n){var r=n[0],i=n[1],a=n[2],o=Math.hypot(r,i,a),s,c,l;return o<hr?null:(o=1/o,r*=o,i*=o,a*=o,s=Math.sin(e),c=Math.cos(e),l=1-c,t[0]=r*r*l+c,t[1]=i*r*l+a*s,t[2]=a*r*l-i*s,t[3]=0,t[4]=r*i*l-a*s,t[5]=i*i*l+c,t[6]=a*i*l+r*s,t[7]=0,t[8]=r*a*l+i*s,t[9]=i*a*l-r*s,t[10]=a*a*l+c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function Z4t(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Q4t(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function J4t(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function _xe(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3],s=r+r,c=i+i,l=a+a,u=r*s,f=r*c,d=r*l,h=i*c,m=i*l,p=a*l,y=o*s,x=o*c,S=o*l;return t[0]=1-(h+p),t[1]=f+S,t[2]=d-x,t[3]=0,t[4]=f-S,t[5]=1-(u+p),t[6]=m+y,t[7]=0,t[8]=d+x,t[9]=m-y,t[10]=1-(u+h),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function eSt(t,e){var n=new xa(3),r=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],c=e[5],l=e[6],u=e[7],f=r*r+i*i+a*a+o*o;return f>0?(n[0]=(s*o+u*r+c*a-l*i)*2/f,n[1]=(c*o+u*i+l*r-s*a)*2/f,n[2]=(l*o+u*a+s*i-c*r)*2/f):(n[0]=(s*o+u*r+c*a-l*i)*2,n[1]=(c*o+u*i+l*r-s*a)*2,n[2]=(l*o+u*a+s*i-c*r)*2),_xe(t,e,n),t}function tSt(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Txe(t,e){var n=e[0],r=e[1],i=e[2],a=e[4],o=e[5],s=e[6],c=e[8],l=e[9],u=e[10];return t[0]=Math.hypot(n,r,i),t[1]=Math.hypot(a,o,s),t[2]=Math.hypot(c,l,u),t}function ik(t,e){var n=new xa(3);Txe(n,e);var r=1/n[0],i=1/n[1],a=1/n[2],o=e[0]*r,s=e[1]*i,c=e[2]*a,l=e[4]*r,u=e[5]*i,f=e[6]*a,d=e[8]*r,h=e[9]*i,m=e[10]*a,p=o+u+m,y=0;return p>0?(y=Math.sqrt(p+1)*2,t[3]=.25*y,t[0]=(f-h)/y,t[1]=(d-c)/y,t[2]=(s-l)/y):o>u&&o>m?(y=Math.sqrt(1+o-u-m)*2,t[3]=(f-h)/y,t[0]=.25*y,t[1]=(s+l)/y,t[2]=(d+c)/y):u>m?(y=Math.sqrt(1+u-o-m)*2,t[3]=(d-c)/y,t[0]=(s+l)/y,t[1]=.25*y,t[2]=(f+h)/y):(y=Math.sqrt(1+m-o-u)*2,t[3]=(s-l)/y,t[0]=(d+c)/y,t[1]=(f+h)/y,t[2]=.25*y),t}function Exe(t,e,n,r){var i=e[0],a=e[1],o=e[2],s=e[3],c=i+i,l=a+a,u=o+o,f=i*c,d=i*l,h=i*u,m=a*l,p=a*u,y=o*u,x=s*c,S=s*l,C=s*u,_=r[0],T=r[1],O=r[2];return t[0]=(1-(m+y))*_,t[1]=(d+C)*_,t[2]=(h-S)*_,t[3]=0,t[4]=(d-C)*T,t[5]=(1-(f+y))*T,t[6]=(p+x)*T,t[7]=0,t[8]=(h+S)*O,t[9]=(p-x)*O,t[10]=(1-(f+m))*O,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function nSt(t,e,n,r,i){var a=e[0],o=e[1],s=e[2],c=e[3],l=a+a,u=o+o,f=s+s,d=a*l,h=a*u,m=a*f,p=o*u,y=o*f,x=s*f,S=c*l,C=c*u,_=c*f,T=r[0],O=r[1],M=r[2],I=i[0],V=i[1],k=i[2],L=(1-(p+x))*T,$=(h+_)*T,W=(m-C)*T,G=(h-_)*O,oe=(1-(d+x))*O,U=(y+S)*O,Y=(m+C)*M,J=(y-S)*M,ne=(1-(d+p))*M;return t[0]=L,t[1]=$,t[2]=W,t[3]=0,t[4]=G,t[5]=oe,t[6]=U,t[7]=0,t[8]=Y,t[9]=J,t[10]=ne,t[11]=0,t[12]=n[0]+I-(L*I+G*V+Y*k),t[13]=n[1]+V-($*I+oe*V+J*k),t[14]=n[2]+k-(W*I+U*V+ne*k),t[15]=1,t}function UT(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n+n,s=r+r,c=i+i,l=n*o,u=r*o,f=r*s,d=i*o,h=i*s,m=i*c,p=a*o,y=a*s,x=a*c;return t[0]=1-f-m,t[1]=u+x,t[2]=d-y,t[3]=0,t[4]=u-x,t[5]=1-l-m,t[6]=h+p,t[7]=0,t[8]=d+y,t[9]=h-p,t[10]=1-l-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function rSt(t,e,n,r,i,a,o){var s=1/(n-e),c=1/(i-r),l=1/(a-o);return t[0]=a*2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a*2*c,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(i+r)*c,t[10]=(o+a)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*a*2*l,t[15]=0,t}function Oxe(t,e,n,r,i){var a=1/Math.tan(e/2),o;return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(o=1/(r-i),t[10]=(i+r)*o,t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r),t}var iSt=Oxe;function aSt(t,e,n,r,i){var a=1/Math.tan(e/2),o;return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(o=1/(r-i),t[10]=i*o,t[14]=i*r*o):(t[10]=-1,t[14]=-r),t}function oSt(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),c=2/(o+s),l=2/(i+a);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-((o-s)*c*.5),t[9]=(i-a)*l*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t}function Dxe(t,e,n,r,i,a,o){var s=1/(e-n),c=1/(r-i),l=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*c,t[14]=(o+a)*l,t[15]=1,t}var XU=Dxe;function sSt(t,e,n,r,i,a,o){var s=1/(e-n),c=1/(r-i),l=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=l,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*c,t[14]=a*l,t[15]=1,t}function Mxe(t,e,n,r){var i,a,o,s,c,l,u,f,d,h,m=e[0],p=e[1],y=e[2],x=r[0],S=r[1],C=r[2],_=n[0],T=n[1],O=n[2];return Math.abs(m-_)<hr&&Math.abs(p-T)<hr&&Math.abs(y-O)<hr?sn(t):(u=m-_,f=p-T,d=y-O,h=1/Math.hypot(u,f,d),u*=h,f*=h,d*=h,i=S*d-C*f,a=C*u-x*d,o=x*f-S*u,h=Math.hypot(i,a,o),h?(h=1/h,i*=h,a*=h,o*=h):(i=0,a=0,o=0),s=f*o-d*a,c=d*i-u*o,l=u*a-f*i,h=Math.hypot(s,c,l),h?(h=1/h,s*=h,c*=h,l*=h):(s=0,c=0,l=0),t[0]=i,t[1]=s,t[2]=u,t[3]=0,t[4]=a,t[5]=c,t[6]=f,t[7]=0,t[8]=o,t[9]=l,t[10]=d,t[11]=0,t[12]=-(i*m+a*p+o*y),t[13]=-(s*m+c*p+l*y),t[14]=-(u*m+f*p+d*y),t[15]=1,t)}function cSt(t,e,n,r){var i=e[0],a=e[1],o=e[2],s=r[0],c=r[1],l=r[2],u=i-n[0],f=a-n[1],d=o-n[2],h=u*u+f*f+d*d;h>0&&(h=1/Math.sqrt(h),u*=h,f*=h,d*=h);var m=c*d-l*f,p=l*u-s*d,y=s*f-c*u;return h=m*m+p*p+y*y,h>0&&(h=1/Math.sqrt(h),m*=h,p*=h,y*=h),t[0]=m,t[1]=p,t[2]=y,t[3]=0,t[4]=f*y-d*p,t[5]=d*m-u*y,t[6]=u*p-f*m,t[7]=0,t[8]=u,t[9]=f,t[10]=d,t[11]=0,t[12]=i,t[13]=a,t[14]=o,t[15]=1,t}function lSt(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function uSt(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function fSt(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t}function Rxe(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}function dSt(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t}function hSt(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t}function gSt(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function pSt(t,e){var n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],f=t[9],d=t[10],h=t[11],m=t[12],p=t[13],y=t[14],x=t[15],S=e[0],C=e[1],_=e[2],T=e[3],O=e[4],M=e[5],I=e[6],V=e[7],k=e[8],L=e[9],$=e[10],W=e[11],G=e[12],oe=e[13],U=e[14],Y=e[15];return Math.abs(n-S)<=hr*Math.max(1,Math.abs(n),Math.abs(S))&&Math.abs(r-C)<=hr*Math.max(1,Math.abs(r),Math.abs(C))&&Math.abs(i-_)<=hr*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(a-T)<=hr*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(o-O)<=hr*Math.max(1,Math.abs(o),Math.abs(O))&&Math.abs(s-M)<=hr*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(c-I)<=hr*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(l-V)<=hr*Math.max(1,Math.abs(l),Math.abs(V))&&Math.abs(u-k)<=hr*Math.max(1,Math.abs(u),Math.abs(k))&&Math.abs(f-L)<=hr*Math.max(1,Math.abs(f),Math.abs(L))&&Math.abs(d-$)<=hr*Math.max(1,Math.abs(d),Math.abs($))&&Math.abs(h-W)<=hr*Math.max(1,Math.abs(h),Math.abs(W))&&Math.abs(m-G)<=hr*Math.max(1,Math.abs(m),Math.abs(G))&&Math.abs(p-oe)<=hr*Math.max(1,Math.abs(p),Math.abs(oe))&&Math.abs(y-U)<=hr*Math.max(1,Math.abs(y),Math.abs(U))&&Math.abs(x-Y)<=hr*Math.max(1,Math.abs(x),Math.abs(Y))}var FT=Xn,mSt=Rxe;const BT=Object.freeze(Object.defineProperty({__proto__:null,add:fSt,adjoint:Y4t,clone:q4t,copy:pa,create:Td,determinant:X4t,equals:pSt,exactEquals:gSt,frob:uSt,fromQuat:UT,fromQuat2:eSt,fromRotation:YU,fromRotationTranslation:_xe,fromRotationTranslationScale:Exe,fromRotationTranslationScaleOrigin:nSt,fromScaling:KU,fromTranslation:p3,fromValues:Cxe,fromXRotation:Z4t,fromYRotation:Q4t,fromZRotation:J4t,frustum:rSt,getRotation:ik,getScaling:Txe,getTranslation:tSt,identity:sn,invert:Na,lookAt:Mxe,mul:FT,multiply:Xn,multiplyScalar:dSt,multiplyScalarAndAdd:hSt,ortho:XU,orthoNO:Dxe,orthoZO:sSt,perspective:iSt,perspectiveFromFieldOfView:oSt,perspectiveNO:Oxe,perspectiveZO:aSt,rotate:Hu,rotateX:WU,rotateY:HU,rotateZ:qU,scale:Ed,set:K4t,str:lSt,sub:mSt,subtract:Rxe,targetTo:cSt,translate:Ma,transpose:cr},Symbol.toStringTag,{value:"Module"}));function ut(){var t=new xa(3);return xa!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Ixe(t){var e=new xa(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function ec(t){var e=t[0],n=t[1],r=t[2];return Math.hypot(e,n,r)}function Zn(t,e,n){var r=new xa(3);return r[0]=t,r[1]=e,r[2]=n,r}function vSt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function _r(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function eh(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function Xi(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function ySt(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function xSt(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function wSt(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t}function gd(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function Ro(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}function Gy(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.hypot(n,r,i)}function th(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function Nxe(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function Vr(t,e){var n=e[0],r=e[1],i=e[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t}function Vt(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Tr(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[0],s=n[1],c=n[2];return t[0]=i*c-a*s,t[1]=a*o-r*c,t[2]=r*s-i*o,t}function gr(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return o=o||1,t[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/o,t[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,t[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,t}function NC(t,e,n){var r=e[0],i=e[1],a=e[2];return t[0]=r*n[0]+i*n[3]+a*n[6],t[1]=r*n[1]+i*n[4]+a*n[7],t[2]=r*n[2]+i*n[5]+a*n[8],t}function Pxe(t,e){var n=t[0],r=t[1],i=t[2],a=e[0],o=e[1],s=e[2],c=Math.sqrt(n*n+r*r+i*i),l=Math.sqrt(a*a+o*o+s*s),u=c*l,f=u&&Vt(t,e)/u;return Math.acos(Math.min(Math.max(f,-1),1))}function bSt(t){return t[0]=0,t[1]=0,t[2]=0,t}function Eee(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function Oee(t,e){var n=t[0],r=t[1],i=t[2],a=e[0],o=e[1],s=e[2];return Math.abs(n-a)<=hr*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-o)<=hr*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=hr*Math.max(1,Math.abs(i),Math.abs(s))}var yr=Xi,SSt=ySt,zT=ec;(function(){var t=ut();return function(e,n,r,i,a,o){var s,c;for(n||(n=3),r||(r=0),i?c=Math.min(i*n+r,e.length):c=e.length,s=r;s<c;s+=n)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],a(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}})();function CSt(){var t=new xa(4);return xa!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function _St(t,e,n,r){var i=new xa(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i}function Dee(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function TSt(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n*n+r*r+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=a*o,t}function Tm(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*o,t[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*o,t[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*o,t[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*o,t}(function(){var t=CSt();return function(e,n,r,i,a,o){var s,c;for(n||(n=4),r||(r=0),i?c=Math.min(i*n+r,e.length):c=e.length,s=r;s<c;s+=n)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],a(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}})();function u1(){var t=new xa(4);return xa!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function ZU(t,e,n){n=n*.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function ESt(t,e){var n=Math.acos(e[3])*2,r=Math.sin(n/2);return r>hr?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),n}function Mee(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3],s=n[0],c=n[1],l=n[2],u=n[3];return t[0]=r*u+o*s+i*l-a*c,t[1]=i*u+o*c+a*s-r*l,t[2]=a*u+o*l+r*c-i*s,t[3]=o*u-r*s-i*c-a*l,t}function PC(t,e,n,r){var i=e[0],a=e[1],o=e[2],s=e[3],c=n[0],l=n[1],u=n[2],f=n[3],d,h,m,p,y;return h=i*c+a*l+o*u+s*f,h<0&&(h=-h,c=-c,l=-l,u=-u,f=-f),1-h>hr?(d=Math.acos(h),m=Math.sin(d),p=Math.sin((1-r)*d)/m,y=Math.sin(r*d)/m):(p=1-r,y=r),t[0]=p*i+y*c,t[1]=p*a+y*l,t[2]=p*o+y*u,t[3]=p*s+y*f,t}function OSt(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function DSt(t,e){var n=e[0]+e[4]+e[8],r;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(e[i*3+i]-e[a*3+a]-e[o*3+o]+1),t[i]=.5*r,r=.5/r,t[3]=(e[a*3+o]-e[o*3+a])*r,t[a]=(e[a*3+i]+e[i*3+a])*r,t[o]=(e[o*3+i]+e[i*3+o])*r}return t}var Ree=_St,kxe=TSt;(function(){var t=ut(),e=Zn(1,0,0),n=Zn(0,1,0);return function(r,i,a){var o=Vt(i,a);return o<-.999999?(Tr(t,e,i),zT(t)<1e-6&&Tr(t,n,i),Vr(t,t),ZU(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Tr(t,i,a),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,kxe(r,r))}})();(function(){var t=u1(),e=u1();return function(n,r,i,a,o,s){return PC(t,r,o,s),PC(e,i,a,s),PC(n,t,e,2*s*(1-s)),n}})();(function(){var t=zU();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],kxe(e,DSt(e,t))}})();function si(){var t=new xa(2);return xa!=Float32Array&&(t[0]=0,t[1]=0),t}function Iee(t,e){var n=new xa(2);return n[0]=t,n[1]=e,n}function hy(t,e,n){return t[0]=e,t[1]=n,t}function QU(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function Qo(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function Nee(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}function SS(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}function Ka(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.hypot(n,r)}function Pg(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function Pee(t){var e=t[0],n=t[1];return Math.hypot(e,n)}function Axe(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t}function xg(t,e){return t[0]*e[0]+t[1]*e[1]}function MSt(t,e,n,r){var i=e[0]-n[0],a=e[1]-n[1],o=Math.sin(r),s=Math.cos(r);return t[0]=i*s-a*o+n[0],t[1]=i*o+a*s+n[1],t}var Wy=Qo,JU=Ka;(function(){var t=si();return function(e,n,r,i,a,o){var s,c;for(n||(n=2),r||(r=0),i?c=Math.min(i*n+r,e.length):c=e.length,s=r;s<c;s+=n)t[0]=e[s],t[1]=e[s+1],a(t,t,o),e[s]=t[0],e[s+1]=t[1];return e}})();function ma(t){const e=t.indexOf(":");return t.substring(e+1)}function Lxe(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return(e>>>0).toString(36)}const RSt=1073741824;class ISt{constructor(){this._imageCache=new Map,this._volumeCache=new Map,this._imageIdsToVolumeIdCache=new Map,this._referencedImageIdToImageIdCache=new Map,this._geometryCache=new Map,this._imageCacheSize=0,this._maxCacheSize=3*RSt,this._geometryCacheSize=0,this.setMaxCacheSize=e=>{if(!e||typeof e!="number"){const n=`New max cacheSize ${this._maxCacheSize} should be defined and should be a number.`;throw new Error(n)}this._maxCacheSize=e},this.isCacheable=e=>{const n=this.getBytesAvailable(),r=Array.from(this._imageCache.values()).reduce((a,o)=>o.sharedCacheKey?a:a+o.sizeInBytes,0);return n+r>=e},this.getMaxCacheSize=()=>this._maxCacheSize,this.getCacheSize=()=>this._imageCacheSize,this._decacheImage=(e,n=!1)=>{const r=this._imageCache.get(e);if(!r)return;if(r.sharedCacheKey&&!n)throw new Error("Cannot decache an image with a shared cache key. You need to manually decache the volume first.");const{imageLoadObject:i}=r;r.image?.referencedImageId&&this._referencedImageIdToImageIdCache.delete(r.image.referencedImageId),i?.cancelFn&&i.cancelFn(),i?.decache&&i.decache(),this._imageCache.delete(e)},this._decacheVolume=e=>{const n=this._volumeCache.get(e);if(!n)return;const{volumeLoadObject:r,volume:i}=n;i&&(i.cancelLoading&&i.cancelLoading(),i.imageData&&i.imageData.delete(),r.cancelFn&&r.cancelFn(),i.imageIds&&i.imageIds.forEach(a=>{const o=this._imageCache.get(a);o&&o.sharedCacheKey===e&&(o.sharedCacheKey=void 0)}),this._volumeCache.delete(e))},this.purgeCache=()=>{const e=this._imageCache.keys();for(this.purgeVolumeCache();;){const{value:n,done:r}=e.next();if(r)break;this.removeImageLoadObject(n,{force:!0}),dt(pt,it.IMAGE_CACHE_IMAGE_REMOVED,{imageId:n})}},this.purgeVolumeCache=()=>{const e=this._volumeCache.keys();for(;;){const{value:n,done:r}=e.next();if(r)break;this.removeVolumeLoadObject(n),dt(pt,it.VOLUME_CACHE_VOLUME_REMOVED,{volumeId:n})}},this.getVolumeLoadObject=e=>{if(e===void 0)throw new Error("getVolumeLoadObject: volumeId must not be undefined");const n=this._volumeCache.get(e);if(n)return n.timeStamp=Date.now(),n.volumeLoadObject},this.putGeometryLoadObject=(e,n)=>{if(e===void 0)throw new Error("putGeometryLoadObject: geometryId must not be undefined");if(n.promise===void 0)throw new Error("putGeometryLoadObject: geometryLoadObject.promise must not be undefined");if(this._geometryCache.has(e))throw new Error("putGeometryLoadObject: geometryId already present in geometryCache");if(n.cancelFn&&typeof n.cancelFn!="function")throw new Error("putGeometryLoadObject: geometryLoadObject.cancel must be a function");const r={loaded:!1,geometryId:e,geometryLoadObject:n,timeStamp:Date.now(),sizeInBytes:0};return this._geometryCache.set(e,r),n.promise.then(i=>{try{this._putGeometryCommon(e,i,r)}catch(a){throw console.debug(`Error in _putGeometryCommon for geometry ${e}:`,a),a}}).catch(i=>{throw console.debug(`Error caching geometry ${e}:`,i),this._geometryCache.delete(e),i})},this.getGeometry=e=>{if(e===void 0)throw new Error("getGeometry: geometryId must not be undefined");const n=this._geometryCache.get(e);if(n)return n.timeStamp=Date.now(),n.geometry},this.removeGeometryLoadObject=e=>{if(e===void 0)throw new Error("removeGeometryLoadObject: geometryId must not be undefined");const n=this._geometryCache.get(e);if(!n)throw new Error("removeGeometryLoadObject: geometryId was not present in geometryCache");this.decrementGeometryCacheSize(n.sizeInBytes);const r={geometry:n,geometryId:e};dt(pt,it.GEOMETRY_CACHE_GEOMETRY_REMOVED,r),this._decacheGeometry(e)},this._decacheGeometry=e=>{const n=this._geometryCache.get(e);if(!n)return;const{geometryLoadObject:r}=n;r.cancelFn&&r.cancelFn(),r.decache&&r.decache(),this._geometryCache.delete(e)},this.incrementGeometryCacheSize=e=>{this._geometryCacheSize+=e},this.decrementGeometryCacheSize=e=>{this._geometryCacheSize-=e},this.getImageByReferencedImageId=e=>{const n=this._referencedImageIdToImageIdCache.get(e);if(n)return this._imageCache.get(n)?.image},this.getImage=(e,n=yl.FAR_REPLICATE)=>{if(e===void 0)throw new Error("getImage: imageId must not be undefined");const r=this._imageCache.get(e);if(r&&(r.timeStamp=Date.now(),!(r.image?.imageQualityStatus<n)))return r.image},this.getVolume=(e,n=!1)=>{if(e===void 0)throw new Error("getVolume: volumeId must not be undefined");const r=this._volumeCache.get(e);return r?(r.timeStamp=Date.now(),r.volume):n?[...this._volumeCache.values()].find(i=>i.volumeId.includes(e))?.volume:void 0},this.getVolumes=()=>Array.from(this._volumeCache.values()).map(n=>n.volume),this.filterVolumesByReferenceId=e=>this.getVolumes().filter(r=>r.referencedVolumeId===e),this.removeImageLoadObject=(e,{force:n=!1}={})=>{if(e===void 0)throw new Error("removeImageLoadObject: imageId must not be undefined");const r=this._imageCache.get(e);if(!r)throw new Error("removeImageLoadObject: imageId was not present in imageCache");this._decacheImage(e,n),this.incrementImageCacheSize(-r.sizeInBytes);const i={image:r,imageId:e};dt(pt,it.IMAGE_CACHE_IMAGE_REMOVED,i)},this.removeVolumeLoadObject=e=>{if(e===void 0)throw new Error("removeVolumeLoadObject: volumeId must not be undefined");const n=this._volumeCache.get(e);if(!n)throw new Error("removeVolumeLoadObject: volumeId was not present in volumeCache");const r={volume:n,volumeId:e};dt(pt,it.VOLUME_CACHE_VOLUME_REMOVED,r),this._decacheVolume(e)},this.incrementImageCacheSize=e=>{this._imageCacheSize+=e},this.decrementImageCacheSize=e=>{this._imageCacheSize-=e},this.getGeometryLoadObject=e=>{if(e===void 0)throw new Error("getGeometryLoadObject: geometryId must not be undefined");const n=this._geometryCache.get(e);if(n)return n.timeStamp=Date.now(),n.geometryLoadObject}}generateVolumeId(e){const n=e.map(ma).sort();let r=2166136261;for(const i of n){const a=Lxe(i);for(let o=0;o<a.length;o++)r^=a.charCodeAt(o),r+=(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24)}return`volume-${(r>>>0).toString(36)}`}getImageIdsForVolumeId(e){return Array.from(this._imageIdsToVolumeIdCache.entries()).filter(([n,r])=>r===e).map(([n])=>n)}getBytesAvailable(){return this.getMaxCacheSize()-this.getCacheSize()}decacheIfNecessaryUntilBytesAvailable(e,n){let r=this.getBytesAvailable();if(r>=e)return r;const i=Array.from(this._imageCache.values()).filter(c=>!c.sharedCacheKey);function a(c,l){return c.timeStamp>l.timeStamp?1:c.timeStamp<l.timeStamp?-1:0}i.sort(a);const o=i.map(c=>c.imageId);let s=o;n&&(s=o.filter(c=>!n.includes(c)));for(const c of s)if(this.removeImageLoadObject(c),dt(pt,it.IMAGE_CACHE_IMAGE_REMOVED,{imageId:c}),r=this.getBytesAvailable(),r>=e)return r;for(const c of o)if(this.removeImageLoadObject(c),dt(pt,it.IMAGE_CACHE_IMAGE_REMOVED,{imageId:c}),r=this.getBytesAvailable(),r>=e)return r}_putImageCommon(e,n,r){if(!this._imageCache.has(e)){console.warn("The image was purged from the cache before it completed loading.");return}if(!n){console.warn("Image is undefined");return}if(n.sizeInBytes===void 0||Number.isNaN(n.sizeInBytes))throw new Error("_putImageCommon: image.sizeInBytes must not be undefined");if(n.sizeInBytes.toFixed===void 0)throw new Error("_putImageCommon: image.sizeInBytes is not a number");if(!this.isCacheable(n.sizeInBytes))throw new Error(it.CACHE_SIZE_EXCEEDED);this.decacheIfNecessaryUntilBytesAvailable(n.sizeInBytes),r.loaded=!0,r.image=n,r.sizeInBytes=n.sizeInBytes,this.incrementImageCacheSize(r.sizeInBytes);const i={image:r};n.referencedImageId&&this._referencedImageIdToImageIdCache.set(n.referencedImageId,e),dt(pt,it.IMAGE_CACHE_IMAGE_ADDED,i),r.sharedCacheKey=n.sharedCacheKey}async putImageLoadObject(e,n){if(e===void 0)throw console.error("putImageLoadObject: imageId must not be undefined"),new Error("putImageLoadObject: imageId must not be undefined");if(n.promise===void 0)throw console.error("putImageLoadObject: imageLoadObject.promise must not be undefined"),new Error("putImageLoadObject: imageLoadObject.promise must not be undefined");const r=this._imageCache.get(e);if(r?.imageLoadObject)throw console.warn(`putImageLoadObject: imageId ${e} already in cache`),new Error("putImageLoadObject: imageId already in cache");if(n.cancelFn&&typeof n.cancelFn!="function")throw console.error("putImageLoadObject: imageLoadObject.cancel must be a function"),new Error("putImageLoadObject: imageLoadObject.cancel must be a function");const i={...r,loaded:!1,imageId:e,sharedCacheKey:void 0,imageLoadObject:n,timeStamp:Date.now(),sizeInBytes:0};return this._imageCache.set(e,i),n.promise.then(a=>{try{this._putImageCommon(e,a,i)}catch(o){throw console.debug(`Error in _putImageCommon for image ${e}:`,o),o}}).catch(a=>{throw console.debug(`Error caching image ${e}:`,a),this._imageCache.delete(e),a})}putImageSync(e,n){if(e===void 0)throw new Error("putImageSync: imageId must not be undefined");if(this._imageCache.has(e))throw new Error("putImageSync: imageId already in cache");const r={loaded:!1,imageId:e,sharedCacheKey:void 0,imageLoadObject:{promise:Promise.resolve(n)},timeStamp:Date.now(),sizeInBytes:0};this._imageCache.set(e,r);try{this._putImageCommon(e,n,r)}catch(i){throw this._imageCache.delete(e),i}}getImageLoadObject(e){if(e===void 0)throw new Error("getImageLoadObject: imageId must not be undefined");const n=this._imageCache.get(e);if(n)return n.timeStamp=Date.now(),n.imageLoadObject}isLoaded(e){const n=this._imageCache.get(e);return n?n.loaded:!1}getVolumeContainingImageId(e){const n=Array.from(this._volumeCache.keys()),r=ma(e);for(const i of n){const a=this._volumeCache.get(i);if(!a)return;const{volume:o}=a;if(!o.imageIds.length)return;const s=o.getImageURIIndex(r);if(s>-1)return{volume:o,imageIdIndex:s}}}getCachedImageBasedOnImageURI(e){const n=ma(e),i=Array.from(this._imageCache.keys()).find(a=>ma(a)===n);if(i)return this._imageCache.get(i)}_putVolumeCommon(e,n,r){if(!this._volumeCache.get(e)){console.warn("The volume was purged from the cache before it completed loading.");return}r.loaded=!0,r.volume=n,n.imageIds?.forEach(a=>{const o=this._imageCache.get(a);o&&(o.sharedCacheKey=e)});const i={volume:r};dt(pt,it.VOLUME_CACHE_VOLUME_ADDED,i)}putVolumeSync(e,n){if(e===void 0)throw new Error("putVolumeSync: volumeId must not be undefined");if(this._volumeCache.has(e))throw new Error("putVolumeSync: volumeId already in cache");const r={loaded:!1,volumeId:e,volumeLoadObject:{promise:Promise.resolve(n)},timeStamp:Date.now(),sizeInBytes:0};this._volumeCache.set(e,r);try{this._putVolumeCommon(e,n,r)}catch(i){throw this._volumeCache.delete(e),i}}async putVolumeLoadObject(e,n){if(e===void 0)throw new Error("putVolumeLoadObject: volumeId must not be undefined");if(n.promise===void 0)throw new Error("putVolumeLoadObject: volumeLoadObject.promise must not be undefined");if(this._volumeCache.has(e))throw new Error(`putVolumeLoadObject: volumeId:${e} already in cache`);if(n.cancelFn&&typeof n.cancelFn!="function")throw new Error("putVolumeLoadObject: volumeLoadObject.cancel must be a function");const r={loaded:!1,volumeId:e,volumeLoadObject:n,timeStamp:Date.now(),sizeInBytes:0};return this._volumeCache.set(e,r),n.promise.then(i=>{try{this._putVolumeCommon(e,i,r)}catch(a){throw console.error(`Error in _putVolumeCommon for volume ${e}:`,a),this._volumeCache.delete(e),a}}).catch(i=>{throw this._volumeCache.delete(e),i})}_putGeometryCommon(e,n,r){if(!this._geometryCache.get(e)){console.warn("The geometry was purged from the cache before it completed loading.");return}if(!n){console.warn("Geometry is undefined");return}if(n.sizeInBytes===void 0||Number.isNaN(n.sizeInBytes))throw new Error("_putGeometryCommon: geometry.sizeInBytes must not be undefined");if(n.sizeInBytes.toFixed===void 0)throw new Error("_putGeometryCommon: geometry.sizeInBytes is not a number");if(!this.isCacheable(n.sizeInBytes))throw new Error(it.CACHE_SIZE_EXCEEDED);this.decacheIfNecessaryUntilBytesAvailable(n.sizeInBytes),r.loaded=!0,r.geometry=n,r.sizeInBytes=n.sizeInBytes,this.incrementGeometryCacheSize(r.sizeInBytes);const i={geometry:r};dt(pt,it.GEOMETRY_CACHE_GEOMETRY_ADDED,i)}putGeometrySync(e,n){if(e===void 0)throw new Error("putGeometrySync: geometryId must not be undefined");if(this._geometryCache.has(e))throw new Error("putGeometrySync: geometryId already in cache");const r={loaded:!1,geometryId:e,geometryLoadObject:{promise:Promise.resolve(n)},timeStamp:Date.now(),sizeInBytes:0};this._geometryCache.set(e,r);try{this._putGeometryCommon(e,n,r)}catch(i){throw this._geometryCache.delete(e),i}}setPartialImage(e,n){const r=this._imageCache.get(e);if(!r){n&&this._imageCache.set(e,{image:n,imageId:e,loaded:!1,timeStamp:Date.now(),sizeInBytes:0});return}r.loaded&&(r.loaded=!1,r.imageLoadObject=null,this.incrementImageCacheSize(-r.sizeInBytes),r.sizeInBytes=0),r.image=n||r.image}getImageQuality(e){const n=this._imageCache.get(e)?.image;return n?n.imageQualityStatus||yl.FULL_RESOLUTION:void 0}}const Ct=new ISt;function Vxe(t,e,n){return Math.abs(t-e)<=n}function NSt(t,e,n=1e-5){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!Vxe(t[r],e[r],n))return!1;return!0}function kee(t){return typeof t=="number"}function Aee(t){return t&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>0&&typeof t[0]=="number"}function Lr(t,e,n=1e-5){return typeof t!=typeof e||t===null||e===null?!1:kee(t)&&kee(e)?Vxe(t,e,n):Aee(t)&&Aee(e)?NSt(t,e,n):!1}const $xe=t=>typeof t=="number"?-t:t?.map?t.map($xe):!t,ak=t=>typeof t=="number"?Math.abs(t):t?.map?t.map(ak):t,jxe=(t,e,n=void 0)=>Lr(t,$xe(e),n),kC=(t,e,n=void 0)=>Lr(ak(t),ak(e),n);function uo(t){return Array.isArray(t)?uo(t[0]):isFinite(t)&&!isNaN(t)}function nf(t){return tc(t,"vtkVolume")||tc(t,"vtkImageSlice")}function tc(t,e){const n="isA"in t?t:t.actor;return n?!!n.isA(e):!1}const eF=new Map;function PSt(t){t.name=t.name||t.Name,eF.set(t.name,t)}function Kw(t){return eF.get(t)}function Uxe(){return Array.from(eF.keys())}function tF(t,e){const n=qw.rgbPresetNames.map(c=>qw.getPresetByName(c)),r=Uxe().map(c=>Kw(c)),a=n.concat(r).find(c=>{const{RGBPoints:l}=c;if(l.length!==t.length)return!1;for(let u=0;u<l.length;u+=4)if(!Lr(l.slice(u+1,u+4),t.slice(u+1,u+4)))return!1;return!0});if(!a)return null;const o=[];if(tc(e,"vtkVolume")){const c=e.getProperty().getScalarOpacity(0).getDataPointer();if(!c)return{name:a.Name};for(let l=0;l<c.length;l+=2)o.push({value:c[l],opacity:c[l+1]})}return{name:a.Name,...Array.isArray(o)&&o.length>0&&{opacity:o},...typeof o=="number"&&{opacity:o}}}function kSt(t){const{volumeActor:e,preset:n,opacity:r=.9,threshold:i=null,colorRange:a=[0,5]}=t;e.getMapper().setSampleDistance(1);const s=yh.newInstance(),c=n||qw.getPresetByName("hsv");s.applyColorMap(c),s.setMappingRange(a[0],a[1]),e.getProperty().setRGBTransferFunction(0,s),nF(e,r,i)}function Fxe(t,e){const n=rF(t);nF(t,e,n)}function Bxe(t,e){const n=iF(t);nF(t,n,e)}function nF(t,e,n){const r=t.getMapper().getInputData().get("voxelManager");if(!r?.voxelManager)throw new Error("No voxel manager was found for the volume actor, or you cannot yet update opacity with a threshold using stacked images");const i=r.voxelManager.getRange(),a=l1.newInstance();if(n!==null){const o=Math.abs(i[1]-i[0])*.001,s=Math.max(i[0],Math.min(i[1],n));a.addPoint(i[0],0),a.addPoint(s-o,0),a.addPoint(s,e),a.addPoint(i[1],e)}else a.addPoint(i[0],e),a.addPoint(i[1],e);t.getProperty().setScalarOpacity(0,a)}function rF(t){const e=t.getProperty().getScalarOpacity(0);if(!e)return null;const n=e.getDataPointer();if(!n||n.length<=4)return null;for(let r=0;r<n.length-2;r+=2){n[r];const i=n[r+1],a=n[r+2],o=n[r+3];if(i===0&&o>0)return a}return null}function iF(t){const e=t.getProperty().getScalarOpacity(0);if(!e)return 1;const n=e.getDataPointer();if(!n||n.length===0)return 1;let r=0;for(let i=1;i<n.length;i+=2)n[i]>r&&(r=n[i]);return r}const ASt=Object.freeze(Object.defineProperty({__proto__:null,findMatchingColormap:tF,getColormap:Kw,getColormapNames:Uxe,getMaxOpacity:iF,getThresholdValue:rF,registerColormap:PSt,setColorMapTransferFunctionForVolumeActor:kSt,updateOpacity:Fxe,updateThreshold:Bxe},Symbol.toStringTag,{value:"Module"}));function Y5(t){if(!t)return;const e=t.getSize();for(let n=0;n<e;n++){const r=[];t.getNodeValue(n,r),r[1]=1-r[1],r[2]=1-r[2],r[3]=1-r[3],t.setNodeValue(n,r)}}const ok=(t,e,n)=>e-n/4*Math.log((1-t)/t);function m3(t,e){const n=Math.abs(e-t)+1,r=(t+e+1)/2;return{windowWidth:n,windowCenter:r}}function gy(t,e,n=ns.LINEAR){if(n===ns.LINEAR)return{lower:e-.5-(t-1)/2,upper:e-.5+(t-1)/2};if(n===ns.LINEAR_EXACT)return{lower:e-t/2,upper:e+t/2};if(n===ns.SAMPLED_SIGMOID){const r=ok(.01,e,t),i=ok(.99,e,t);return{lower:r,upper:i}}else throw new Error("Invalid VOI LUT function")}const LSt=Object.freeze(Object.defineProperty({__proto__:null,toLowHighRange:gy,toWindowLevel:m3},Symbol.toStringTag,{value:"Module"}));function aF(t,e=1024){const{windowWidth:n,windowCenter:r}=m3(t.lower,t.upper),a=Array.from({length:e},(s,c)=>(c+1)/(e+2)).flatMap(s=>[ok(s,r,n),s,s,s,.5,0]),o=yh.newInstance();return o.buildFunctionFromArray(On.newInstance({values:a,numberOfComponents:6})),o}function nd(t,e){return t.worldToIndex(e).map(Math.round)}function AC(t,e){return t.worldToIndex(e)}function GT(t){const e=t.getSize(),n=[];for(let r=0;r<e;r++){const i=[];t.getNodeValue(r,i),n.push(i)}return n}function BE(t,e){e?.length&&(t.removeAllPoints(),e.forEach(n=>{t.addRGBPoint(...n)}))}const VSt=Object.freeze(Object.defineProperty({__proto__:null,getTransferFunctionNodes:GT,setTransferFunctionNodes:BE},Symbol.toStringTag,{value:"Module"}));function $St(t,e){e.classHierarchy.push("vtkImplicitFunction"),t.functionValue=n=>{if(!e.transform)return t.evaluateFunction(n);const r=[];return e.transform.transformPoint(n,r),t.evaluateFunction(r)},t.evaluateFunction=n=>{se.vtkErrorMacro("not implemented")}}const jSt={};function zxe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,jSt,n),se.obj(t,e),se.setGet(t,e,["transform"]),$St(t,e)}const USt=se.newInstance(zxe,"vtkImplicitFunction");var FSt={newInstance:USt,extend:zxe};const sk=1e-6,Gxe="coincide",Wxe="disjoint";function BSt(t,e,n){return t[0]*(n[0]-e[0])+t[1]*(n[1]-e[1])+t[2]*(n[2]-e[2])}function Hxe(t,e,n){const r=n[0]*(t[0]-e[0])+n[1]*(t[1]-e[1])+n[2]*(t[2]-e[2]);return Math.abs(r)}function qxe(t,e,n,r){const i=[];J0(t,e,i);const a=Fn(n,i);r[0]=t[0]-a*n[0],r[1]=t[1]-a*n[1],r[2]=t[2]-a*n[2]}function Kxe(t,e,n){const r=Fn(t,e);let i=Fn(e,e);return i===0&&(i=1),n[0]=t[0]-r*e[0]/i,n[1]=t[1]-r*e[1]/i,n[2]=t[2]-r*e[2]/i,n}function Yxe(t,e,n,r){const i=[];J0(t,e,i);const a=Fn(n,i),o=Fn(n,n);o!==0?(r[0]=t[0]-a*n[0]/o,r[1]=t[1]-a*n[1]/o,r[2]=t[2]-a*n[2]/o):(r[0]=t[0],r[1]=t[1],r[2]=t[2])}function Xxe(t,e,n,r){const i={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},a=[],o=[];J0(e,t,a),J0(n,t,o);const s=Fn(r,o),c=Fn(r,a);let l,u;return c<0?l=-c:l=c,s<0?u=-s*sk:u=s*sk,l<=u||(i.t=s/c,i.x[0]=t[0]+i.t*a[0],i.x[1]=t[1]+i.t*a[1],i.x[2]=t[2]+i.t*a[2],i.intersection=!0,i.betweenPoints=i.t>=0&&i.t<=1),i}function Zxe(t,e,n,r){const i={intersection:!1,l0:[],l1:[],error:null},a=[];_d(e,r,a);const o=a.map(f=>Math.abs(f));if(o[0]+o[1]+o[2]<sk){const f=[];return J0(t,n,f),Fn(e,f)===0?i.error=Gxe:i.error=Wxe,i}let s;o[0]>o[1]&&o[0]>o[2]?s="x":o[1]>o[2]?s="y":s="z";const c=[],l=-Fn(e,t),u=-Fn(r,n);switch(s){case"x":c[0]=0,c[1]=(u*e[2]-l*r[2])/a[0],c[2]=(l*r[1]-u*e[1])/a[0];break;case"y":c[0]=(l*r[2]-u*e[2])/a[1],c[1]=0,c[2]=(u*e[0]-l*r[0])/a[1];break;case"z":c[0]=(u*e[1]-l*r[1])/a[2],c[1]=(l*r[0]-u*e[0])/a[2],c[2]=0;break}return i.l0=c,LT(c,a,i.l1),i.intersection=!0,i}const zSt={evaluate:BSt,distanceToPlane:Hxe,projectPoint:qxe,projectVector:Kxe,generalizedProjectPoint:Yxe,intersectWithLine:Xxe,intersectWithPlane:Zxe,DISJOINT:Wxe,COINCIDE:Gxe};function GSt(t,e){e.classHierarchy.push("vtkPlane"),t.distanceToPlane=n=>Hxe(n,e.origin,e.normal),t.projectPoint=(n,r)=>{qxe(n,e.origin,e.normal,r)},t.projectVector=(n,r)=>Kxe(n,e.normal,r),t.push=n=>{if(n!==0)for(let r=0;r<3;r++)e.origin[r]+=n*e.normal[r]},t.generalizedProjectPoint=(n,r)=>{Yxe(n,e.origin,e.normal,r)},t.evaluateFunction=(n,r,i)=>Array.isArray(n)?e.normal[0]*(n[0]-e.origin[0])+e.normal[1]*(n[1]-e.origin[1])+e.normal[2]*(n[2]-e.origin[2]):e.normal[0]*(n-e.origin[0])+e.normal[1]*(r-e.origin[1])+e.normal[2]*(i-e.origin[2]),t.evaluateGradient=n=>[e.normal[0],e.normal[1],e.normal[2]],t.intersectWithLine=(n,r)=>Xxe(n,r,e.origin,e.normal),t.intersectWithPlane=(n,r)=>Zxe(n,r,e.origin,e.normal)}const WSt={normal:[0,0,1],origin:[0,0,0]};function Qxe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,WSt,n),FSt.extend(t,e,n),se.setGetArray(t,e,["normal","origin"],3),GSt(t,e)}const HSt=se.newInstance(Qxe,"vtkPlane");var Os={newInstance:HSt,extend:Qxe,...zSt};const zE=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function Jxe(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]}function xh(t){return t?.length>=6&&t[0]<=t[1]&&t[2]<=t[3]&&t[4]<=t[5]}function oF(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function sF(t){return oF(t,zE)}function WT(t,e,n,r){const[i,a,o,s,c,l]=t;return t[0]=i<e?i:e,t[1]=a>e?a:e,t[2]=o<n?o:n,t[3]=s>n?s:n,t[4]=c<r?c:r,t[5]=l>r?l:r,t}function cF(t,e){if(e.length===0)return t;if(Array.isArray(e[0]))for(let n=0;n<e.length;++n)WT(t,...e[n]);else for(let n=0;n<e.length;n+=3)WT(t,...e.slice(n,n+3));return t}function e5e(t,e,n,r,i,a,o){const[s,c,l,u,f,d]=t;return o===void 0?(t[0]=Math.min(e[0],s),t[1]=Math.max(e[1],c),t[2]=Math.min(e[2],l),t[3]=Math.max(e[3],u),t[4]=Math.min(e[4],f),t[5]=Math.max(e[5],d)):(t[0]=Math.min(e,s),t[1]=Math.max(n,c),t[2]=Math.min(r,l),t[3]=Math.max(i,u),t[4]=Math.min(a,f),t[5]=Math.max(o,d)),t}function t5e(t,e,n,r){const[i,a,o,s,c,l]=t;return t[0]=e,t[1]=e>a?e:a,t[2]=n,t[3]=n>s?n:s,t[4]=r,t[5]=r>l?r:l,i!==e||o!==n||c!==r}function n5e(t,e,n,r){const[i,a,o,s,c,l]=t;return t[0]=e<i?e:i,t[1]=e,t[2]=n<o?n:o,t[3]=n,t[4]=r<c?r:c,t[5]=r,a!==e||s!==n||l!==r}function r5e(t,e){return t[0]-=e,t[1]+=e,t[2]-=e,t[3]+=e,t[4]-=e,t[5]+=e,t}function lF(t,e,n,r){return xh(t)?(e>=0?(t[0]*=e,t[1]*=e):(t[0]=e*t[1],t[1]=e*t[0]),n>=0?(t[2]*=n,t[3]*=n):(t[2]=n*t[3],t[3]=n*t[2]),r>=0?(t[4]*=r,t[5]*=r):(t[4]=r*t[5],t[5]=r*t[4]),!0):!1}function uF(t){return[.5*(t[0]+t[1]),.5*(t[2]+t[3]),.5*(t[4]+t[5])]}function qSt(t,e,n,r){if(!xh(t))return!1;const i=uF(t);return t[0]-=i[0],t[1]-=i[0],t[2]-=i[1],t[3]-=i[1],t[4]-=i[2],t[5]-=i[2],lF(t,e,n,r),t[0]+=i[0],t[1]+=i[0],t[2]+=i[1],t[3]+=i[1],t[4]+=i[2],t[5]+=i[2],!0}function X5(t,e){return t[e*2+1]-t[e*2]}function GE(t){return[X5(t,0),X5(t,1),X5(t,2)]}function i5e(t){return t.slice(0,2)}function a5e(t){return t.slice(2,4)}function o5e(t){return t.slice(4,6)}function s5e(t){const e=GE(t);return e[0]>e[1]?e[0]>e[2]?e[0]:e[2]:e[1]>e[2]?e[1]:e[2]}function c5e(t){if(xh(t)){const e=GE(t);return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])}return null}function fF(t){return[t[0],t[2],t[4]]}function dF(t){return[t[1],t[3],t[5]]}function CS(t,e){return t<=0&&e>=0||t>=0&&e<=0}function hF(t,e){let n=0;for(let r=0;r<2;r++)for(let i=2;i<4;i++)for(let a=4;a<6;a++)e[n++]=[t[r],t[i],t[a]];return e}function l5e(t,e,n){return e[0]=t[0],e[1]=t[2],e[2]=t[4],n[0]=t[1],n[1]=t[3],n[2]=t[5],e}function u5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];const r=hF(t,[]);for(let i=0;i<r.length;++i)gr(r[i],r[i],e);return sF(n),cF(n,r)}function f5e(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e[0]=.5*(t[1]-t[0]),e[1]=.5*(t[3]-t[2]),e[2]=.5*(t[5]-t[4]),e}function d5e(t,e,n,r){const i=[].concat(zE),a=t.getData();for(let o=0;o<a.length;o+=3){const s=[a[o],a[o+1],a[o+2]],c=Fn(s,e);i[0]=Math.min(c,i[0]),i[1]=Math.max(c,i[1]);const l=Fn(s,n);i[2]=Math.min(l,i[2]),i[3]=Math.max(l,i[3]);const u=Fn(s,r);i[4]=Math.min(u,i[4]),i[5]=Math.max(u,i[5])}return i}function h5e(t,e,n,r,i){let a=!0;const o=[];let s=0;const c=[],l=[0,0,0],u=0,f=1,d=2;for(let h=0;h<3;h++)e[h]<t[2*h]?(o[h]=f,l[h]=t[2*h],a=!1):e[h]>t[2*h+1]?(o[h]=u,l[h]=t[2*h+1],a=!1):o[h]=d;if(a)return r[0]=e[0],r[1]=e[1],r[2]=e[2],i[0]=0,1;for(let h=0;h<3;h++)o[h]!==d&&n[h]!==0?c[h]=(l[h]-e[h])/n[h]:c[h]=-1;for(let h=0;h<3;h++)c[s]<c[h]&&(s=h);if(c[s]>1||c[s]<0)return 0;i[0]=c[s];for(let h=0;h<3;h++)if(s!==h){if(r[h]=e[h]+c[s]*n[h],r[h]<t[2*h]||r[h]>t[2*h+1])return 0}else r[h]=l[h];return 1}function g5e(t,e,n){const r=[];let i=0,a=1,o=1;for(let s=4;s<=5;++s){r[2]=t[s];for(let c=2;c<=3;++c){r[1]=t[c];for(let l=0;l<=1;++l)if(r[0]=t[l],i=Os.evaluate(n,e,r),o&&(a=i>=0?1:-1,o=0),i===0||a>0&&i<0||a<0&&i>0)return 1}}return 0}function p5e(t,e){if(!(xh(t)&&xh(e)))return!1;const n=[0,0,0,0,0,0];let r;for(let i=0;i<3;i++)if(r=!1,e[i*2]>=t[i*2]&&e[i*2]<=t[i*2+1]?(r=!0,n[i*2]=e[i*2]):t[i*2]>=e[i*2]&&t[i*2]<=e[i*2+1]&&(r=!0,n[i*2]=t[i*2]),e[i*2+1]>=t[i*2]&&e[i*2+1]<=t[i*2+1]?(r=!0,n[i*2+1]=e[2*i+1]):t[i*2+1]>=e[i*2]&&t[i*2+1]<=e[i*2+1]&&(r=!0,n[i*2+1]=t[i*2+1]),!r)return!1;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],!0}function HT(t,e){if(!(xh(t)&&xh(e)))return!1;for(let n=0;n<3;n++)if(!(e[n*2]>=t[n*2]&&e[n*2]<=t[n*2+1])&&!(t[n*2]>=e[n*2]&&t[n*2]<=e[n*2+1])&&!(e[n*2+1]>=t[n*2]&&e[n*2+1]<=t[n*2+1])&&!(t[n*2+1]>=e[n*2]&&t[n*2+1]<=e[n*2+1]))return!1;return!0}function qT(t,e,n,r){return!(e<t[0]||e>t[1]||n<t[2]||n>t[3]||r<t[4]||r>t[5])}function KSt(t,e){return!(!HT(t,e)||!qT(t,...fF(e))||!qT(t,...dF(e)))}function m5e(t,e,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],i=[0,0,0,0,0,0,0,0];let a=0;for(let f=0;f<2;f++)for(let d=2;d<4;d++)for(let h=4;h<6;h++){const m=[t[f],t[d],t[h]];i[a++]=Os.evaluate(n,e,m)}let o=2;for(;o--&&!(CS(i[r[o][0]],i[r[o][4]])&&CS(i[r[o][1]],i[r[o][5]])&&CS(i[r[o][2]],i[r[o][6]])&&CS(i[r[o][3]],i[r[o][7]])););if(o<0)return!1;const s=Math.sign(n[o]),c=Math.abs((t[o*2+1]-t[o*2])*n[o]);let l=s>0?1:0;for(let f=0;f<4;f++){if(c===0)continue;const d=Math.abs(i[r[o][f]])/c;s>0&&d<l&&(l=d),s<0&&d>l&&(l=d)}const u=(1-l)*t[o*2]+l*t[o*2+1];return s>0?t[o*2]=u:t[o*2+1]=u,!0}class YSt{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(zE))}getBounds(){return this.bounds}equals(e){return Jxe(this.bounds,e)}isValid(){return xh(this.bounds)}setBounds(e){return oF(this.bounds,e)}reset(){return sF(this.bounds)}addPoint(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return WT(this.bounds,...n)}addPoints(e){return cF(this.bounds,e)}addBounds(e,n,r,i,a,o){return e5e(this.bounds,e,n,r,i,a,o)}setMinPoint(e,n,r){return t5e(this.bounds,e,n,r)}setMaxPoint(e,n,r){return n5e(this.bounds,e,n,r)}inflate(e){return r5e(this.bounds,e)}scale(e,n,r){return lF(this.bounds,e,n,r)}getCenter(){return uF(this.bounds)}getLength(e){return X5(this.bounds,e)}getLengths(){return GE(this.bounds)}getMaxLength(){return s5e(this.bounds)}getDiagonalLength(){return c5e(this.bounds)}getMinPoint(){return fF(this.bounds)}getMaxPoint(){return dF(this.bounds)}getXRange(){return i5e(this.bounds)}getYRange(){return a5e(this.bounds)}getZRange(){return o5e(this.bounds)}getCorners(e){return hF(this.bounds,e)}computeCornerPoints(e,n){return l5e(this.bounds,e,n)}computeLocalBounds(e,n,r){return d5e(this.bounds,e,n,r)}transformBounds(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return u5e(this.bounds,e,n)}computeScale3(e){return f5e(this.bounds,e)}cutWithPlane(e,n){return m5e(this.bounds,e,n)}intersectBox(e,n,r,i){return h5e(this.bounds,e,n,r,i)}intersectPlane(e,n){return g5e(this.bounds,e,n)}intersect(e){return p5e(this.bounds,e)}intersects(e){return HT(this.bounds,e)}containsPoint(e,n,r){return qT(this.bounds,e,n,r)}contains(e){return HT(this.bounds,e)}}function XSt(t){const e=t&&t.bounds;return new YSt(e)}const ZSt={equals:Jxe,isValid:xh,setBounds:oF,reset:sF,addPoint:WT,addPoints:cF,addBounds:e5e,setMinPoint:t5e,setMaxPoint:n5e,inflate:r5e,scale:lF,scaleAboutCenter:qSt,getCenter:uF,getLength:X5,getLengths:GE,getMaxLength:s5e,getDiagonalLength:c5e,getMinPoint:fF,getMaxPoint:dF,getXRange:i5e,getYRange:a5e,getZRange:o5e,getCorners:hF,computeCornerPoints:l5e,computeLocalBounds:d5e,transformBounds:u5e,computeScale3:f5e,cutWithPlane:m5e,intersectBox:h5e,intersectPlane:g5e,intersect:p5e,intersects:HT,containsPoint:qT,contains:KSt,INIT_BOUNDS:zE};var ci={newInstance:XSt,...ZSt};const QSt={DISPLAY:0,WORLD:1};var v5e={CoordinateSystem:QSt};const{CoordinateSystem:ck}=v5e;function Lee(t){return()=>se.vtkErrorMacro(`vtkProp::${t} - NOT IMPLEMENTED`)}function JSt(t,e){e.classHierarchy.push("vtkProp"),t.getMTime=()=>{let n=e.mtime;for(let r=0;r<e.textures.length;++r){const i=e.textures[r].getMTime();i>n&&(n=i)}return n},t.processSelectorPixelBuffers=(n,r)=>{},t.getNestedProps=()=>null,t.getActors=()=>[],t.getActors2D=()=>[],t.getVolumes=()=>[],t.pick=Lee("pick"),t.hasKey=Lee("hasKey"),t.getNestedVisibility=()=>e.visibility&&(!e._parentProp||e._parentProp.getNestedVisibility()),t.getNestedPickable=()=>e.pickable&&(!e._parentProp||e._parentProp.getNestedPickable()),t.getNestedDragable=()=>e.dragable&&(!e._parentProp||e._parentProp.getNestedDragable()),t.getRedrawMTime=()=>e.mtime,t.setEstimatedRenderTime=n=>{e.estimatedRenderTime=n,e.savedEstimatedRenderTime=n},t.restoreEstimatedRenderTime=()=>{e.estimatedRenderTime=e.savedEstimatedRenderTime},t.addEstimatedRenderTime=n=>{e.estimatedRenderTime+=n},t.setAllocatedRenderTime=n=>{e.allocatedRenderTime=n,e.savedEstimatedRenderTime=e.estimatedRenderTime,e.estimatedRenderTime=0},t.getSupportsSelection=()=>!1,t.getTextures=()=>e.textures,t.hasTexture=n=>e.textures.indexOf(n)!==-1,t.addTexture=n=>{n&&!t.hasTexture(n)&&(e.textures=e.textures.concat(n),t.modified())},t.removeTexture=n=>{const r=e.textures.filter(i=>i!==n);e.textures.length!==r.length&&(e.textures=r,t.modified())},t.removeAllTextures=()=>{e.textures=[],t.modified()},t.setCoordinateSystemToWorld=()=>t.setCoordinateSystem(ck.WORLD),t.setCoordinateSystemToDisplay=()=>t.setCoordinateSystem(ck.DISPLAY)}const eCt={allocatedRenderTime:10,coordinateSystem:ck.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function y5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,eCt,n),se.obj(t,e),se.get(t,e,["estimatedRenderTime","allocatedRenderTime"]),se.setGet(t,e,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),se.moveToProtected(t,e,["parentProp"]),JSt(t,e)}const tCt=se.newInstance(y5e,"vtkProp");var x5e={newInstance:tCt,extend:y5e,...v5e};const nCt=1e-6;function rCt(t,e){e.classHierarchy.push("vtkProp3D"),t.addPosition=r=>{e.position=e.position.map((i,a)=>i+r[a]),t.modified()},t.getOrientationWXYZ=()=>{const r=u1();ik(r,e.rotation);const i=new Float64Array(3),a=ESt(i,r);return[AT(a),i[0],i[1],i[2]]},t.getOrientationQuaternion=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return ik(r,e.rotation)},t.rotateX=r=>{r!==0&&(WU(e.rotation,e.rotation,Hi(r)),t.modified())},t.rotateY=r=>{r!==0&&(HU(e.rotation,e.rotation,Hi(r)),t.modified())},t.rotateZ=r=>{r!==0&&(qU(e.rotation,e.rotation,Hi(r)),t.modified())},t.rotateWXYZ=(r,i,a,o)=>{if(r===0||i===0&&a===0&&o===0)return;const s=Hi(r),c=u1();ZU(c,[i,a,o],s);const l=new Float64Array(16);UT(l,c),Xn(e.rotation,e.rotation,l),t.modified()},t.rotateQuaternion=r=>{if(Math.abs(r[3])>=1-nCt)return;const i=UT(new Float64Array(16),r);Xn(e.rotation,e.rotation,i),t.modified()},t.setOrientation=(r,i,a)=>r===e.orientation[0]&&i===e.orientation[1]&&a===e.orientation[2]?!1:(e.orientation=[r,i,a],sn(e.rotation),t.rotateZ(a),t.rotateX(r),t.rotateY(i),t.modified(),!0),t.setUserMatrix=r=>d3(e.userMatrix,r)?!1:(pa(e.userMatrix,r),t.modified(),!0),t.getMatrix=()=>(t.computeMatrix(),e.matrix),t.computeMatrix=()=>{if(t.getMTime()>e.matrixMTime.getMTime()){sn(e.matrix),e.userMatrix&&Xn(e.matrix,e.matrix,e.userMatrix),Ma(e.matrix,e.matrix,e.origin),Ma(e.matrix,e.matrix,e.position),Xn(e.matrix,e.matrix,e.rotation),Ed(e.matrix,e.matrix,e.scale),Ma(e.matrix,e.matrix,[-e.origin[0],-e.origin[1],-e.origin[2]]),cr(e.matrix,e.matrix),e.isIdentity=!0;for(let r=0;r<4;++r)for(let i=0;i<4;++i)(r===i?1:0)!==e.matrix[r+i*4]&&(e.isIdentity=!1);e.matrixMTime.modified()}},t.getCenter=()=>ci.getCenter(e.bounds),t.getLength=()=>ci.getLength(e.bounds),t.getXRange=()=>ci.getXRange(e.bounds),t.getYRange=()=>ci.getYRange(e.bounds),t.getZRange=()=>ci.getZRange(e.bounds),t.getUserMatrix=()=>e.userMatrix;function n(){t.computeMatrix()}t.onModified(n)}const iCt={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function w5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,iCt,n),x5e.extend(t,e,n),e.matrixMTime={},se.obj(e.matrixMTime),se.get(t,e,["bounds","isIdentity"]),se.getArray(t,e,["orientation"]),se.setGetArray(t,e,["origin","position","scale"],3),e.matrix=sn(new Float64Array(16)),e.rotation=sn(new Float64Array(16)),e.userMatrix=sn(new Float64Array(16)),e.transform=null,rCt(t,e)}const aCt=se.newInstance(w5e,"vtkProp3D");var gF={newInstance:aCt,extend:w5e};const lk={NEAREST:0,LINEAR:1,FAST_LINEAR:2},b5e={FRACTIONAL:0,PROPORTIONAL:1},LC={CUSTOM:0,ADDITIVE:1,COLORIZE:2};var S5e={InterpolationType:lk,OpacityMode:b5e,ColorMixPreset:LC};const{InterpolationType:E5,OpacityMode:oCt}=S5e,{vtkErrorMacro:MR}=se,VC=4;function sCt(t,e){e.classHierarchy.push("vtkVolumeProperty"),t.getMTime=()=>{let i=e.mtime,a;for(let o=0;o<VC;o++)e.componentData[o].colorChannels===1?e.componentData[o].grayTransferFunction&&(a=e.componentData[o].grayTransferFunction.getMTime(),i=i>a?i:a):e.componentData[o].colorChannels===3&&e.componentData[o].rGBTransferFunction&&(a=e.componentData[o].rGBTransferFunction.getMTime(),i=i>a?i:a),e.componentData[o].scalarOpacity&&(a=e.componentData[o].scalarOpacity.getMTime(),i=i>a?i:a),e.componentData[o].gradientOpacity&&(e.componentData[o].disableGradientOpacity||(a=e.componentData[o].gradientOpacity.getMTime(),i=i>a?i:a));return i},t.getColorChannels=i=>i<0||i>3?(MR("Bad index - must be between 0 and 3"),0):e.componentData[i].colorChannels,t.setGrayTransferFunction=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,o=!1;return e.componentData[i].grayTransferFunction!==a&&(e.componentData[i].grayTransferFunction=a,o=!0),e.componentData[i].colorChannels!==1&&(e.componentData[i].colorChannels=1,o=!0),o&&t.modified(),o},t.getGrayTransferFunction=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e.componentData[i].grayTransferFunction===null&&(e.componentData[i].grayTransferFunction=l1.newInstance(),e.componentData[i].grayTransferFunction.addPoint(0,0),e.componentData[i].grayTransferFunction.addPoint(1024,1),e.componentData[i].colorChannels!==1&&(e.componentData[i].colorChannels=1),t.modified()),e.componentData[i].grayTransferFunction},t.setRGBTransferFunction=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,o=!1;return e.componentData[i].rGBTransferFunction!==a&&(e.componentData[i].rGBTransferFunction=a,o=!0),e.componentData[i].colorChannels!==3&&(e.componentData[i].colorChannels=3,o=!0),o&&t.modified(),o},t.getRGBTransferFunction=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e.componentData[i].rGBTransferFunction===null&&(e.componentData[i].rGBTransferFunction=yh.newInstance(),e.componentData[i].rGBTransferFunction.addRGBPoint(0,0,0,0),e.componentData[i].rGBTransferFunction.addRGBPoint(1024,1,1,1),e.componentData[i].colorChannels!==3&&(e.componentData[i].colorChannels=3),t.modified()),e.componentData[i].rGBTransferFunction},t.setScalarOpacity=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e.componentData[i].scalarOpacity!==a?(e.componentData[i].scalarOpacity=a,t.modified(),!0):!1},t.getScalarOpacity=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e.componentData[i].scalarOpacity===null&&(e.componentData[i].scalarOpacity=l1.newInstance(),e.componentData[i].scalarOpacity.addPoint(0,1),e.componentData[i].scalarOpacity.addPoint(1024,1),t.modified()),e.componentData[i].scalarOpacity},t.setComponentWeight=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;if(i<0||i>=VC)return MR("Invalid index"),!1;const o=Math.min(1,Math.max(0,a));return e.componentData[i].componentWeight!==o?(e.componentData[i].componentWeight=o,t.modified(),!0):!1},t.getComponentWeight=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return i<0||i>=VC?(MR("Invalid index"),0):e.componentData[i].componentWeight},t.setInterpolationTypeToNearest=()=>t.setInterpolationType(E5.NEAREST),t.setInterpolationTypeToLinear=()=>t.setInterpolationType(E5.LINEAR),t.setInterpolationTypeToFastLinear=()=>t.setInterpolationType(E5.FAST_LINEAR),t.getInterpolationTypeAsString=()=>se.enumToString(E5,e.interpolationType),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode","forceNearestInterpolation"].forEach(i=>{const a=se.capitalize(i);t[`set${a}`]=(o,s)=>e.componentData[o][`${i}`]!==s?(e.componentData[o][`${i}`]=s,t.modified(),!0):!1}),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode","forceNearestInterpolation"].forEach(i=>{const a=se.capitalize(i);t[`get${a}`]=o=>e.componentData[o][`${i}`]})}const cCt={colorMixPreset:null,independentComponents:!0,interpolationType:E5.FAST_LINEAR,shade:!1,ambient:.1,diffuse:.7,specular:.2,specularPower:10,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function lCt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Object.assign(e,cCt,n),se.obj(t,e),!e.componentData){e.componentData=[];for(let r=0;r<VC;++r)e.componentData.push({colorChannels:1,grayTransferFunction:null,rGBTransferFunction:null,scalarOpacity:null,scalarOpacityUnitDistance:1,opacityMode:oCt.FRACTIONAL,gradientOpacityMinimumValue:0,gradientOpacityMinimumOpacity:0,gradientOpacityMaximumValue:1,gradientOpacityMaximumOpacity:1,useGradientOpacity:!1,componentWeight:1,forceNearestInterpolation:!1})}se.setGet(t,e,["colorMixPreset","independentComponents","interpolationType","shade","ambient","diffuse","specular","specularPower","useLabelOutline","labelOutlineOpacity"]),se.setGetArray(t,e,["labelOutlineThickness"]),sCt(t,e)}const uCt=se.newInstance(lCt,"vtkVolumeProperty");var fCt={newInstance:uCt,...S5e};const{vtkDebugMacro:dCt}=se;function hCt(t,e){e.classHierarchy.push("vtkVolume"),t.getVolumes=()=>t,t.makeProperty=fCt.newInstance,t.getProperty=()=>(e.property===null&&(e.property=t.makeProperty()),e.property),t.getBounds=()=>{if(e.mapper===null)return e.bounds;const n=e.mapper.getBounds();if(!n||n.length!==6)return n;if(n[0]>n[1])return e.mapperBounds=n.concat(),e.bounds=[1,-1,1,-1,1,-1],e.boundsMTime.modified(),n;const r=i=>i[0].map((a,o)=>i.map(s=>s[o]));if(!e.mapperBounds||!r([n,e.mapperBounds]).reduce((i,a)=>i&&a[0]===a[1],!0)||t.getMTime()>e.boundsMTime.getMTime()){dCt("Recomputing bounds..."),e.mapperBounds=n.map(o=>o);const i=[];ci.getCorners(n,i),t.computeMatrix();const a=new Float64Array(16);cr(a,e.matrix),i.forEach(o=>gr(o,o,a)),e.bounds[0]=e.bounds[2]=e.bounds[4]=Number.MAX_VALUE,e.bounds[1]=e.bounds[3]=e.bounds[5]=-Number.MAX_VALUE,e.bounds=e.bounds.map((o,s)=>s%2===0?i.reduce((c,l)=>c>l[s/2]?l[s/2]:c,o):i.reduce((c,l)=>c<l[(s-1)/2]?l[(s-1)/2]:c,o)),e.boundsMTime.modified()}return e.bounds},t.getMTime=()=>{let n=e.mtime;if(e.property!==null){const r=e.property.getMTime();n=r>n?r:n}return n},t.getRedrawMTime=()=>{let n=e.mtime;if(e.mapper!==null){let r=e.mapper.getMTime();n=r>n?r:n,e.mapper.getInput()!==null&&(e.mapper.getInputAlgorithm().update(),r=e.mapper.getInput().getMTime(),n=r>n?r:n)}return n}}const gCt={mapper:null,property:null,bounds:[1,-1,1,-1,1,-1]};function C5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,gCt,n),gF.extend(t,e,n),e.boundsMTime={},se.obj(e.boundsMTime),se.set(t,e,["property"]),se.setGet(t,e,["mapper"]),se.getArray(t,e,["bounds"],6),hCt(t,e)}const pCt=se.newInstance(C5e,"vtkVolume");var mCt={newInstance:pCt,extend:C5e};const{vtkErrorMacro:vCt}=se,yCt=["Build","Render"];function xCt(t,e){e.classHierarchy.push("vtkViewNode"),t.build=r=>{},t.render=r=>{},t.traverse=r=>{const i=r.getTraverseOperation(),a=t[i];if(a){a(r);return}t.apply(r,!0);for(let o=0;o<e.children.length;o++)e.children[o].traverse(r);t.apply(r,!1)},t.apply=(r,i)=>{const a=t[r.getOperation()];a&&a(i,r)},t.getViewNodeFor=r=>{if(e.renderable===r)return t;for(let i=0;i<e.children.length;++i){const o=e.children[i].getViewNodeFor(r);if(o)return o}},t.getFirstAncestorOfType=r=>e._parent?e._parent.isA(r)?e._parent:e._parent.getFirstAncestorOfType(r):null,t.getLastAncestorOfType=r=>{if(!e._parent)return null;const i=e._parent.getLastAncestorOfType(r);return i||(e._parent.isA(r)?e._parent:null)},t.addMissingNode=r=>{if(!r)return;const i=e._renderableChildMap.get(r);if(i!==void 0)return i.setVisited(!0),i;const a=t.createViewNode(r);if(a)return a.setParent(t),a.setVisited(!0),e._renderableChildMap.set(r,a),e.children.push(a),a},t.addMissingNodes=r=>{if(!(!r||!r.length))for(let i=0;i<r.length;++i){const a=r[i];t.addMissingNode(a)}},t.addMissingChildren=r=>{if(!(!r||!r.length))for(let i=0;i<r.length;++i){const a=r[i];if(e.children.indexOf(a)===-1){a.setParent(t),e.children.push(a);const s=a.getRenderable();s&&e._renderableChildMap.set(s,a)}a.setVisited(!0)}},t.removeNode=r=>{const i=e.children.findIndex(o=>o===r);if(i<0)return!1;const a=r.getRenderable();return a&&e._renderableChildMap.delete(a),r.delete(),e.children.splice(i,1),!0},t.prepareNodes=()=>{for(let r=0;r<e.children.length;++r)e.children[r].setVisited(!1)},t.setVisited=r=>{e.visited=r},t.removeUnusedNodes=()=>{let r=0;for(let i=0;i<e.children.length;++i){const a=e.children[i];if(a.getVisited())e.children[r++]=a,a.setVisited(!1);else{const s=a.getRenderable();s&&e._renderableChildMap.delete(s),a.delete()}}e.children.length=r},t.createViewNode=r=>{if(!e.myFactory)return vCt("Cannot create view nodes without my own factory"),null;const i=e.myFactory.createNode(r);return i&&i.setRenderable(r),i};const n=t.delete;t.delete=()=>{for(let r=0;r<e.children.length;r++)e.children[r].delete();n()}}const wCt={renderable:null,myFactory:null,children:[],visited:!1};function _5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,wCt,n),se.obj(t,e),se.event(t,e,"event"),e._renderableChildMap=new Map,se.get(t,e,["visited"]),se.setGet(t,e,["_parent","renderable","myFactory"]),se.getArray(t,e,["children"]),se.moveToProtected(t,e,["parent"]),xCt(t,e)}const bCt=se.newInstance(_5e,"vtkViewNode");var La={newInstance:bCt,extend:_5e,PASS_TYPES:yCt};function SCt(t,e){e.overrides||(e.overrides={}),e.classHierarchy.push("vtkViewNodeFactory"),t.createNode=n=>{if(n.isDeleted())return null;let r=0,i=n.getClassName(r++),a=!1;const o=Object.keys(e.overrides);for(;i&&!a;)o.indexOf(i)!==-1?a=!0:i=n.getClassName(r++);if(!a)return null;const s=e.overrides[i]();return s.setMyFactory(t),s}}const CCt={};function T5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,CCt,n),se.obj(t,e),SCt(t,e)}const _Ct=se.newInstance(T5e,"vtkViewNodeFactory");var pF={newInstance:_Ct,extend:T5e};const E5e=Object.create(null);function jo(t,e){E5e[t]=e}function TCt(t,e){e.classHierarchy.push("vtkOpenGLViewNodeFactory")}const ECt={};function O5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,ECt,n),e.overrides=E5e,pF.extend(t,e,n),TCt(t,e)}const OCt=se.newInstance(O5e,"vtkOpenGLViewNodeFactory");var DCt={newInstance:OCt,extend:O5e};function MCt(t,e){e.classHierarchy.push("vtkOpenGLCamera"),t.buildPass=n=>{n&&(e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer"),e._openGLRenderWindow=e._openGLRenderer.getParent(),e.context=e._openGLRenderWindow.getContext())},t.opaquePass=n=>{if(n){const r=e._openGLRenderer.getTiledSizeAndOrigin();e.context.viewport(r.lowerLeftU,r.lowerLeftV,r.usize,r.vsize),e.context.scissor(r.lowerLeftU,r.lowerLeftV,r.usize,r.vsize)}},t.translucentPass=t.opaquePass,t.zBufferPass=t.opaquePass,t.opaqueZBufferPass=t.opaquePass,t.volumePass=t.opaquePass,t.getKeyMatrices=n=>{if(n!==e.lastRenderer||e._openGLRenderWindow.getMTime()>e.keyMatrixTime.getMTime()||t.getMTime()>e.keyMatrixTime.getMTime()||n.getMTime()>e.keyMatrixTime.getMTime()||e.renderable.getMTime()>e.keyMatrixTime.getMTime()){pa(e.keyMatrices.wcvc,e.renderable.getViewMatrix()),FE(e.keyMatrices.normalMatrix,e.keyMatrices.wcvc),g3(e.keyMatrices.normalMatrix,e.keyMatrices.normalMatrix),cr(e.keyMatrices.wcvc,e.keyMatrices.wcvc);const r=e._openGLRenderer.getAspectRatio();pa(e.keyMatrices.vcpc,e.renderable.getProjectionMatrix(r,-1,1)),cr(e.keyMatrices.vcpc,e.keyMatrices.vcpc),Xn(e.keyMatrices.wcpc,e.keyMatrices.vcpc,e.keyMatrices.wcvc),e.keyMatrixTime.modified(),e.lastRenderer=n}return e.keyMatrices}}const RCt={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};function ICt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,RCt,n),La.extend(t,e,n),e.keyMatrixTime={},yi(e.keyMatrixTime),e.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},Ja(t,e,["context","keyMatrixTime"]),MCt(t,e)}const D5e=ri(ICt);var NCt={newInstance:D5e};jo("vtkCamera",D5e);const{vtkDebugMacro:PCt}=Rs;function kCt(t,e){e.classHierarchy.push("vtkOpenGLRenderer"),t.buildPass=n=>{if(n){if(!e.renderable)return;t.updateLights(),t.prepareNodes(),t.addMissingNode(e.renderable.getActiveCamera()),t.addMissingNodes(e.renderable.getViewPropsWithNestedProps()),t.removeUnusedNodes()}},t.updateLights=()=>{let n=0;const r=e.renderable.getLightsByReference();for(let i=0;i<r.length;++i)r[i].getSwitch()>0&&n++;return n||(PCt("No lights are on, creating one."),e.renderable.createLight()),n},t.zBufferPass=n=>{if(n){let r=0;const i=e.context;e.renderable.getTransparent()||(e.context.clearColor(1,0,0,1),r|=i.COLOR_BUFFER_BIT),e.renderable.getPreserveDepthBuffer()||(i.clearDepth(1),r|=i.DEPTH_BUFFER_BIT,e.context.depthMask(!0));const a=t.getTiledSizeAndOrigin();i.enable(i.SCISSOR_TEST),i.scissor(a.lowerLeftU,a.lowerLeftV,a.usize,a.vsize),i.viewport(a.lowerLeftU,a.lowerLeftV,a.usize,a.vsize),i.colorMask(!0,!0,!0,!0),r&&i.clear(r),i.enable(i.DEPTH_TEST)}},t.opaqueZBufferPass=n=>t.zBufferPass(n),t.cameraPass=n=>{n&&t.clear()},t.getAspectRatio=()=>{const n=e._parent.getSizeByReference(),r=e.renderable.getViewportByReference();return n[0]*(r[2]-r[0])/((r[3]-r[1])*n[1])},t.getTiledSizeAndOrigin=()=>{const n=e.renderable.getViewportByReference(),r=[0,0,1,1],i=n[0]-r[0],a=n[1]-r[1],o=e._parent.normalizedDisplayToDisplay(i,a),s=Math.round(o[0]),c=Math.round(o[1]),l=n[2]-r[0],u=n[3]-r[1],f=e._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(f[0])-s,h=Math.round(f[1])-c;return d<0&&(d=0),h<0&&(h=0),{usize:d,vsize:h,lowerLeftU:s,lowerLeftV:c}},t.clear=()=>{let n=0;const r=e.context;if(!e.renderable.getTransparent()){const a=e.renderable.getBackgroundByReference();r.clearColor(a[0],a[1],a[2],a[3]),n|=r.COLOR_BUFFER_BIT}e.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,r.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const i=t.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(i.lowerLeftU,i.lowerLeftV,i.usize,i.vsize),r.viewport(i.lowerLeftU,i.lowerLeftV,i.usize,i.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},t.releaseGraphicsResources=()=>{e.selector!==null&&e.selector.releaseGraphicsResources(),e.renderable&&e.renderable.getViewProps().forEach(n=>{n.modified()})},t.setOpenGLRenderWindow=n=>{e._openGLRenderWindow!==n&&(t.releaseGraphicsResources(),e._openGLRenderWindow=n,e.context=null,n&&(e.context=e._openGLRenderWindow.getContext()))}}const ACt={context:null,_openGLRenderWindow:null,selector:null};function LCt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,ACt,n),La.extend(t,e,n),sc(t,e,["shaderCache"]),Ja(t,e,["selector"]),l3(t,e,["openGLRenderWindow"]),kCt(t,e)}const M5e=ri(LCt,"vtkOpenGLRenderer");var VCt={newInstance:M5e};jo("vtkRenderer",M5e);function R5e(t){let e=0;return t.filter((n,r)=>r===e?(e+=n+1,!0):!1)}function I5e(t){let e=0;for(let n=0;n<t.length;)n+=t[n]+1,e++;return e}const $Ct={extractCellSizes:R5e,getNumberOfCells:I5e};function jCt(t,e){e.classHierarchy.push("vtkCellArray");const n={...t};t.getNumberOfCells=r=>(e.numberOfCells!==void 0&&!r||(e.cellSizes?e.numberOfCells=e.cellSizes.length:e.numberOfCells=I5e(t.getData())),e.numberOfCells),t.getCellSizes=r=>(e.cellSizes!==void 0&&!r||(e.cellSizes=R5e(t.getData())),e.cellSizes),t.resize=r=>{const i=t.getNumberOfTuples();n.resize(r);const a=t.getNumberOfTuples();a<i&&(a===0?(e.numberOfCells=0,e.cellSizes=[]):(e.numberOfCells=void 0,e.cellSizes=void 0))},t.setData=r=>{n.setData(r,1),e.numberOfCells=void 0,e.cellSizes=void 0},t.getCell=r=>{let i=r;const a=e.values[i++];return e.values.subarray(i,i+a)},t.insertNextCell=r=>{const i=t.getNumberOfCells();return t.insertNextTuples([r.length,...r]),++e.numberOfCells,e.cellSizes!=null&&e.cellSizes.push(r.length),i}}function UCt(t){return{empty:!0,numberOfComponents:1,dataType:zn.UNSIGNED_INT,...t}}function N5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};On.extend(t,e,UCt(n)),jCt(t,e)}const FCt=se.newInstance(N5e,"vtkCellArray");var f1={newInstance:FCt,extend:N5e,...$Ct};const{vtkErrorMacro:BCt}=se,zCt=[1,-1,1,-1,1,-1];function GCt(t,e){e.classHierarchy.push("vtkPoints"),t.getNumberOfPoints=t.getNumberOfTuples,t.setNumberOfPoints=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3;t.getNumberOfPoints()!==n&&(e.size=n*r,e.values=se.newTypedArray(e.dataType,e.size),t.setNumberOfComponents(r),t.modified())},t.setPoint=function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];t.setTuple(n,i)},t.getPoint=t.getTuple,t.findPoint=t.findTuple,t.insertNextPoint=(n,r,i)=>t.insertNextTuple([n,r,i]),t.getBounds=()=>{if(t.getNumberOfComponents()===3){const i=t.getRange(0);e.bounds[0]=i[0],e.bounds[1]=i[1];const a=t.getRange(1);e.bounds[2]=a[0],e.bounds[3]=a[1];const o=t.getRange(2);return e.bounds[4]=o[0],e.bounds[5]=o[1],e.bounds}if(t.getNumberOfComponents()!==2)return BCt(`getBounds called on an array with components of
        ${t.getNumberOfComponents()}`),zCt;const n=t.getRange(0);e.bounds[0]=n[0],e.bounds[1]=n[1];const r=t.getRange(1);return e.bounds[2]=r[0],e.bounds[3]=r[1],e.bounds[4]=0,e.bounds[5]=0,e.bounds},t.computeBounds=t.getBounds,t.setNumberOfComponents(e.numberOfComponents<2?3:e.numberOfComponents)}const WCt={empty:!0,numberOfComponents:3,dataType:zn.FLOAT,bounds:[1,-1,1,-1,1,-1]};function P5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,WCt,n),On.extend(t,e,n),GCt(t,e)}const HCt=se.newInstance(P5e,"vtkPoints");var uk={newInstance:HCt,extend:P5e};function qCt(t,e){e.classHierarchy.push("vtkCell"),t.initialize=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(r){e.pointsIds=r;let i=e.points.getData();i.length!==3*e.pointsIds.length&&(i=se.newTypedArray(n.getDataType(),3*e.pointsIds.length));const a=n.getData();e.pointsIds.forEach((o,s)=>{let c=3*o,l=3*s;i[l]=a[c],i[++l]=a[++c],i[++l]=a[++c]}),e.points.setData(i)}else{e.points=n,e.pointsIds=new Array(n.getNumberOfPoints());for(let i=n.getNumberOfPoints()-1;i>=0;--i)e.pointsIds[i]=i}},t.getBounds=()=>{const n=e.points.getNumberOfPoints(),r=[];if(n){e.points.getPoint(0,r),e.bounds[0]=r[0],e.bounds[1]=r[0],e.bounds[2]=r[1],e.bounds[3]=r[1],e.bounds[4]=r[2],e.bounds[5]=r[2];for(let i=1;i<n;i++)e.points.getPoint(i,r),e.bounds[0]=r[0]<e.bounds[0]?r[0]:e.bounds[0],e.bounds[1]=r[0]>e.bounds[1]?r[0]:e.bounds[1],e.bounds[2]=r[1]<e.bounds[2]?r[1]:e.bounds[2],e.bounds[3]=r[1]>e.bounds[3]?r[1]:e.bounds[3],e.bounds[4]=r[2]<e.bounds[4]?r[2]:e.bounds[4],e.bounds[5]=r[2]>e.bounds[5]?r[2]:e.bounds[5]}else P2(e.bounds);return e.bounds},t.getLength2=()=>{t.getBounds();let n=0,r=0;for(let i=0;i<3;i++)r=e.bounds[2*i+1]-e.bounds[2*i],n+=r*r;return n},t.getParametricDistance=n=>{let r,i=0;for(let a=0;a<3;a++)n[a]<0?r=-n[a]:n[a]>1?r=n[a]-1:r=0,r>i&&(i=r);return i},t.getNumberOfPoints=()=>e.points.getNumberOfPoints(),t.deepCopy=n=>{n.initialize(e.points,e.pointsIds)},t.getCellDimension=()=>{},t.intersectWithLine=(n,r,i,a,o,s,c)=>{},t.evaluatePosition=(n,r,i,a,o,s)=>{se.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const KCt={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function k5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,KCt,n),se.obj(t,e),e.points||(e.points=uk.newInstance()),se.get(t,e,["points","pointsIds"]),qCt(t,e)}const YCt=se.newInstance(k5e,"vtkCell");var KT={newInstance:YCt,extend:k5e};function XCt(t,e){let n=e;for(e>=t.array.length&&(n+=t.array.length);n>t.array.length;)t.array.push({ncells:0,cells:null});t.array.length=n}function ZCt(t,e){e.classHierarchy.push("vtkCellLinks"),t.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),i=n.getNumberOfCells(),a=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let o=0;o<i;++o){const{cellPointIds:s}=n.getCellPoints(o);s.forEach(c=>{t.incrementLinkCount(c)})}t.allocateLinks(r),e.maxId=r-1;for(let o=0;o<i;++o){const{cellPointIds:s}=n.getCellPoints(o);s.forEach(c=>{t.insertCellReference(c,a[c]++,o)})}}else{for(let o=0;o<i;o++)KT.newInstance().getPointsIds().forEach(c=>{t.incrementLinkCount(c)});t.allocateLinks(r),e.maxId=r-1;for(let o=0;o<i;++o)KT.newInstance().getPointsIds().forEach(c=>{t.insertCellReference(c,a[c]++,o)})}},t.allocate=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e3;e.array=Array(n).fill().map(()=>({ncells:0,cells:null})),e.extend=r,e.maxId=-1},t.initialize=()=>{e.array=null},t.getLink=n=>e.array[n],t.getNcells=n=>e.array[n].ncells,t.getCells=n=>e.array[n].cells,t.insertNextPoint=n=>{e.array.push({ncells:n,cells:Array(n)}),++e.maxId},t.insertNextCellReference=(n,r)=>{e.array[n].cells[e.array[n].ncells++]=r},t.deletePoint=n=>{e.array[n].ncells=0,e.array[n].cells=null},t.removeCellReference=(n,r)=>{e.array[r].cells=e.array[r].cells.filter(i=>i!==n),e.array[r].ncells=e.array[r].cells.length},t.addCellReference=(n,r)=>{e.array[r].cells[e.array[r].ncells++]=n},t.resizeCellList=(n,r)=>{e.array[n].cells.length=r},t.squeeze=()=>{XCt(e,e.maxId+1)},t.reset=()=>{e.maxId=-1},t.deepCopy=n=>{e.array=[...n.array],e.extend=n.extend,e.maxId=n.maxId},t.incrementLinkCount=n=>{++e.array[n].ncells},t.allocateLinks=n=>{for(let r=0;r<n;++r)e.array[r].cells=new Array(e.array[r].ncells)},t.insertCellReference=(n,r,i)=>{e.array[n].cells[r]=i}}const QCt={array:null,maxId:0,extend:0};function A5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,QCt,n),se.obj(t,e),ZCt(t,e)}const JCt=se.newInstance(A5e,"vtkCellLinks");var e_t={newInstance:JCt,extend:A5e};const hi={VTK_EMPTY_CELL:0,VTK_VERTEX:1,VTK_POLY_VERTEX:2,VTK_LINE:3,VTK_POLY_LINE:4,VTK_TRIANGLE:5,VTK_TRIANGLE_STRIP:6,VTK_POLYGON:7,VTK_QUAD:9,VTK_QUADRATIC_EDGE:21,VTK_CONVEX_POINT_SET:41,VTK_POLYHEDRON:42},fk=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"];function t_t(t){return t<fk.length?fk[t]:"UnknownClass"}function n_t(t){return fk.findIndex(t)}function r_t(t){return t<hi.VTK_QUADRATIC_EDGE||t===hi.VTK_CONVEX_POINT_SET||t===hi.VTK_POLYHEDRON}function i_t(t){return t===hi.VTK_TRIANGLE_STRIP||t===hi.VTK_POLY_LINE||t===hi.VTK_POLY_VERTEX}const a_t={getClassNameFromTypeId:t_t,getTypeIdFromClassName:n_t,isLinear:r_t,hasSubCells:i_t};function o_t(t,e){e.classHierarchy.push("vtkCellTypes"),t.allocate=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:512,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e3;e.size=n>0?n:1,e.extend=r>0?r:1,e.maxId=-1,e.typeArray=new Uint8Array(n),e.locationArray=new Uint32Array(n)},t.insertCell=(n,r,i)=>{e.typeArray[n]=r,e.locationArray[n]=i,n>e.maxId&&(e.maxId=n)},t.insertNextCell=(n,r)=>(t.insertCell(++e.maxId,n,r),e.maxId),t.setCellTypes=(n,r,i)=>{e.size=n,e.typeArray=r,e.locationArray=i,e.maxId=n-1},t.getCellLocation=n=>e.locationArray[n],t.deleteCell=n=>{e.typeArray[n]=hi.VTK_EMPTY_CELL},t.getNumberOfTypes=()=>e.maxId+1,t.isType=n=>{const r=t.getNumberOfTypes();for(let i=0;i<r;++i)if(n===t.getCellType(i))return!0;return!1},t.insertNextType=n=>t.insertNextCell(n,-1),t.getCellType=n=>e.typeArray[n],t.reset=()=>{e.maxId=-1},t.deepCopy=n=>{t.allocate(n.getSize(),n.getExtend()),e.typeArray.set(n.getTypeArray()),e.locationArray.set(n.getLocationArray()),e.maxId=n.getMaxId()}}const s_t={size:0,maxId:-1,extend:1e3};function L5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,s_t,n),se.obj(t,e),se.get(t,e,["size","maxId","extend"]),se.getArray(t,e,["typeArray","locationArray"]),o_t(t,e)}const c_t=se.newInstance(L5e,"vtkCellTypes");var l_t={newInstance:c_t,extend:L5e,...a_t};const u_t={NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2};var V5e={IntersectionState:u_t};const{IntersectionState:$C}=V5e;function Wv(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;const i={t:Number.MIN_VALUE,distance:0},a=[];let o;a[0]=n[0]-e[0],a[1]=n[1]-e[1],a[2]=n[2]-e[2];const s=a[0]*(t[0]-e[0])+a[1]*(t[1]-e[1])+a[2]*(t[2]-e[2]),c=Fn(a,a);let l=1e-5*s;return c!==0&&(i.t=s/c),l<0&&(l=-l),-l<c&&c<l||c<=0||i.t<0?o=e:i.t>1?o=n:(o=a,a[0]=e[0]+i.t*a[0],a[1]=e[1]+i.t*a[1],a[2]=e[2]+i.t*a[2]),r&&(r[0]=o[0],r[1]=o[1],r[2]=o[2]),i.distance=Zf(o,t),i}function $5e(t,e,n,r,i,a){const o=[],s=[],c=[];i[0]=0,a[0]=0,J0(e,t,o),J0(r,n,s),J0(n,t,c);const l=[Fn(o,o),-Fn(o,s),-Fn(o,s),Fn(s,s)],u=[];if(u[0]=Fn(o,c),u[1]=-Fn(s,c),ixe(l,u,2)===0){let f=Number.MAX_VALUE;const d=[t,e,n,r],h=[n,n,t,t],m=[r,r,e,e];a[0],a[0],i[0],i[0],i[0],i[0],a[0],a[0];let p;for(let y=0;y<4;y++)p=Wv(d[y],h[y],m[y]),p.distance<f&&(f=p.distance,p.t);return $C.ON_LINE}return i[0]=u[0],a[0]=u[1],i[0]>=0&&i[0]<=1&&a[0]>=0&&a[0]<=1?$C.YES_INTERSECTION:$C.NO_INTERSECTION}const f_t={distanceToLine:Wv,intersection:$5e};function d_t(t,e){e.classHierarchy.push("vtkLine");function n(r){return r>=0&&r<=1}t.getCellDimension=()=>1,t.intersectWithLine=(r,i,a,o,s)=>{const c={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};s[1]=0,s[2]=0;const l=[],u=[],f=[];e.points.getPoint(0,u),e.points.getPoint(1,f);const d=[],h=[],m=$5e(r,i,u,f,d,h);if(c.t=d[0],c.betweenPoints=n(c.t),s[0]=h[0],m===$C.YES_INTERSECTION){for(let p=0;p<3;p++)o[p]=u[p]+s[0]*(f[p]-u[p]),l[p]=r[p]+c.t*(i[p]-r[p]);if(Zf(o,l)<=a*a)return c.intersect=1,c}else{let p;if(c.t<0)return p=Wv(r,u,f,o),p.distance<=a*a&&(c.t=0,c.intersect=1,c.betweenPoints=!0),c;if(c.t>1)return p=Wv(i,u,f,o),p.distance<=a*a&&(c.t=1,c.intersect=1,c.betweenPoints=!0),c;if(s[0]<0)return s[0]=0,p=Wv(u,r,i,o),c.t=p.t,p.distance<=a*a&&(c.intersect=1),c;if(s[0]>1)return s[0]=1,p=Wv(f,r,i,o),c.t=p.t,p.distance<=a*a&&(c.intersect=1),c}return c},t.evaluateLocation=(r,i,a)=>{const o=[],s=[];e.points.getPoint(0,o),e.points.getPoint(1,s);for(let c=0;c<3;c++)i[c]=o[c]+r[0]*(s[c]-o[c]);a[0]=1-r[0],a[1]=r[0]},t.evaluateOrientation=(r,i,a)=>e.orientations?(PC(i,e.orientations[0],e.orientations[1],r[0]),a[0]=1-r[0],a[1]=r[0],!0):!1}const h_t={orientations:null};function j5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,h_t,n),KT.extend(t,e,n),se.setGet(t,e,["orientations"]),d_t(t,e)}const g_t=se.newInstance(j5e,"vtkLine");var cu={newInstance:g_t,extend:j5e,...f_t,...V5e};const{vtkErrorMacro:Vee,vtkWarningMacro:p_t}=se;function m_t(t,e){e.classHierarchy.push("vtkFieldData");const n=t.getState;e.arrays&&(e.arrays=e.arrays.map(r=>({data:sf(r.data)}))),t.initialize=()=>{t.initializeFields(),t.copyAllOn(),t.clearFieldFlags()},t.initializeFields=()=>{e.arrays=[],e.copyFieldFlags={},t.modified()},t.copyStructure=r=>{t.initializeFields(),e.copyFieldFlags=r.getCopyFieldFlags().map(i=>i),e.arrays=r.arrays().map(i=>({array:i}))},t.getNumberOfArrays=()=>e.arrays.length,t.getNumberOfActiveArrays=()=>e.arrays.length,t.addArray=r=>{const i=r.getName(),{array:a,index:o}=t.getArrayWithIndex(i);return a!=null?(e.arrays[o]={data:r},o):(e.arrays=[].concat(e.arrays,{data:r}),e.arrays.length-1)},t.removeAllArrays=()=>{e.arrays=[]},t.removeArray=r=>{const i=e.arrays.findIndex(a=>a.data.getName()===r);return t.removeArrayByIndex(i)},t.removeArrayByIndex=r=>r!==-1&&r<e.arrays.length?(e.arrays.splice(r,1),!0):!1,t.getArrays=()=>e.arrays.map(r=>r.data),t.getArray=r=>typeof r=="number"?t.getArrayByIndex(r):t.getArrayByName(r),t.getArrayByName=r=>e.arrays.reduce((i,a,o)=>a.data.getName()===r?a.data:i,null),t.getArrayWithIndex=r=>{const i=e.arrays.findIndex(a=>a.data.getName()===r);return{array:i!==-1?e.arrays[i].data:null,index:i}},t.getArrayByIndex=r=>r>=0&&r<e.arrays.length?e.arrays[r].data:null,t.hasArray=r=>t.getArrayWithIndex(r).index>=0,t.getArrayName=r=>{const i=e.arrays[r];return i?i.data.getName():""},t.getCopyFieldFlags=()=>e.copyFieldFlags,t.getFlag=r=>e.copyFieldFlags[r],t.passData=function(r){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1;r.getArrays().forEach(o=>{const s=t.getFlag(o.getName());if(s!==!1&&!(e.doCopyAllOff&&s!==!0)&&o){let c=t.getArrayByName(o.getName());if(c)if(o.getNumberOfComponents()===c.getNumberOfComponents())if(i>-1&&i<o.getNumberOfTuples()){const l=a>-1?a:i;c.insertTuple(l,o.getTuple(i))}else c.insertTuples(0,o.getTuples());else Vee("Unhandled case in passData");else if(i<0||i>o.getNumberOfTuples())t.addArray(o),r.getAttributes(o).forEach(l=>{t.setAttribute(o,l)});else{const l=o.getNumberOfComponents();let u=o.getNumberOfValues();const f=a>-1?a:i;u<=f*l&&(u=(f+1)*l),c=On.newInstance({name:o.getName(),dataType:o.getDataType(),numberOfComponents:l,values:se.newTypedArray(o.getDataType(),u),size:0}),c.insertTuple(f,o.getTuple(i)),t.addArray(c),r.getAttributes(o).forEach(d=>{t.setAttribute(c,d)})}}})},t.interpolateData=function(r){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:.5;r.getArrays().forEach(c=>{const l=t.getFlag(c.getName());if(l!==!1&&!(e.doCopyAllOff&&l!==!0)&&c){let u=t.getArrayByName(c.getName());if(u)if(c.getNumberOfComponents()===u.getNumberOfComponents())if(i>-1&&i<c.getNumberOfTuples()){const f=o>-1?o:i;u.interpolateTuple(f,c,i,c,a,s),p_t("Unexpected case in interpolateData")}else u.insertTuples(c.getTuples());else Vee("Unhandled case in interpolateData");else if(i<0||a<0||i>c.getNumberOfTuples())t.addArray(c),r.getAttributes(c).forEach(f=>{t.setAttribute(c,f)});else{const f=c.getNumberOfComponents();let d=c.getNumberOfValues();const h=o>-1?o:i;d<=h*f&&(d=(h+1)*f),u=On.newInstance({name:c.getName(),dataType:c.getDataType(),numberOfComponents:f,values:se.newTypedArray(c.getDataType(),d),size:0}),u.interpolateTuple(h,c,i,c,a,s),t.addArray(u),r.getAttributes(c).forEach(m=>{t.setAttribute(u,m)})}}})},t.copyFieldOn=r=>{e.copyFieldFlags[r]=!0},t.copyFieldOff=r=>{e.copyFieldFlags[r]=!1},t.copyAllOn=()=>{(!e.doCopyAllOn||e.doCopyAllOff)&&(e.doCopyAllOn=!0,e.doCopyAllOff=!1,t.modified())},t.copyAllOff=()=>{(e.doCopyAllOn||!e.doCopyAllOff)&&(e.doCopyAllOn=!1,e.doCopyAllOff=!0,t.modified())},t.clearFieldFlags=()=>{e.copyFieldFlags={}},t.deepCopy=r=>{e.arrays=r.getArrays().map(i=>{const a=i.newClone();return a.deepCopy(i),{data:a}})},t.copyFlags=r=>r.getCopyFieldFlags().map(i=>i),t.reset=()=>e.arrays.forEach(r=>r.data.reset()),t.getMTime=()=>e.arrays.reduce((r,i)=>i.data.getMTime()>r?i.data.getMTime():r,e.mtime),t.getNumberOfComponents=()=>e.arrays.reduce((r,i)=>r+i.data.getNumberOfComponents(),0),t.getNumberOfTuples=()=>e.arrays.length>0?e.arrays[0].getNumberOfTuples():0,t.getState=()=>{const r=n();return r&&(r.arrays=e.arrays.map(i=>({data:i.data.getState()}))),r}}const v_t={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function U5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,v_t,n),se.obj(t,e),m_t(t,e)}const y_t=se.newInstance(U5e,"vtkFieldData");var x_t={newInstance:y_t,extend:U5e};const w_t={SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},b_t={MAX:0,EXACT:1,NOLIMIT:2},S_t={DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},C_t={DUPLICATEPOINT:1,HIDDENPOINT:2},__t={COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},T_t="vtkGhostType",E_t={DEFAULT:0,SINGLE:1,DOUBLE:2};var F5e={AttributeCopyOperations:__t,AttributeLimitTypes:b_t,AttributeTypes:w_t,CellGhostTypes:S_t,DesiredOutputPrecision:E_t,PointGhostTypes:C_t,ghostArrayName:T_t};const{AttributeTypes:og,AttributeCopyOperations:Bp}=F5e,{vtkWarningMacro:_S}=se;function O_t(t,e){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(o){let s=n.find(c=>og[c.toUpperCase()]===o||typeof o!="number"&&c.toLowerCase()===o.toLowerCase());return typeof s>"u"&&(s=null),s}e.classHierarchy.push("vtkDataSetAttributes");const i={...t};t.checkNumberOfComponents=o=>!0,t.setAttribute=(o,s)=>{const c=r(s);if(o&&c.toUpperCase()==="PEDIGREEIDS"&&!o.isA("vtkDataArray"))return _S(`Cannot set attribute ${c}. The attribute must be a vtkDataArray.`),-1;if(o&&!t.checkNumberOfComponents(o,c))return _S(`Cannot set attribute ${c}. Incorrect number of components.`),-1;let l=e[`active${c}`];if(l>=0&&l<e.arrays.length){if(e.arrays[l]===o)return l;t.removeArrayByIndex(l)}return o?(l=t.addArray(o),e[`active${c}`]=l):e[`active${c}`]=-1,t.modified(),e[`active${c}`]},t.getAttributes=o=>n.filter(s=>t[`get${s}`]()===o),t.setActiveAttributeByName=(o,s)=>t.setActiveAttributeByIndex(t.getArrayWithIndex(o).index,s),t.setActiveAttributeByIndex=(o,s)=>{const c=r(s);if(o>=0&&o<e.arrays.length){if(c.toUpperCase()!=="PEDIGREEIDS"){const l=t.getArrayByIndex(o);if(!l.isA("vtkDataArray"))return _S(`Cannot set attribute ${c}. Only vtkDataArray subclasses can be set as active attributes.`),-1;if(!t.checkNumberOfComponents(l,c))return _S(`Cannot set attribute ${c}. Incorrect number of components.`),-1}return e[`active${c}`]=o,t.modified(),o}return o===-1&&(e[`active${c}`]=o,t.modified()),-1},t.getActiveAttribute=o=>{const s=r(o);return t[`get${s}`]()},t.removeAllArrays=()=>{n.forEach(o=>{e[`active${o}`]=-1}),i.removeAllArrays()},t.removeArrayByIndex=o=>(o!==-1&&n.forEach(s=>{o===e[`active${s}`]?e[`active${s}`]=-1:o<e[`active${s}`]&&(e[`active${s}`]-=1)}),i.removeArrayByIndex(o)),n.forEach(o=>{const s=`active${o}`;t[`get${o}`]=()=>t.getArrayByIndex(e[s]),t[`set${o}`]=c=>t.setAttribute(c,o),t[`setActive${o}`]=c=>t.setActiveAttributeByIndex(t.getArrayWithIndex(c).index,o),t[`copy${o}Off`]=()=>{const c=o.toUpperCase();e.copyAttributeFlags[Bp.PASSDATA][og[c]]=!1},t[`copy${o}On`]=()=>{const c=o.toUpperCase();e.copyAttributeFlags[Bp.PASSDATA][og[c]]=!0}}),t.initializeAttributeCopyFlags=()=>{e.copyAttributeFlags=[],Object.keys(Bp).filter(o=>o!=="ALLCOPY").forEach(o=>{e.copyAttributeFlags[Bp[o]]=Object.keys(og).filter(s=>s!=="NUM_ATTRIBUTES").reduce((s,c)=>(s[og[c]]=!0,s),[])}),e.copyAttributeFlags[Bp.COPYTUPLE][og.GLOBALIDS]=!1,e.copyAttributeFlags[Bp.INTERPOLATE][og.GLOBALIDS]=!1,e.copyAttributeFlags[Bp.COPYTUPLE][og.PEDIGREEIDS]=!1},t.initialize=se.chain(t.initialize,t.initializeAttributeCopyFlags),e.dataArrays&&Object.keys(e.dataArrays).length&&Object.keys(e.dataArrays).forEach(o=>{!e.dataArrays[o].ref&&e.dataArrays[o].type==="vtkDataArray"&&t.addArray(On.newInstance(e.dataArrays[o]))});const a=t.shallowCopy;t.shallowCopy=(o,s)=>{a(o,s),e.arrays=o.getArrays().map(c=>{const l=c.newClone();return l.shallowCopy(c,s),{data:l}})},t.initializeAttributeCopyFlags()}const D_t={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function B5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,D_t,n),x_t.extend(t,e,n),se.setGet(t,e,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),e.arrays||(e.arrays={}),O_t(t,e)}const M_t=se.newInstance(B5e,"vtkDataSetAttributes");var $ee={newInstance:M_t,extend:B5e,...F5e};const R_t={UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},I_t={FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7};var N_t={FieldDataTypes:R_t,FieldAssociations:I_t};const dk=["pointData","cellData","fieldData"];function P_t(t,e){e.classHierarchy.push("vtkDataSet"),dk.forEach(r=>{e[r]?e[r]=sf(e[r]):e[r]=$ee.newInstance()});const n=t.shallowCopy;t.shallowCopy=function(r){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n(r,i),dk.forEach(a=>{e[a]=$ee.newInstance(),e[a].shallowCopy(r.getReferenceByName(a))})}}const k_t={};function z5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,k_t,n),se.obj(t,e),se.setGet(t,e,dk),P_t(t,e)}const A_t=se.newInstance(z5e,"vtkDataSet");var k2={newInstance:A_t,extend:z5e,...N_t};function L_t(t,e){e.classHierarchy.push("vtkPointSet"),e.points?e.points=sf(e.points):e.points=uk.newInstance(),t.getNumberOfPoints=()=>e.points.getNumberOfPoints(),t.getBounds=()=>e.points.getBounds(),t.computeBounds=()=>{t.getBounds()};const n=t.shallowCopy;t.shallowCopy=function(r){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n(r,i),e.points=uk.newInstance(),e.points.shallowCopy(r.getPoints())}}const V_t={};function G5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,V_t,n),k2.extend(t,e,n),se.setGet(t,e,["points"]),L_t(t,e)}const $_t=se.newInstance(G5e,"vtkPointSet");var j_t={newInstance:$_t,extend:G5e};function mF(t,e,n,r){const i=n[0]-e[0],a=n[1]-e[1],o=n[2]-e[2],s=t[0]-e[0],c=t[1]-e[1],l=t[2]-e[2];r[0]=a*l-o*c,r[1]=o*s-i*l,r[2]=i*c-a*s}function YT(t,e,n,r){mF(t,e,n,r);const i=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);i!==0&&(r[0]/=i,r[1]/=i,r[2]/=i)}function U_t(t,e,n,r,i,a){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:1e-6,s=!1;const c=[],l=[],u=[],f=[],d=[];YT(t,e,n,f),YT(r,i,a,d);const h=-Fn(f,t),m=-Fn(d,r),p=[Fn(d,t)+m,Fn(d,e)+m,Fn(d,n)+m];if(p[0]*p[1]>o&&p[0]*p[2]>o)return{intersect:!1,coplanar:s,pt1:c,pt2:l,surfaceId:u};const y=[Fn(f,r)+h,Fn(f,i)+h,Fn(f,a)+h];if(y[0]*y[1]>o&&y[0]*y[2]>o)return{intersect:!1,coplanar:s,pt1:c,pt2:l,surfaceId:u};if(Math.abs(f[0]-d[0])<1e-9&&Math.abs(f[1]-d[1])<1e-9&&Math.abs(f[2]-d[2])<1e-9&&Math.abs(h-m)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:c,pt2:l,surfaceId:u};const x=[t,e,n],S=[r,i,a],C=Fn(f,d),_=(h-m*C)/(C*C-1),T=(m-h*C)/(C*C-1),O=[_*f[0]+T*d[0],_*f[1]+T*d[1],_*f[2]+T*d[2]],M=_d(f,d,[]);c1(M);let I=0,V=0;const k=[],L=[];let $=50,W=50;for(let U=0;U<3;U++){const Y=U,J=(U+1)%3,ne=Os.intersectWithLine(x[Y],x[J],r,d);ne.intersection&&ne.t>0-o&&ne.t<1+o&&(ne.t<1+o&&ne.t>1-o&&($=I),k[I++]=Fn(ne.x,M)-Fn(O,M));const F=Os.intersectWithLine(S[Y],S[J],t,f);F.intersection&&F.t>0-o&&F.t<1+o&&(F.t<1+o&&F.t>1-o&&(W=V),L[V++]=Fn(F.x,M)-Fn(O,M))}if(I>2){I--;const U=k[2];k[2]=k[$],k[$]=U}if(V>2){V--;const U=L[2];L[2]=L[W],L[W]=U}if(I!==2||V!==2)return{intersect:!1,coplanar:s,pt1:c,pt2:l,surfaceId:u};if(Number.isNaN(k[0])||Number.isNaN(k[1])||Number.isNaN(L[0])||Number.isNaN(L[1]))return{intersect:!1,coplanar:s,pt1:c,pt2:l,surfaceId:u};if(k[0]>k[1]){const U=k[1];k[1]=k[0],k[0]=U}if(L[0]>L[1]){const U=L[1];L[1]=L[0],L[0]=U}let G,oe;return k[1]<L[0]||L[1]<k[0]?{intersect:!1,coplanar:s,pt1:c,pt2:l,surfaceId:u}:(k[0]<L[0]?k[1]<L[1]?(u[0]=2,u[1]=1,G=L[0],oe=k[1]):(u[0]=2,u[1]=2,G=L[0],oe=L[1]):k[1]<L[1]?(u[0]=1,u[1]=1,G=k[0],oe=k[1]):(u[0]=1,u[1]=2,G=k[0],oe=L[1]),YP(O,M,G,c),YP(O,M,oe,l),{intersect:!0,coplanar:s,pt1:c,pt2:l,surfaceId:u})}const F_t={computeNormalDirection:mF,computeNormal:YT,intersectWithTriangle:U_t};function B_t(t,e){e.classHierarchy.push("vtkTriangle"),t.getCellDimension=()=>2,t.intersectWithLine=(n,r,i,a,o)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};o[2]=0;const c=[],l=i*i,u=[],f=[],d=[];e.points.getPoint(0,u),e.points.getPoint(1,f),e.points.getPoint(2,d);const h=[],m=[];if(YT(u,f,d,h),h[0]!==0||h[1]!==0||h[2]!==0){const C=Os.intersectWithLine(n,r,u,h);if(s.betweenPoints=C.betweenPoints,s.t=C.t,a[0]=C.x[0],a[1]=C.x[1],a[2]=C.x[2],!C.intersection)return o[0]=0,o[1]=0,s.intersect=0,s;const _=t.evaluatePosition(a,c,o,m);if(_.evaluation>=0)return _.dist2<=l?(s.intersect=1,s):(s.intersect=_.evaluation,s)}const p=Zf(u,f),y=Zf(f,d),x=Zf(d,u);e.line||(e.line=cu.newInstance()),p>y&&p>x?(e.line.getPoints().setPoint(0,u),e.line.getPoints().setPoint(1,f)):y>x&&y>p?(e.line.getPoints().setPoint(0,f),e.line.getPoints().setPoint(1,d)):(e.line.getPoints().setPoint(0,d),e.line.getPoints().setPoint(1,u));const S=e.line.intersectWithLine(n,r,i,a,o);if(s.betweenPoints=S.betweenPoints,s.t=S.t,S.intersect){const C=[],_=[],T=[];for(let O=0;O<3;O++)C[O]=u[O]-d[O],_[O]=f[O]-d[O],T[O]=a[O]-d[O];return o[0]=Fn(T,C)/x,o[1]=Fn(T,_)/y,s.intersect=1,s}return o[0]=0,o[1]=0,s.intersect=0,s},t.evaluatePosition=(n,r,i,a)=>{const o={subId:0,dist2:0,evaluation:-1};let s,c;const l=[],u=[],f=[],d=[];let h;const m=[],p=[],y=[];let x=0,S=0;const C=[];let _,T,O,M=[];const I=[],V=[],k=[];o.subId=0,i[2]=0,e.points.getPoint(1,l),e.points.getPoint(2,u),e.points.getPoint(0,f),mF(l,u,f,d),Os.generalizedProjectPoint(n,l,d,k);let L=0;for(s=0;s<3;s++)d[s]<0?h=-d[s]:h=d[s],h>L&&(L=h,S=s);for(c=0,s=0;s<3;s++)s!==S&&(C[c++]=s);for(s=0;s<2;s++)m[s]=k[C[s]]-f[C[s]],p[s]=l[C[s]]-f[C[s]],y[s]=u[C[s]]-f[C[s]];if(x=Yi(p,y),x===0)return i[0]=0,i[1]=0,o.evaluation=-1,o;if(i[0]=Yi(m,y)/x,i[1]=Yi(p,m)/x,a[0]=1-(i[0]+i[1]),a[1]=i[0],a[2]=i[1],a[0]>=0&&a[0]<=1&&a[1]>=0&&a[1]<=1&&a[2]>=0&&a[2]<=1)r&&(o.dist2=Zf(k,n),r[0]=k[0],r[1]=k[1],r[2]=k[2]),o.evaluation=1;else{let $;if(r){if(a[1]<0&&a[2]<0)for(_=Zf(n,f),T=cu.distanceToLine(n,l,f,$,I),O=cu.distanceToLine(n,f,u,$,V),_<T?(o.dist2=_,M=f):(o.dist2=T,M=I),O<o.dist2&&(o.dist2=O,M=V),s=0;s<3;s++)r[s]=M[s];else if(a[2]<0&&a[0]<0)for(_=Zf(n,l),T=cu.distanceToLine(n,l,f,$,I),O=cu.distanceToLine(n,l,u,$,V),_<T?(o.dist2=_,M=l):(o.dist2=T,M=I),O<o.dist2&&(o.dist2=O,M=V),s=0;s<3;s++)r[s]=M[s];else if(a[1]<0&&a[0]<0)for(_=Zf(n,u),T=cu.distanceToLine(n,u,f,$,I),O=cu.distanceToLine(n,l,u,$,V),_<T?(o.dist2=_,M=u):(o.dist2=T,M=I),O<o.dist2&&(o.dist2=O,M=V),s=0;s<3;s++)r[s]=M[s];else if(a[0]<0){const W=cu.distanceToLine(n,l,u,r);o.dist2=W.distance}else if(a[1]<0){const W=cu.distanceToLine(n,u,f,r);o.dist2=W.distance}else if(a[2]<0){const W=cu.distanceToLine(n,l,f,r);o.dist2=W.distance}}o.evaluation=0}return o},t.evaluateLocation=(n,r,i)=>{const a=[],o=[],s=[];e.points.getPoint(0,a),e.points.getPoint(1,o),e.points.getPoint(2,s);const c=1-n[0]-n[1];for(let l=0;l<3;l++)r[l]=a[l]*c+o[l]*n[0]+s[l]*n[1];i[0]=c,i[1]=n[0],i[2]=n[1]},t.getParametricDistance=n=>{let r,i=0;const a=[];a[0]=n[0],a[1]=n[1],a[2]=1-n[0]-n[1];for(let o=0;o<3;o++)a[o]<0?r=-a[o]:a[o]>1?r=a[o]-1:r=0,r>i&&(i=r);return i}}const z_t={};function W5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,z_t,n),KT.extend(t,e,n),B_t(t,e)}const G_t=se.newInstance(W5e,"vtkTriangle");var W_t={newInstance:G_t,extend:W5e,...F_t};const RR=["verts","lines","polys","strips"],{vtkWarningMacro:jee}=se,H_t={[hi.VTK_LINE]:cu,[hi.VTK_POLY_LINE]:cu,[hi.VTK_TRIANGLE]:W_t};function q_t(t,e){e.classHierarchy.push("vtkPolyData");function n(i){return i.replace(/(?:^\w|[A-Z]|\b\w)/g,a=>a.toUpperCase()).replace(/\s+/g,"")}RR.forEach(i=>{t[`getNumberOf${n(i)}`]=()=>e[i].getNumberOfCells(),e[i]?e[i]=sf(e[i]):e[i]=f1.newInstance()}),t.getNumberOfCells=()=>RR.reduce((i,a)=>i+e[a].getNumberOfCells(),0);const r=t.shallowCopy;t.shallowCopy=function(i){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;r(i,a),RR.forEach(o=>{e[o]=f1.newInstance(),e[o].shallowCopy(i.getReferenceByName(o))})},t.buildCells=()=>{const i=t.getNumberOfVerts(),a=t.getNumberOfLines(),o=t.getNumberOfPolys(),s=t.getNumberOfStrips(),c=i+a+o+s,l=new Uint8Array(c);let u=l;const f=new Uint32Array(c);let d=f;if(i){let h=0;e.verts.getCellSizes().forEach((m,p)=>{d[p]=h,u[p]=m>1?hi.VTK_POLY_VERTEX:hi.VTK_VERTEX,h+=m+1}),d=d.subarray(i),u=u.subarray(i)}if(a){let h=0;e.lines.getCellSizes().forEach((m,p)=>{d[p]=h,u[p]=m>2?hi.VTK_POLY_LINE:hi.VTK_LINE,m===1&&jee("Building VTK_LINE ",p," with only one point, but VTK_LINE needs at least two points. Check the input."),h+=m+1}),d=d.subarray(a),u=u.subarray(a)}if(o){let h=0;e.polys.getCellSizes().forEach((m,p)=>{switch(d[p]=h,m){case 3:u[p]=hi.VTK_TRIANGLE;break;case 4:u[p]=hi.VTK_QUAD;break;default:u[p]=hi.VTK_POLYGON;break}m<3&&jee("Building VTK_TRIANGLE ",p," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),h+=m+1}),d+=d.subarray(o),u+=u.subarray(o)}if(s){let h=0;u.fill(hi.VTK_TRIANGLE_STRIP,0,s),e.strips.getCellSizes().forEach((m,p)=>{d[p]=h,h+=m+1})}e.cells=l_t.newInstance(),e.cells.setCellTypes(c,l,f)},t.buildLinks=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;e.cells===void 0&&t.buildCells(),e.links=e_t.newInstance(),i>0?e.links.allocate(i):e.links.allocate(t.getPoints().getNumberOfPoints()),e.links.buildLinks(t)},t.getCellType=i=>e.cells.getCellType(i),t.getCellPoints=i=>{const a=t.getCellType(i);let o=null;switch(a){case hi.VTK_VERTEX:case hi.VTK_POLY_VERTEX:o=e.verts;break;case hi.VTK_LINE:case hi.VTK_POLY_LINE:o=e.lines;break;case hi.VTK_TRIANGLE:case hi.VTK_QUAD:case hi.VTK_POLYGON:o=e.polys;break;case hi.VTK_TRIANGLE_STRIP:o=e.strips;break;default:return o=null,{type:0,cellPointIds:null}}const s=e.cells.getCellLocation(i),c=o.getCell(s);return{cellType:a,cellPointIds:c}},t.getPointCells=i=>e.links.getCells(i),t.getCellEdgeNeighbors=(i,a,o)=>{const s=e.links.getLink(a),c=e.links.getLink(o);return s.cells.filter(l=>l!==i&&c.cells.indexOf(l)!==-1)},t.getCell=function(i){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const o=t.getCellPoints(i),s=a||H_t[o.cellType].newInstance();return s.initialize(t.getPoints(),o.cellPointIds),s}}const K_t={};function H5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,K_t,n),j_t.extend(t,e,n),se.get(t,e,["cells","links"]),se.setGet(t,e,["verts","lines","polys","strips"]),q_t(t,e)}const Y_t=se.newInstance(H5e,"vtkPolyData");var nh={newInstance:Y_t,extend:H5e};const{vtkErrorMacro:X_t}=se;class Z_t{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const n=e[0],r=e[e.length-1];if(n===r||e.length<2)return;const i=this.segmentMapping[n],a=this.segmentMapping[r];if(i!==void 0&&a!==void 0)if(Math.abs(i)===Math.abs(a)){const o=i<a?a:i,s=this.segments[o];if(i>0)for(let c=1;c<e.length-1;c++)s.push(e[c]);else for(let c=1;c<e.length-1;c++)s.unshift(e[e.length-1-c]);this.faces.push(s),this.segments[o]=null,this.segmentMapping[n]=void 0,this.segmentMapping[r]=void 0}else{const o=Math.abs(i),s=Math.abs(a),c=this.segments[o],l=this.segments[s];this.segments[o]=null,this.segments[s]=null,this.segmentMapping[c[0]]=void 0,this.segmentMapping[l[0]]=void 0,this.segmentMapping[c[c.length-1]]=void 0,this.segmentMapping[l[l.length-1]]=void 0,this.addSegment(e),this.addSegment(c),this.addSegment(l)}else if(i!==void 0){if(i>0){const o=this.segments[i];for(let s=1;s<e.length;s++)o.push(e[s]);this.segmentMapping[r]=i}else{const o=this.segments[-i];this.segmentMapping[r]=i;for(let s=1;s<e.length;s++)o.unshift(e[s])}this.segmentMapping[n]=void 0}else if(a!==void 0){if(a>0){const o=this.segments[a];for(let s=1;s<e.length;s++)o.push(e[e.length-1-s]);this.segmentMapping[n]=a}else{const o=this.segments[-a];this.segmentMapping[n]=a;for(let s=1;s<e.length;s++)o.unshift(e[e.length-s-1])}this.segmentMapping[r]=void 0}else{const o=this.segments.length;this.segments.push(e),this.segmentMapping[n]=-o,this.segmentMapping[r]=o}}}function Q_t(t,e){e.classHierarchy.push("vtkClosedPolyLineToSurfaceFilter"),t.requestData=(n,r)=>{const i=n[0];if(!i){X_t("Invalid or missing input");return}const a=nh.newInstance();a.shallowCopy(i);const o=new Z_t,s=i.getLines().getData();let c=0;for(;c<s.length;){const d=s[c++],h=[];for(let m=0;m<d;m++)h.push(s[c+m]);o.addSegment(h),c+=d}const{faces:l}=o;let u=l.length;for(let d=0;d<l.length;d++)u+=l[d].length;const f=new Uint16Array(u);c=0;for(let d=0;d<l.length;d++){const h=l[d];f[c++]=h.length;for(let m=0;m<h.length;m++)f[c++]=h[m]}a.setPolys(f1.newInstance({values:f,name:"faces"})),r[0]=a}}const J_t={};function q5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,J_t,n),se.obj(t,e),se.algo(t,e,1,1),Q_t(t,e)}const eTt=se.newInstance(q5e,"vtkClosedPolyLineToSurfaceFilter");var tTt={newInstance:eTt,extend:q5e};const{vtkErrorMacro:Uee}=Rs;function nTt(t){const e=t.getPolys().getData(),n=t.getStrips().getData(),r={cellSize:0,cell:[],done:!1,polyIdx:0,stripIdx:0,remainingStripLength:0,next(){if(r.polyIdx<e.length){r.cellSize=e[r.polyIdx];const i=r.polyIdx+1,a=i+r.cellSize;r.polyIdx=a;let o=0;for(let s=i;s<a;++s)r.cell[o++]=e[s]}else if(r.stripIdx<n.length){r.cellSize=3,r.remainingStripLength===0&&(r.remainingStripLength=n[r.stripIdx]-2,r.stripIdx+=3);const i=r.stripIdx-2,a=r.stripIdx+1;r.stripIdx++,r.remainingStripLength--;let o=0;for(let s=i;s<a;++s)r.cell[o++]=n[s]}else if(!r.done)r.done=!0;else throw new Error("Iterator is done")}};return r.next(),r}function rTt(t,e){e.classHierarchy.push("vtkCutter");const n={...t};t.getMTime=()=>{let i=n.getMTime();return e.cutFunction&&(i=Math.max(i,e.cutFunction.getMTime())),i};function r(i,a){const o=i.getPoints(),s=o.getData(),c=o.getNumberOfPoints(),l=[],u=[],f=[];(!e.cutScalars||e.cutScalars.length<c)&&(e.cutScalars=new Float32Array(c));let d=0,h=0;for(;d<s.length;)e.cutScalars[h++]=e.cutFunction.evaluateFunction(s[d++],s[d++],s[d++]);const m=[],p=new Array(3),y=new Array(3),x=[];for(const C=nTt(i);!C.done;C.next()){if(C.cellSize<=2)continue;for(let I=0;I<C.cellSize;)x[I]=e.cutScalars[C.cell[I++]];const _=x[0]>0;let T=!0;for(let I=1;I<C.cell.length;I++)if(x[I]>0!==_){T=!1;break}if(T)continue;const O=[];for(let I=0;I<C.cellSize;I++){const V=I+1===C.cellSize?0:I+1,k=x[I]>0;if(x[V]>0===k)continue;let $=I,W=V,G=x[W]-x[$];G<=0&&($=V,W=I,G*=-1);let oe=0;G!==0&&(oe=(e.cutValue-x[$])/G);const U=C.cell[$],Y=C.cell[W];p[0]=s[U*3],p[1]=s[U*3+1],p[2]=s[U*3+2],y[0]=s[Y*3],y[1]=s[Y*3+1],y[2]=s[Y*3+2];const J=[p[0]+oe*(y[0]-p[0]),p[1]+oe*(y[1]-p[1]),p[2]+oe*(y[2]-p[2])];O.push({pointEdge1:U,pointEdge2:Y,intersectedPoint:J,newPointID:-1})}for(let I=0;I<O.length;I++){const V=O[I];let k=!1;for(let L=0;L<m.length;L++){const $=m[L],W=V.pointEdge1===$.pointEdge1&&V.pointEdge2===$.pointEdge2,G=V.intersectedPoint[0]===$.intersectedPoint[0]&&V.intersectedPoint[1]===$.intersectedPoint[1]&&V.intersectedPoint[2]===$.intersectedPoint[2];if(W||G){k=!0,O[I].newPointID=m[L].newPointID;break}}k||(l.push(V.intersectedPoint[0]),l.push(V.intersectedPoint[1]),l.push(V.intersectedPoint[2]),O[I].newPointID=l.length/3-1,m.push(O[I]))}const M=O.length;M===2?u.push(M,O[0].newPointID,O[1].newPointID):M>2&&(f.push(M),O.forEach(I=>{f.push(I.newPointID)}))}a.getPoints().setData($E(o.getDataType(),l),3),u.length!==0&&a.getLines().setData(Uint16Array.from(u)),f.length!==0&&a.getPolys().setData(Uint16Array.from(f))}t.requestData=(i,a)=>{const o=i[0];if(!o){Uee("Invalid or missing input");return}if(!e.cutFunction){Uee("Missing cut function");return}const s=nh.newInstance();r(o,s),a[0]=s}}const iTt={cutFunction:null,cutScalars:null,cutValue:0};function K5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,iTt,n),yi(t,e),DU(t,e,1,1),Ja(t,e,["cutFunction","cutValue"]),rTt(t,e)}const aTt=ri(K5e,"vtkCutter");var oTt={newInstance:aTt,extend:K5e};const rh={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var Y5e={ObjectType:rh};const{ObjectType:jC}=Y5e,sTt={};function cTt(t,e){e.classHierarchy.push("vtkOpenGLBufferObject");function n(s){switch(s){case jC.ELEMENT_ARRAY_BUFFER:return e.context.ELEMENT_ARRAY_BUFFER;case jC.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in e.context)return e.context.TEXTURE_BUFFER;case jC.ARRAY_BUFFER:default:return e.context.ARRAY_BUFFER}}let r=null,i=null,a=!0,o="";t.getType=()=>r,t.setType=s=>{r=s},t.getHandle=()=>i,t.isReady=()=>a===!1,t.generateBuffer=s=>{const c=n(s);return i===null&&(i=e.context.createBuffer(),r=s),n(r)===c},t.upload=(s,c)=>t.generateBuffer(c)?(e.context.bindBuffer(n(r),i),e.context.bufferData(n(r),s,e.context.STATIC_DRAW),e.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,a=!1,!0):(o="Trying to upload array buffer to incompatible buffer.",!1),t.bind=()=>i?(e.context.bindBuffer(n(r),i),!0):!1,t.release=()=>i?(e.context.bindBuffer(n(r),null),!0):!1,t.releaseGraphicsResources=()=>{i!==null&&(e.context.bindBuffer(n(r),null),e.context.deleteBuffer(i),i=null,e.allocatedGPUMemoryInBytes=0)},t.setOpenGLRenderWindow=s=>{e._openGLRenderWindow!==s&&(t.releaseGraphicsResources(),e._openGLRenderWindow=s,e.context=null,s&&(e.context=e._openGLRenderWindow.getContext()))},t.getError=()=>o}const lTt={objectType:jC.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function X5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,lTt,n),se.obj(t,e),se.get(t,e,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),se.moveToProtected(t,e,["openGLRenderWindow"]),cTt(t,e)}const uTt=se.newInstance(X5e);var H0={newInstance:uTt,extend:X5e,...sTt,...Y5e};const Z5e={FLAT:0,GOURAUD:1,PHONG:2},_l={POINTS:0,WIREFRAME:1,SURFACE:2},fTt=Z5e;var Q5e={Shading:Z5e,Representation:_l,Interpolation:fTt};const{vtkErrorMacro:Fee}=se;function dTt(t,e){const n=new Float64Array(3);Nxe(n,e);const r=new Float64Array(16);return Exe(r,u1(),t,n),r}function hTt(t,e){return t===null||e===null?!1:!(Eee(t,[0,0,0])&&Eee(e,[1,1,1]))}function gTt(t,e){e.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),t.setType(rh.ARRAY_BUFFER),t.createVBO=function(n,r,i,a){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null;if(!n.getData()||!n.getData().length)return e.elementCount=0,0;e.blockSize=3,e.vertexOffset=0,e.normalOffset=0,e.tCoordOffset=0,e.tCoordComponents=0,e.colorComponents=0,e.colorOffset=0,e.customData=[];const s=a.points.getData();let c=null,l=null,u=null;const f=a.colors?a.colors.getNumberOfComponents():0,d=a.tcoords?a.tcoords.getNumberOfComponents():0;a.normals&&(e.normalOffset=4*e.blockSize,e.blockSize+=3,c=a.normals.getData()),a.customAttributes&&a.customAttributes.forEach(ne=>{ne&&(e.customData.push({data:ne.getData(),offset:4*e.blockSize,components:ne.getNumberOfComponents(),name:ne.getName()}),e.blockSize+=ne.getNumberOfComponents())}),a.tcoords&&(e.tCoordOffset=4*e.blockSize,e.tCoordComponents=d,e.blockSize+=d,l=a.tcoords.getData()),a.colors?(e.colorComponents=a.colors.getNumberOfComponents(),e.colorOffset=0,u=a.colors.getData(),e.colorBO||(e.colorBO=H0.newInstance()),e.colorBO.setOpenGLRenderWindow(e._openGLRenderWindow)):e.colorBO=null,e.stride=4*e.blockSize;let h=0,m=0,p=0,y=0,x=0,S=0,C;const _={anythingToPoints(ne,F,ae,re){for(let te=0;te<ne;++te)C(F[ae+te],re)},linesToWireframe(ne,F,ae,re){for(let te=0;te<ne-1;++te)C(F[ae+te],re),C(F[ae+te+1],re)},polysToWireframe(ne,F,ae,re){if(ne>2)for(let te=0;te<ne;++te)C(F[ae+te],re),C(F[ae+(te+1)%ne],re)},stripsToWireframe(ne,F,ae,re){if(ne>2){for(let te=0;te<ne-1;++te)C(F[ae+te],re),C(F[ae+te+1],re);for(let te=0;te<ne-2;te++)C(F[ae+te],re),C(F[ae+te+2],re)}},polysToSurface(ne,F,ae,re){for(let te=0;te<ne-2;te++)C(F[ae+0],re),C(F[ae+te+1],re),C(F[ae+te+2],re)},stripsToSurface(ne,F,ae,re){for(let te=0;te<ne-2;te++)C(F[ae+te],re),C(F[ae+te+1+te%2],re),C(F[ae+te+1+(te+1)%2],re)}},T={anythingToPoints(ne,F){return ne},linesToWireframe(ne,F){return ne>1?(ne-1)*2:0},polysToWireframe(ne,F){return ne>2?ne*2:0},stripsToWireframe(ne,F){return ne>2?ne*4-6:0},polysToSurface(ne,F){return ne>2?(ne-2)*3:0},stripsToSurface(ne,F,ae){return ne>2?(ne-2)*3:0}};let O=null,M=null;i===_l.POINTS||r==="verts"?(O=_.anythingToPoints,M=T.anythingToPoints):i===_l.WIREFRAME||r==="lines"?(O=_[`${r}ToWireframe`],M=T[`${r}ToWireframe`]):(O=_[`${r}ToSurface`],M=T[`${r}ToSurface`]);const I=n.getData(),V=I.length;let k=0;for(let ne=0;ne<V;)k+=M(I[ne],I),ne+=I[ne]+1;let L=null;const $=new Float32Array(k*e.blockSize);u&&(L=new Uint8Array(k*4));let W=0,G=0,oe=0,U=0;for(let ne=0;ne<3;++ne){const F=a.points.getRange(ne),ae=F[1]-F[0];oe+=ae*ae;const re=.5*(F[1]+F[0]);U+=re*re}if(oe>0&&(Math.abs(U)/oe>1e6||Math.abs(Math.log10(oe))>3||oe===0&&U>1e6)){const ne=new Float64Array(3),F=new Float64Array(3);for(let ae=0;ae<3;++ae){const re=a.points.getRange(ae),te=re[1]-re[0];ne[ae]=.5*(re[1]+re[0]),F[ae]=te>0?1/te:1}t.setCoordShiftAndScale(ne,F)}else e.coordShiftAndScaleEnabled===!0&&t.setCoordShiftAndScale(null,null);if(o)if(!o.points&&!o.cells)o.points=new Int32Array(k),o.cells=new Int32Array(k);else{const ne=new Int32Array(k+o.points.length);ne.set(o.points),o.points=ne;const F=new Int32Array(k+o.cells.length);F.set(o.cells),o.cells=F}let J=a.vertexOffset;C=function(F,ae){if(o&&(o.points[J]=F,o.cells[J]=S+a.cellOffset),++J,h=F*3,e.coordShiftAndScaleEnabled?($[W++]=(s[h++]-e.coordShift[0])*e.coordScale[0],$[W++]=(s[h++]-e.coordShift[1])*e.coordScale[1],$[W++]=(s[h++]-e.coordShift[2])*e.coordScale[2]):($[W++]=s[h++],$[W++]=s[h++],$[W++]=s[h++]),c!==null&&(a.haveCellNormals?m=(S+a.cellOffset)*3:m=F*3,$[W++]=c[m++],$[W++]=c[m++],$[W++]=c[m++]),e.customData.forEach(re=>{x=F*re.components;for(let te=0;te<re.components;++te)$[W++]=re.data[x++]}),l!==null){a.useTCoordsPerCell?p=ae*d:p=F*d;for(let re=0;re<d;++re)$[W++]=l[p++]}u!==null&&(a.haveCellScalars?y=(S+a.cellOffset)*f:y=F*f,L[G++]=u[y++],L[G++]=u[y++],L[G++]=u[y++],L[G++]=f===4?u[y++]:255)};for(let ne=0;ne<V;ne+=I[ne]+1,S++)O(I[ne],I,ne+1,S+a.cellOffset);return e.elementCount=k,t.upload($,rh.ARRAY_BUFFER),e.colorBO&&(e.colorBOStride=4,e.colorBO.upload(L,rh.ARRAY_BUFFER)),S},t.setCoordShiftAndScale=(n,r)=>{if(n!==null&&(n.constructor!==Float64Array||n.length!==3)){Fee("Wrong type for coordShift, expected vec3 or null");return}if(r!==null&&(r.constructor!==Float64Array||r.length!==3)){Fee("Wrong type for coordScale, expected vec3 or null");return}(e.coordShift===null||n===null||!Oee(n,e.coordShift))&&(e.coordShift=n),(e.coordScale===null||r===null||!Oee(r,e.coordScale))&&(e.coordScale=r),e.coordShiftAndScaleEnabled=hTt(e.coordShift,e.coordScale),e.coordShiftAndScaleEnabled?e.inverseShiftAndScaleMatrix=dTt(e.coordShift,e.coordScale):e.inverseShiftAndScaleMatrix=null}}const pTt={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function J5e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,pTt,n),H0.extend(t,e,n),se.setGet(t,e,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),se.get(t,e,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),gTt(t,e)}const mTt=se.newInstance(J5e);var vTt={newInstance:mTt,extend:J5e};const{vtkErrorMacro:yTt}=se;function xTt(t,e){e.classHierarchy.push("vtkShader"),t.compile=()=>{let n=e.context.VERTEX_SHADER;if(!e.source||!e.source.length||e.shaderType==="Unknown")return!1;switch(e.handle!==0&&(e.context.deleteShader(e.handle),e.handle=0),e.shaderType){case"Fragment":n=e.context.FRAGMENT_SHADER;break;case"Vertex":default:n=e.context.VERTEX_SHADER;break}if(e.handle=e.context.createShader(n),e.context.shaderSource(e.handle,e.source),e.context.compileShader(e.handle),!e.context.getShaderParameter(e.handle,e.context.COMPILE_STATUS)){const i=e.context.getShaderInfoLog(e.handle);return yTt(`Error compiling shader '${e.source}': ${i}`),e.context.deleteShader(e.handle),e.handle=0,!1}return!0},t.cleanup=()=>{e.shaderType==="Unknown"||e.handle===0||(e.context.deleteShader(e.handle),e.handle=0,e.dirty=!0)}}const wTt={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function ewe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,wTt,n),se.obj(t,e),se.setGet(t,e,["shaderType","source","error","handle","context"]),xTt(t,e)}const bTt=se.newInstance(ewe,"vtkShader");var IR={newInstance:bTt,extend:ewe};const{vtkErrorMacro:Hf}=se;function STt(t,e,n,r){const i=typeof n=="string"?n:n.join(`
`),a=r===!1?e:new RegExp(e,"g"),o=t.replace(a,i);return{replace:o!==i,result:o}}function CTt(t,e){e.classHierarchy.push("vtkShaderProgram"),t.compileShader=()=>e.vertexShader.compile()?e.fragmentShader.compile()?!t.attachShader(e.vertexShader)||!t.attachShader(e.fragmentShader)?(Hf(e.error),0):t.link()?(t.setCompiled(!0),1):(Hf(`Links failed: ${e.error}`),0):(Hf(e.fragmentShader.getSource().split(`
`).map((n,r)=>`${r}: ${n}`).join(`
`)),Hf(e.fragmentShader.getError()),0):(Hf(e.vertexShader.getSource().split(`
`).map((n,r)=>`${r}: ${n}`).join(`
`)),Hf(e.vertexShader.getError()),0),t.cleanup=()=>{e.shaderType==="Unknown"||e.handle===0||(t.release(),e.vertexShaderHandle!==0&&(e.context.detachShader(e.handle,e.vertexShaderHandle),e.vertexShaderHandle=0),e.fragmentShaderHandle!==0&&(e.context.detachShader(e.handle,e.fragmentShaderHandle),e.fragmentShaderHandle=0),e.context.deleteProgram(e.handle),e.handle=0,t.setCompiled(!1))},t.bind=()=>!e.linked&&!t.link()?!1:(e.context.useProgram(e.handle),t.setBound(!0),!0),t.isBound=()=>!!e.bound,t.release=()=>{e.context.useProgram(null),t.setBound(!1)},t.setContext=n=>{e.vertexShader.setContext(n),e.fragmentShader.setContext(n),e.geometryShader.setContext(n)},t.link=()=>{if(e.linked)return!0;if(e.handle===0)return e.error="Program has not been initialized, and/or does not have shaders.",!1;if(e.uniformLocs={},e.context.linkProgram(e.handle),!e.context.getProgramParameter(e.handle,e.context.LINK_STATUS)){const r=e.context.getProgramInfoLog(e.handle);return Hf(`Error linking shader ${r}`),e.handle=0,!1}return t.setLinked(!0),e.attributeLocs={},!0},t.setUniformMatrix=(n,r)=>{const i=t.findUniform(n);if(i===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return e.context.uniformMatrix4fv(i,!1,a),!0},t.setUniformMatrix3x3=(n,r)=>{const i=t.findUniform(n);if(i===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return e.context.uniformMatrix3fv(i,!1,a),!0},t.setUniformf=(n,r)=>{const i=t.findUniform(n);return i===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform1f(i,r),!0)},t.setUniformfv=(n,r)=>{const i=t.findUniform(n);return i===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform1fv(i,r),!0)},t.setUniformi=(n,r)=>{const i=t.findUniform(n);return i===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform1i(i,r),!0)},t.setUniformiv=(n,r)=>{const i=t.findUniform(n);return i===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform1iv(i,r),!0)},t.setUniform2f=(n,r,i)=>{const a=t.findUniform(n);if(a===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;if(i===void 0)throw new RangeError("Invalid number of values for array");return e.context.uniform2f(a,r,i),!0},t.setUniform2fv=(n,r)=>{const i=t.findUniform(n);return i===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform2fv(i,r),!0)},t.setUniform2i=(n,r,i)=>{const a=t.findUniform(n);if(a===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;if(i===void 0)throw new RangeError("Invalid number of values for array");return e.context.uniform2i(a,r,i),!0},t.setUniform2iv=(n,r)=>{const i=t.findUniform(n);return i===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform2iv(i,r),!0)},t.setUniform3f=(n,r,i,a)=>{const o=t.findUniform(n);if(o===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;if(a===void 0)throw new RangeError("Invalid number of values for array");return e.context.uniform3f(o,r,i,a),!0},t.setUniform3fArray=(n,r)=>{const i=t.findUniform(n);if(i===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||r.length!==3)throw new RangeError("Invalid number of values for array");return e.context.uniform3f(i,r[0],r[1],r[2]),!0},t.setUniform3fv=(n,r)=>{const i=t.findUniform(n);return i===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform3fv(i,r),!0)},t.setUniform3i=function(n){const r=t.findUniform(n);if(r===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];let s=a;if(s.length===1&&Array.isArray(s[0])&&(s=s[0]),s.length!==3)throw new RangeError("Invalid number of values for array");return e.context.uniform3i(r,s[0],s[1],s[2]),!0},t.setUniform3iv=(n,r)=>{const i=t.findUniform(n);return i===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform3iv(i,r),!0)},t.setUniform4f=function(n){const r=t.findUniform(n);if(r===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];let s=a;if(s.length===1&&Array.isArray(s[0])&&(s=s[0]),s.length!==4)throw new RangeError("Invalid number of values for array");return e.context.uniform4f(r,s[0],s[1],s[2],s[3]),!0},t.setUniform4fv=(n,r)=>{const i=t.findUniform(n);return i===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform4fv(i,r),!0)},t.setUniform4i=function(n){const r=t.findUniform(n);if(r===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];let s=a;if(s.length===1&&Array.isArray(s[0])&&(s=s[0]),s.length!==4)throw new RangeError("Invalid number of values for array");return e.context.uniform4i(r,s[0],s[1],s[2],s[3]),!0},t.setUniform4iv=(n,r)=>{const i=t.findUniform(n);return i===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform4iv(i,r),!0)},t.findUniform=n=>{if(!n||!e.linked)return-1;let r=e.uniformLocs[n];return r!==void 0?r:(r=e.context.getUniformLocation(e.handle,n),r===null?(e.error=`Uniform ${n} not found in current shader program.`,e.uniformLocs[n]=-1,-1):(e.uniformLocs[n]=r,r))},t.isUniformUsed=n=>{if(!n)return!1;let r=e.uniformLocs[n];return r!==void 0?r!==null:e.linked?(r=e.context.getUniformLocation(e.handle,n),e.uniformLocs[n]=r,r!==null):(Hf("attempt to find uniform when the shader program is not linked"),!1)},t.isAttributeUsed=n=>{if(!n)return!1;if(n in e.attributeLocs)return!0;if(!e.linked)return Hf("attempt to find uniform when the shader program is not linked"),!1;const r=e.context.getAttribLocation(e.handle,n);return r===-1?!1:(e.attributeLocs[n]=r,!0)},t.attachShader=n=>{if(n.getHandle()===0)return e.error="Shader object was not initialized, cannot attach it.",!1;if(n.getShaderType()==="Unknown")return e.error="Shader object is of type Unknown and cannot be used.",!1;if(e.handle===0){const r=e.context.createProgram();if(r===0)return e.error="Could not create shader program.",!1;e.handle=r,e.linked=!1}return n.getShaderType()==="Vertex"&&(e.vertexShaderHandle!==0&&e.context.detachShader(e.handle,e.vertexShaderHandle),e.vertexShaderHandle=n.getHandle()),n.getShaderType()==="Fragment"&&(e.fragmentShaderHandle!==0&&e.context.detachShader(e.handle,e.fragmentShaderHandle),e.fragmentShaderHandle=n.getHandle()),e.context.attachShader(e.handle,n.getHandle()),t.setLinked(!1),!0},t.detachShader=n=>{if(n.getHandle()===0)return e.error="shader object was not initialized, cannot attach it.",!1;if(n.getShaderType()==="Unknown")return e.error="Shader object is of type Unknown and cannot be used.",!1;switch(e.handle===0&&(e.error="This shader program has not been initialized yet."),n.getShaderType()){case"Vertex":return e.vertexShaderHandle!==n.getHandle()?(e.error="The supplied shader was not attached to this program.",!1):(e.context.detachShader(e.handle,n.getHandle()),e.vertexShaderHandle=0,e.linked=!1,!0);case"Fragment":return e.fragmentShaderHandle!==n.getHandle()?(e.error="The supplied shader was not attached to this program.",!1):(e.context.detachShader(e.handle,n.getHandle()),e.fragmentShaderHandle=0,e.linked=!1,!0);default:return!1}},t.setContext=n=>{e.context=n,e.vertexShader.setContext(n),e.fragmentShader.setContext(n),e.geometryShader.setContext(n)},t.setLastCameraMTime=n=>{e.lastCameraMTime=n}}const _Tt={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function twe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,_Tt,n),e.attributesLocs={},e.uniformLocs={},e.vertexShader=IR.newInstance(),e.vertexShader.setShaderType("Vertex"),e.fragmentShader=IR.newInstance(),e.fragmentShader.setShaderType("Fragment"),e.geometryShader=IR.newInstance(),e.geometryShader.setShaderType("Geometry"),se.obj(t,e),se.get(t,e,["lastCameraMTime"]),se.setGet(t,e,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),CTt(t,e)}const TTt=se.newInstance(twe,"vtkShaderProgram");var Ie={newInstance:TTt,extend:twe,substitute:STt};function ETt(t,e){e.classHierarchy.push("vtkOpenGLVertexArrayObject"),t.exposedMethod=()=>{},t.initialize=()=>{e.instancingExtension=null,e._openGLRenderWindow.getWebgl2()||(e.instancingExtension=e.context.getExtension("ANGLE_instanced_arrays")),!e.forceEmulation&&e._openGLRenderWindow&&e._openGLRenderWindow.getWebgl2()?(e.extension=null,e.supported=!0,e.handleVAO=e.context.createVertexArray()):(e.extension=e.context.getExtension("OES_vertex_array_object"),!e.forceEmulation&&e.extension?(e.supported=!0,e.handleVAO=e.extension.createVertexArrayOES()):e.supported=!1)},t.isReady=()=>e.handleVAO!==0||e.supported===!1,t.bind=()=>{if(t.isReady()||t.initialize(),t.isReady()&&e.supported)e.extension?e.extension.bindVertexArrayOES(e.handleVAO):e.context.bindVertexArray(e.handleVAO);else if(t.isReady()){const n=e.context;for(let r=0;r<e.buffers.length;++r){const i=e.buffers[r];e.context.bindBuffer(n.ARRAY_BUFFER,i.buffer);for(let a=0;a<i.attributes.length;++a){const o=i.attributes[a],s=o.isMatrix?o.size:1;for(let c=0;c<s;++c)n.enableVertexAttribArray(o.index+c),n.vertexAttribPointer(o.index+c,o.size,o.type,o.normalize,o.stride,o.offset+o.stride*c/o.size),o.divisor>0&&(e.instancingExtension?e.instancingExtension.vertexAttribDivisorANGLE(o.index+c,1):n.vertexAttribDivisor(o.index+c,1))}}}},t.release=()=>{if(t.isReady()&&e.supported)e.extension?e.extension.bindVertexArrayOES(null):e.context.bindVertexArray(null);else if(t.isReady()){const n=e.context;for(let r=0;r<e.buffers.length;++r){const i=e.buffers[r];e.context.bindBuffer(n.ARRAY_BUFFER,i.buffer);for(let a=0;a<i.attributes.length;++a){const o=i.attributes[a],s=o.isMatrix?o.size:1;for(let c=0;c<s;++c)n.enableVertexAttribArray(o.index+c),n.vertexAttribPointer(o.index+c,o.size,o.type,o.normalize,o.stride,o.offset+o.stride*c/o.size),o.divisor>0&&(e.instancingExtension?e.instancingExtension.vertexAttribDivisorANGLE(o.index+c,0):n.vertexAttribDivisor(o.index+c,0)),n.disableVertexAttribArray(o.index+c)}}}},t.shaderProgramChanged=()=>{t.release(),e.handleVAO&&(e.extension?e.extension.deleteVertexArrayOES(e.handleVAO):e.context.deleteVertexArray(e.handleVAO)),e.handleVAO=0,e.handleProgram=0},t.releaseGraphicsResources=()=>{t.shaderProgramChanged(),e.handleVAO&&(e.extension?e.extension.deleteVertexArrayOES(e.handleVAO):e.context.deleteVertexArray(e.handleVAO)),e.handleVAO=0,e.supported=!0,e.handleProgram=0},t.addAttributeArray=(n,r,i,a,o,s,c,l)=>t.addAttributeArrayWithDivisor(n,r,i,a,o,s,c,l,0,!1),t.addAttributeArrayWithDivisor=(n,r,i,a,o,s,c,l,u,f)=>{if(!n||!n.isBound()||r.getHandle()===0||r.getType()!==rh.ARRAY_BUFFER||(e.handleProgram===0&&(e.handleProgram=n.getHandle()),t.isReady()||t.initialize(),!t.isReady()||e.handleProgram!==n.getHandle()))return!1;const d=e.context,h={};if(h.name=i,h.index=d.getAttribLocation(e.handleProgram,i),h.offset=a,h.stride=o,h.type=s,h.size=c,h.normalize=l,h.isMatrix=f,h.divisor=u,h.Index===-1)return!1;if(r.bind(),d.enableVertexAttribArray(h.index),d.vertexAttribPointer(h.index,h.size,h.type,h.normalize,h.stride,h.offset),u>0&&(e.instancingExtension?e.instancingExtension.vertexAttribDivisorANGLE(h.index,1):d.vertexAttribDivisor(h.index,1)),h.buffer=r.getHandle(),!e.supported){let m=!1;for(let p=0;p<e.buffers.length;++p){const y=e.buffers[p];if(y.buffer===h.buffer){m=!0;let x=!1;for(let S=0;S<y.attributes.length;++S)y.attributes[S].name===i&&(x=!0,y.attributes[S]=h);x||y.attributes.push(h)}}m||e.buffers.push({buffer:h.buffer,attributes:[h]})}return!0},t.addAttributeMatrixWithDivisor=(n,r,i,a,o,s,c,l,u)=>{const f=t.addAttributeArrayWithDivisor(n,r,i,a,o,s,c,l,u,!0);if(!f)return f;const d=e.context,h=d.getAttribLocation(e.handleProgram,i);for(let m=1;m<c;m++)d.enableVertexAttribArray(h+m),d.vertexAttribPointer(h+m,c,s,l,o,a+o*m/c),u>0&&(e.instancingExtension?e.instancingExtension.vertexAttribDivisorANGLE(h+m,1):d.vertexAttribDivisor(h+m,1));return!0},t.removeAttributeArray=n=>{if(!t.isReady()||e.handleProgram===0)return!1;if(!e.supported)for(let r=0;r<e.buffers.length;++r){const i=e.buffers[r];for(let a=0;a<i.attributes.length;++a)if(i.attributes[a].name===n)return i.attributes.splice(a,1),i.attributes.length||e.buffers.splice(r,1),!0}return!0},t.setOpenGLRenderWindow=n=>{e._openGLRenderWindow!==n&&(t.releaseGraphicsResources(),e._openGLRenderWindow=n,e.context=null,n&&(e.context=e._openGLRenderWindow.getContext()))}}const OTt={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function nwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,OTt,n),e.buffers=[],se.obj(t,e),se.get(t,e,["supported"]),se.setGet(t,e,["forceEmulation"]),ETt(t,e)}const DTt=se.newInstance(nwe,"vtkOpenGLVertexArrayObject");var WE={newInstance:DTt,extend:nwe};const dg={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function MTt(t,e){e.classHierarchy.push("vtkOpenGLHelper"),t.setOpenGLRenderWindow=n=>{e.context=n.getContext(),e.program.setContext(e.context),e.VAO.setOpenGLRenderWindow(n),e.CABO.setOpenGLRenderWindow(n)},t.releaseGraphicsResources=n=>{e.VAO.releaseGraphicsResources(),e.CABO.releaseGraphicsResources(),e.CABO.setElementCount(0)},t.drawArrays=(n,r,i,a)=>{if(e.CABO.getElementCount()){const o=t.getOpenGLMode(i),s=t.haveWideLines(n,r),c=e.context,l=c.getParameter(c.DEPTH_WRITEMASK);e.pointPicking&&c.depthMask(!1),o===c.LINES&&s?(t.updateShaders(n,r,a),c.drawArraysInstanced(o,0,e.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(c.lineWidth(r.getProperty().getLineWidth()),t.updateShaders(n,r,a),c.drawArrays(o,0,e.CABO.getElementCount()),c.lineWidth(1));const f=(o===c.POINTS?1:0)||(o===c.LINES?2:3);return e.pointPicking&&c.depthMask(l),e.CABO.getElementCount()/f}return 0},t.getOpenGLMode=n=>{if(e.pointPicking)return e.context.POINTS;const r=e.primitiveType;return n===_l.POINTS||r===dg.Points?e.context.POINTS:n===_l.WIREFRAME||r===dg.Lines||r===dg.TrisEdges||r===dg.TriStripsEdges?e.context.LINES:e.context.TRIANGLES},t.haveWideLines=(n,r)=>r.getProperty().getLineWidth()>1?!(e.CABO.getOpenGLRenderWindow()&&e.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=r.getProperty().getLineWidth()):!1,t.getNeedToRebuildShaders=(n,r,i)=>!!(i.getNeedToRebuildShaders(t,n,r)||t.getProgram()===0||t.getShaderSourceTime().getMTime()<i.getMTime()||t.getShaderSourceTime().getMTime()<r.getMTime()),t.updateShaders=(n,r,i)=>{if(t.getNeedToRebuildShaders(n,r,i)){const a={Vertex:null,Fragment:null,Geometry:null};i.buildShaders(a,n,r);const o=e.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);o!==t.getProgram()&&(t.setProgram(o),t.getVAO().releaseGraphicsResources()),t.getShaderSourceTime().modified()}else e.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(t.getProgram());t.getVAO().bind(),i.setMapperShaderParameters(t,n,r),i.setPropertyShaderParameters(t,n,r),i.setCameraShaderParameters(t,n,r),i.setLightingShaderParameters(t,n,r),i.invokeShaderCallbacks(t,n,r)},t.setMapperShaderParameters=(n,r,i)=>{if(t.haveWideLines(n,r)){t.getProgram().setUniform2f("viewportSize",i.usize,i.vsize);const a=parseFloat(r.getProperty().getLineWidth()),o=a/2;t.getProgram().setUniformf("lineWidthStepSize",a/Math.ceil(a)),t.getProgram().setUniformf("halfLineWidth",o)}e.primitiveType===dg.Points||r.getProperty().getRepresentation()===_l.POINTS?t.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):e.pointPicking&&t.getProgram().setUniformf("pointSize",t.getPointPickingPrimitiveSize())},t.replaceShaderPositionVC=(n,r,i)=>{let a=n.Vertex;a=Ie.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,a=Ie.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl","  gl_PointSize = pointSize;"],!1).result,t.getOpenGLMode(i.getProperty().getRepresentation())===e.context.LINES&&t.haveWideLines(r,i)&&(a=Ie.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,a=Ie.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)","   {","   float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;","   vec4 tmpPos = gl_Position;","   vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;","   tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];","   tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];","   gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);","   }"]).result),n.Vertex=a},t.getPointPickingPrimitiveSize=()=>e.primitiveType===dg.Points?2:e.primitiveType===dg.Lines?4:6,t.getAllocatedGPUMemoryInBytes=()=>t.getCABO().getAllocatedGPUMemoryInBytes()}const RTt={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function rwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,RTt,n),se.obj(t,e),e.shaderSourceTime={},se.obj(e.shaderSourceTime),e.attributeUpdateTime={},se.obj(e.attributeUpdateTime),se.setGet(t,e,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),e.program=Ie.newInstance(),e.VAO=WE.newInstance(),e.CABO=vTt.newInstance(),MTt(t,e)}const ITt=se.newInstance(rwe);var Ph={newInstance:ITt,extend:rwe,primTypes:dg};const NTt=t=>t,Bee=1e-6;let iwe=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.matrix=sn(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?C4t:NTt}rotateFromDirections(e,n){const r=new Float64Array(3),i=new Float64Array(3),a=new Float64Array(16);_r(r,e[0],e[1],e[2]),_r(i,n[0],n[1],n[2]),Vr(r,r),Vr(i,i);const o=Vt(r,i);return o>=1?this:(Tr(this.tmp,r,i),ec(this.tmp)<Bee&&(Tr(this.tmp,[1,0,0],e),ec(this.tmp)<Bee&&Tr(this.tmp,[0,1,0],e)),YU(a,Math.acos(o),this.tmp),Xn(this.matrix,this.matrix,a),this)}rotate(e,n){return _r(this.tmp,...n),Vr(this.tmp,this.tmp),Hu(this.matrix,this.matrix,this.angleConv(e),this.tmp),this}rotateX(e){return WU(this.matrix,this.matrix,this.angleConv(e)),this}rotateY(e){return HU(this.matrix,this.matrix,this.angleConv(e)),this}rotateZ(e){return qU(this.matrix,this.matrix,this.angleConv(e)),this}translate(e,n,r){return _r(this.tmp,e,n,r),Ma(this.matrix,this.matrix,this.tmp),this}scale(e,n,r){return _r(this.tmp,e,n,r),Ed(this.matrix,this.matrix,this.tmp),this}multiply(e){return Xn(this.matrix,this.matrix,e),this}multiply3x3(e){return Xn(this.matrix,this.matrix,[e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1]),this}invert(){return Na(this.matrix,this.matrix),this}identity(){return sn(this.matrix),this}apply(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1;if(d3(NU,this.matrix))return this;const i=r===-1?e.length:n+r*3;for(let a=n;a<i;a+=3)_r(this.tmp,e[a],e[a+1],e[a+2]),gr(this.tmp,this.tmp,this.matrix),e[a]=this.tmp[0],e[a+1]=this.tmp[1],e[a+2]=this.tmp[2];return this}getMatrix(){return this.matrix}setMatrix(e){return e&&e.length===16&&pa(this.matrix,e),this}};function PTt(){return new iwe(!0)}function kTt(){return new iwe(!1)}var Em={buildFromDegree:PTt,buildFromRadian:kTt};const ATt=[2,0,1,2,2,3,2,4,5,2,6,7,2,0,2,2,1,3,2,4,6,2,5,7,2,0,4,2,1,5,2,2,6,2,3,7],LTt=[4,0,1,3,2,4,4,6,7,5,4,8,10,11,9,4,12,13,15,14,4,16,18,19,17,4,20,21,23,22];function VTt(t,e){e.classHierarchy.push("vtkCubeSource");function n(r,i){if(e.deleted)return;const a=nh.newInstance();i[0]=a;const o=24,s=se.newTypedArray(e.pointType,o*3);a.getPoints().setData(s,3);const c=se.newTypedArray(e.pointType,o*3),l=On.newInstance({name:"Normals",values:c,numberOfComponents:3});a.getPointData().setNormals(l);let u=2;e.generate3DTextureCoordinates===!0&&(u=3);const f=se.newTypedArray(e.pointType,o*u),d=On.newInstance({name:"TextureCoordinates",values:f,numberOfComponents:u});a.getPointData().setTCoords(d);const h=[0,0,0],m=[0,0,0],p=[0,0];let y=0;h[0]=-e.xLength/2,m[0]=-1,m[1]=0,m[2]=0;for(let x=0;x<2;x++){h[1]=-e.yLength/2;for(let S=0;S<2;S++){p[1]=h[1]+.5,h[2]=-e.zLength/2;for(let C=0;C<2;C++)p[0]=(h[2]+.5)*(1-2*x),s[y*3]=h[0],s[y*3+1]=h[1],s[y*3+2]=h[2],c[y*3]=m[0],c[y*3+1]=m[1],c[y*3+2]=m[2],u===2?(f[y*u]=p[0],f[y*u+1]=p[1]):(f[y*u]=2*x-1,f[y*u+1]=2*S-1,f[y*u+2]=2*C-1),y++,h[2]+=e.zLength;h[1]+=e.yLength}h[0]+=e.xLength,m[0]+=2}h[1]=-e.yLength/2,m[1]=-1,m[0]=0,m[2]=0;for(let x=0;x<2;x++){h[0]=-e.xLength/2;for(let S=0;S<2;S++){p[0]=(h[0]+.5)*(2*x-1),h[2]=-e.zLength/2;for(let C=0;C<2;C++)p[1]=(h[2]+.5)*-1,s[y*3]=h[0],s[y*3+1]=h[1],s[y*3+2]=h[2],c[y*3]=m[0],c[y*3+1]=m[1],c[y*3+2]=m[2],u===2?(f[y*u]=p[0],f[y*u+1]=p[1]):(f[y*u]=2*S-1,f[y*u+1]=2*x-1,f[y*u+2]=2*C-1),y++,h[2]+=e.zLength;h[0]+=e.xLength}h[1]+=e.yLength,m[1]+=2}h[2]=-e.zLength/2,m[2]=-1,m[0]=0,m[1]=0;for(let x=0;x<2;x++){h[1]=-e.yLength/2;for(let S=0;S<2;S++){p[1]=h[1]+.5,h[0]=-e.xLength/2;for(let C=0;C<2;C++)p[0]=(h[0]+.5)*(2*x-1),s[y*3]=h[0],s[y*3+1]=h[1],s[y*3+2]=h[2],c[y*3]=m[0],c[y*3+1]=m[1],c[y*3+2]=m[2],u===2?(f[y*u]=p[0],f[y*u+1]=p[1]):(f[y*u]=2*C-1,f[y*u+1]=2*S-1,f[y*u+2]=2*x-1),y++,h[0]+=e.xLength;h[1]+=e.yLength}h[2]+=e.zLength,m[2]+=2}if(e.rotations&&Em.buildFromDegree().rotateX(e.rotations[0]).rotateY(e.rotations[1]).rotateZ(e.rotations[2]).apply(s).apply(c),e.center&&Em.buildFromRadian().translate(...e.center).apply(s),e.matrix){Em.buildFromRadian().setMatrix(e.matrix).apply(s);const x=[e.matrix[0],e.matrix[1],e.matrix[2],0,e.matrix[4],e.matrix[5],e.matrix[6],0,e.matrix[8],e.matrix[9],e.matrix[10],0,0,0,0,1];Em.buildFromRadian().setMatrix(x).apply(c)}e.generateFaces?a.getPolys().deepCopy(e._polys):a.getPolys().initialize(),e.generateLines?(a.getLines().deepCopy(e._lineCells),a.getPointData().setNormals(null)):a.getLines().initialize(),a.modified()}t.setBounds=function(){let r=[];if(Array.isArray(arguments.length<=0?void 0:arguments[0]))r=arguments.length<=0?void 0:arguments[0];else for(let i=0;i<arguments.length;i++)r.push(i<0||arguments.length<=i?void 0:arguments[i]);r.length===6&&(t.setXLength(r[1]-r[0]),t.setYLength(r[3]-r[2]),t.setZLength(r[5]-r[4]),t.setCenter([(r[0]+r[1])/2,(r[2]+r[3])/2,(r[4]+r[5])/2]))},t.requestData=n}const $Tt={xLength:1,yLength:1,zLength:1,pointType:"Float64Array",generate3DTextureCoordinates:!1,generateFaces:!0,generateLines:!1};function awe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,$Tt,n),se.obj(t,e),se.setGet(t,e,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),se.setGetArray(t,e,["center","rotations"],3),se.setGetArray(t,e,["matrix"],16),e._polys=f1.newInstance({values:Uint16Array.from(LTt)}),e._lineCells=f1.newInstance({values:Uint16Array.from(ATt)}),se.moveToProtected(t,e,["polys","lineCells"]),se.algo(t,e,0,1),VTt(t,e)}const jTt=se.newInstance(awe,"vtkCubeSource");var UTt={newInstance:jTt,extend:awe};const{vtkErrorMacro:zee}=se;function FTt(t,e){e.classHierarchy.push("vtkImageDataOutlineFilter");const n={...t};t.requestData=(r,i)=>{const a=r[0];if(!a||!a.isA("vtkImageData")){zee("Invalid or missing input");return}const o=a.getSpatialExtent();if(!o){zee("Unable to fetch spatial extents of input image.");return}e._cubeSource.setBounds(o),e._cubeSource.setMatrix(a.getIndexToWorld()),i[0]=e._cubeSource.getOutputData()},t.getMTime=()=>Math.max(n.getMTime(),e._cubeSource.getMTime()),t.setGenerateFaces=e._cubeSource.setGenerateFaces,t.setGenerateLines=e._cubeSource.setGenerateLines,t.getGenerateFaces=e._cubeSource.getGenerateFaces,t.getGenerateLines=e._cubeSource.getGenerateLines}const BTt={};function owe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,BTt,n),se.obj(t,e),se.algo(t,e,1,1),e._cubeSource=UTt.newInstance(),se.moveToProtected(t,e,["cubeSource","tmpOut"]),FTt(t,e)}const zTt=se.newInstance(owe,"vtkImageDataOutlineFilter");var GTt={newInstance:zTt,extend:owe};const Yw={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Kt={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var swe={Wrap:Yw,Filter:Kt};const cwe=new Float32Array(1),WTt=new Int32Array(cwe.buffer);function HTt(t){cwe[0]=t;const e=WTt[0];let n=e>>16&32768,r=e>>12&2047;const i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(i===255?0:1)&&e&8388607,n):i<113?(r|=2048,n|=(r>>114-i)+(r>>113-i&1),n):(n|=i-112<<10|r>>1,n+=r&1,n)}function qTt(t){const e=(t&32768)>>15,n=(t&31744)>>10,r=t&1023;return n===0?(e?-1:1)*2**-14*(r/2**10):n===31?r?NaN:(e?-1:1)*(1/0):(e?-1:1)*2**(n-15)*(1+r/2**10)}var Lv={fromHalf:qTt,toHalf:HTt};function KTt(){try{const r=new Int16Array([0,32767]),i=[1,1],a=document.createElement("canvas");a.width=4,a.height=4;const o=a.getContext("webgl2");if(!o)return!1;const s=o.getExtension("EXT_texture_norm16");if(!s)return!1;const c=`#version 300 es
    void main() {
      gl_PointSize = ${4 .toFixed(1)};
      gl_Position = vec4(0, 0, 0, 1);
    }
  `,l=`#version 300 es
    precision highp float;
    precision highp int;
    precision highp sampler2D;

    uniform sampler2D u_image;

    out vec4 color;

    void main() {
        vec4 intColor = texture(u_image, gl_PointCoord.xy);
        color = vec4(vec3(intColor.rrr), 1);
    }
    `,u=o.createShader(o.VERTEX_SHADER);if(o.shaderSource(u,c),o.compileShader(u),!o.getShaderParameter(u,o.COMPILE_STATUS))return!1;const f=o.createShader(o.FRAGMENT_SHADER);if(o.shaderSource(f,l),o.compileShader(f),!o.getShaderParameter(f,o.COMPILE_STATUS))return!1;const d=o.createProgram();if(o.attachShader(d,u),o.attachShader(d,f),o.linkProgram(d),!o.getProgramParameter(d,o.LINK_STATUS))return!1;const h=o.createTexture();o.bindTexture(o.TEXTURE_2D,h),o.texImage2D(o.TEXTURE_2D,0,s.R16_SNORM_EXT,2,1,0,o.RED,o.SHORT,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.useProgram(d),o.drawArrays(o.POINTS,0,1);const m=new Uint8Array(4);o.readPixels(i[0],i[1],1,1,o.RGBA,o.UNSIGNED_BYTE,m);const[p,y,x]=m,S=o.getExtension("WEBGL_lose_context");return S&&S.loseContext(),p===y&&y===x&&p!==0}catch{return!1}}let NR;function YTt(){return NR===void 0&&(NR=KTt()),NR}const{Wrap:S0,Filter:so}=swe,{VtkDataTypes:vr}=On,{vtkDebugMacro:PR,vtkErrorMacro:vv,vtkWarningMacro:Gee}=Rs,{toHalf:XTt}=Lv;function ZTt(t,e){e.classHierarchy.push("vtkOpenGLTexture");function n(){return{internalFormat:e.internalFormat,format:e.format,openGLDataType:e.openGLDataType,width:e.width,height:e.height}}t.render=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;if(m?e._openGLRenderWindow=m:(e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer"),e._openGLRenderWindow=e._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow")),e.context=e._openGLRenderWindow.getContext(),e.renderable.getInterpolate()?(e.generateMipmap?t.setMinificationFilter(so.LINEAR_MIPMAP_LINEAR):t.setMinificationFilter(so.LINEAR),t.setMagnificationFilter(so.LINEAR)):(t.setMinificationFilter(so.NEAREST),t.setMagnificationFilter(so.NEAREST)),e.renderable.getRepeat()&&(t.setWrapR(S0.REPEAT),t.setWrapS(S0.REPEAT),t.setWrapT(S0.REPEAT)),e.renderable.getInputData()&&e.renderable.setImage(null),!e.handle||e.renderable.getMTime()>e.textureBuildTime.getMTime()){if(e.renderable.getImage()!==null&&(e.renderable.getInterpolate()&&(e.generateMipmap=!0,t.setMinificationFilter(so.LINEAR_MIPMAP_LINEAR)),e.renderable.getImage()&&e.renderable.getImageLoaded()&&(t.create2DFromImage(e.renderable.getImage()),t.activate(),t.sendParameters(),e.textureBuildTime.modified())),e.renderable.getCanvas()!==null){e.renderable.getInterpolate()&&(e.generateMipmap=!0,t.setMinificationFilter(so.LINEAR_MIPMAP_LINEAR));const y=e.renderable.getCanvas();t.create2DFromRaw(y.width,y.height,4,vr.UNSIGNED_CHAR,y,!0),t.activate(),t.sendParameters(),e.textureBuildTime.modified()}if(e.renderable.getJsImageData()!==null){const y=e.renderable.getJsImageData();e.renderable.getInterpolate()&&(e.generateMipmap=!0,t.setMinificationFilter(so.LINEAR_MIPMAP_LINEAR)),t.create2DFromRaw(y.width,y.height,4,vr.UNSIGNED_CHAR,y.data,!0),t.activate(),t.sendParameters(),e.textureBuildTime.modified()}const p=e.renderable.getInputData(0);if(p&&p.getPointData().getScalars()){const y=p.getExtent(),x=p.getPointData().getScalars(),S=[];for(let C=0;C<e.renderable.getNumberOfInputPorts();++C){const _=e.renderable.getInputData(C),T=_?_.getPointData().getScalars().getData():null;T&&S.push(T)}e.renderable.getInterpolate()&&x.getNumberOfComponents()===4&&(e.generateMipmap=!0,t.setMinificationFilter(so.LINEAR_MIPMAP_LINEAR)),S.length%6===0?t.createCubeFromRaw(y[1]-y[0]+1,y[3]-y[2]+1,x.getNumberOfComponents(),x.getDataType(),S):t.create2DFromRaw(y[1]-y[0]+1,y[3]-y[2]+1,x.getNumberOfComponents(),x.getDataType(),x.getData()),t.activate(),t.sendParameters(),e.textureBuildTime.modified()}}e.handle&&t.activate()};const r=()=>{if(!((e.minificationFilter===so.LINEAR||e.magnificationFilter===so.LINEAR)&&!YTt()))return e.oglNorm16Ext};t.destroyTexture=()=>{t.deactivate(),e.context&&e.handle&&e.context.deleteTexture(e.handle),e._prevTexParams=null,e.handle=0,e.numberOfDimensions=0,e.target=0,e.components=0,e.width=0,e.height=0,e.depth=0,t.resetFormatAndType()},t.createTexture=()=>{e.handle||(e.handle=e.context.createTexture(),e.target&&(e.context.bindTexture(e.target,e.handle),e.context.texParameteri(e.target,e.context.TEXTURE_MIN_FILTER,t.getOpenGLFilterMode(e.minificationFilter)),e.context.texParameteri(e.target,e.context.TEXTURE_MAG_FILTER,t.getOpenGLFilterMode(e.magnificationFilter)),e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_S,t.getOpenGLWrapMode(e.wrapS)),e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_T,t.getOpenGLWrapMode(e.wrapT)),e._openGLRenderWindow.getWebgl2()&&e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_R,t.getOpenGLWrapMode(e.wrapR)),e.context.bindTexture(e.target,null)))},t.getTextureUnit=()=>e._openGLRenderWindow?e._openGLRenderWindow.getTextureUnitForTexture(t):-1,t.activate=()=>{e._openGLRenderWindow.activateTexture(t),t.bind()},t.deactivate=()=>{e._openGLRenderWindow&&e._openGLRenderWindow.deactivateTexture(t)},t.releaseGraphicsResources=m=>{m&&e.handle&&(m.activateTexture(t),m.deactivateTexture(t),e.context.deleteTexture(e.handle),e._prevTexParams=null,e.handle=0,e.numberOfDimensions=0,e.target=0,e.internalFormat=0,e.format=0,e.openGLDataType=0,e.components=0,e.width=0,e.height=0,e.depth=0,e.allocatedGPUMemoryInBytes=0),e.shaderProgram&&(e.shaderProgram.releaseGraphicsResources(m),e.shaderProgram=null)},t.bind=()=>{e.context.bindTexture(e.target,e.handle),e.autoParameters&&t.getMTime()>e.sendParametersTime.getMTime()&&t.sendParameters()},t.isBound=()=>{let m=!1;if(e.context&&e.handle){let p=0;switch(e.target){case e.context.TEXTURE_2D:p=e.context.TEXTURE_BINDING_2D;break;default:Gee("impossible case");break}m=e.context.getIntegerv(p)===e.handle}return m},t.sendParameters=()=>{e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_S,t.getOpenGLWrapMode(e.wrapS)),e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_T,t.getOpenGLWrapMode(e.wrapT)),e._openGLRenderWindow.getWebgl2()&&e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_R,t.getOpenGLWrapMode(e.wrapR)),e.context.texParameteri(e.target,e.context.TEXTURE_MIN_FILTER,t.getOpenGLFilterMode(e.minificationFilter)),e.context.texParameteri(e.target,e.context.TEXTURE_MAG_FILTER,t.getOpenGLFilterMode(e.magnificationFilter)),e._openGLRenderWindow.getWebgl2()&&(e.context.texParameteri(e.target,e.context.TEXTURE_BASE_LEVEL,e.baseLevel),e.context.texParameteri(e.target,e.context.TEXTURE_MAX_LEVEL,e.maxLevel)),e.sendParametersTime.modified()},t.getInternalFormat=(m,p)=>(e._forceInternalFormat||(e.internalFormat=t.getDefaultInternalFormat(m,p)),e.internalFormat||PR(`Unable to find suitable internal format for T=${m} NC= ${p}`),[e.context.R32F,e.context.RG32F,e.context.RGB32F,e.context.RGBA32F].includes(e.internalFormat)&&!e.context.getExtension("OES_texture_float_linear")&&Gee("Failed to load OES_texture_float_linear. Texture filtering is not available for *32F internal formats."),e.internalFormat),t.getDefaultInternalFormat=(m,p)=>{let y=0;return y=e._openGLRenderWindow.getDefaultTextureInternalFormat(m,p,r(),t.useHalfFloat()),y||(y||(PR("Unsupported internal texture type!"),PR(`Unable to find suitable internal format for T=${m} NC= ${p}`)),y)},t.useHalfFloat=()=>e.enableUseHalfFloat&&e.canUseHalfFloat,t.setInternalFormat=m=>{e._forceInternalFormat=!0,m!==e.internalFormat&&(e.internalFormat=m,t.modified())},t.getFormat=(m,p)=>(e.format=t.getDefaultFormat(m,p),e.format),t.getDefaultFormat=(m,p)=>{if(e._openGLRenderWindow.getWebgl2())switch(p){case 1:return e.context.RED;case 2:return e.context.RG;case 3:return e.context.RGB;case 4:return e.context.RGBA;default:return e.context.RGB}else switch(p){case 1:return e.context.LUMINANCE;case 2:return e.context.LUMINANCE_ALPHA;case 3:return e.context.RGB;case 4:return e.context.RGBA;default:return e.context.RGB}},t.resetFormatAndType=()=>{e._prevTexParams=null,e.format=0,e.internalFormat=0,e._forceInternalFormat=!1,e.openGLDataType=0},t.getDefaultDataType=m=>{const p=t.useHalfFloat();if(e._openGLRenderWindow.getWebgl2())switch(m){case vr.UNSIGNED_CHAR:return e.context.UNSIGNED_BYTE;case(r()&&!p&&vr.SHORT):return e.context.SHORT;case(r()&&!p&&vr.UNSIGNED_SHORT):return e.context.UNSIGNED_SHORT;case(p&&vr.SHORT):return e.context.HALF_FLOAT;case(p&&vr.UNSIGNED_SHORT):return e.context.HALF_FLOAT;case vr.FLOAT:case vr.VOID:default:return e.context.FLOAT}switch(m){case vr.UNSIGNED_CHAR:return e.context.UNSIGNED_BYTE;case vr.FLOAT:case vr.VOID:default:if(e.context.getExtension("OES_texture_float")&&e.context.getExtension("OES_texture_float_linear"))return e.context.FLOAT;{const y=e.context.getExtension("OES_texture_half_float");if(y&&e.context.getExtension("OES_texture_half_float_linear"))return y.HALF_FLOAT_OES}return e.context.UNSIGNED_BYTE}},t.getOpenGLDataType=function(m){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return(!e.openGLDataType||p)&&(e.openGLDataType=t.getDefaultDataType(m)),e.openGLDataType},t.getShiftAndScale=()=>{let m=0,p=1;switch(e.openGLDataType){case e.context.BYTE:p=127.5,m=p-128;break;case e.context.UNSIGNED_BYTE:p=255,m=0;break;case e.context.SHORT:p=32767.5,m=p-32768;break;case e.context.UNSIGNED_SHORT:p=65536,m=0;break;case e.context.INT:p=21474836475e-1,m=p-2147483648;break;case e.context.UNSIGNED_INT:p=4294967295,m=0;break;case e.context.FLOAT:}return{shift:m,scale:p}},t.getOpenGLFilterMode=m=>{switch(m){case so.NEAREST:return e.context.NEAREST;case so.LINEAR:return e.context.LINEAR;case so.NEAREST_MIPMAP_NEAREST:return e.context.NEAREST_MIPMAP_NEAREST;case so.NEAREST_MIPMAP_LINEAR:return e.context.NEAREST_MIPMAP_LINEAR;case so.LINEAR_MIPMAP_NEAREST:return e.context.LINEAR_MIPMAP_NEAREST;case so.LINEAR_MIPMAP_LINEAR:return e.context.LINEAR_MIPMAP_LINEAR;default:return e.context.NEAREST}},t.getOpenGLWrapMode=m=>{switch(m){case S0.CLAMP_TO_EDGE:return e.context.CLAMP_TO_EDGE;case S0.REPEAT:return e.context.REPEAT;case S0.MIRRORED_REPEAT:return e.context.MIRRORED_REPEAT;default:return e.context.CLAMP_TO_EDGE}};function i(m){const[p,y,x,S,C,_]=m;return[y-p+1,S-x+1,_-C+1]}function a(m){const[p,y,x]=i(m);return p*y*x}function o(m,p,y,x,S){const[C,_,T,O,M,I]=y,[V,k]=p,L=V*k;let $=S;for(let W=M;W<=I;W++){const G=W*L;for(let oe=T;oe<=O;oe++){const U=G+oe*V;for(let Y=U+C,J=U+_;Y<=J;Y++,$++)x[$]=m[Y]}}}function s(m,p){const x=(arguments.length>2&&arguments[2]!==void 0?arguments[2]:null)||m.constructor,S=p.reduce((O,M)=>O+a(M),0),C=new x(S),_=[e.width,e.height,e.depth];let T=0;return p.forEach(O=>{o(m,_,O,C,T),T+=a(O)}),C}t.updateArrayDataTypeForGL=function(m,p){let y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,x=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];const S=[];let C=e.width*e.height*e.components;y&&(C*=e.depth);const _=!!x.length;if(m!==vr.FLOAT&&e.openGLDataType===e.context.FLOAT)for(let O=0;O<p.length;O++)if(p[O])if(_)S.push(s(p[O],x,Float32Array));else{const M=p[O].length>C?p[O].subarray(0,C):p[O];S.push(new Float32Array(M))}else S.push(null);if(m!==vr.UNSIGNED_CHAR&&e.openGLDataType===e.context.UNSIGNED_BYTE)for(let O=0;O<p.length;O++)if(p[O])if(_)S.push(s(p[O],x,Uint8Array));else{const M=p[O].length>C?p[O].subarray(0,C):p[O];S.push(new Uint8Array(M))}else S.push(null);let T=!1;if(e._openGLRenderWindow.getWebgl2())T=e.openGLDataType===e.context.HALF_FLOAT;else{const O=e.context.getExtension("OES_texture_half_float");T=O&&e.openGLDataType===O.HALF_FLOAT_OES}if(T)for(let O=0;O<p.length;O++)if(p[O]){const M=_?s(p[O],x):p[O],I=new Uint16Array(_?M.length:C),V=I.length;for(let k=0;k<V;k++)I[k]=XTt(M[k]);S.push(I)}else S.push(null);if(S.length===0)for(let O=0;O<p.length;O++)S.push(_&&p[O]?s(p[O],x):p[O]);return S};function c(m){if(e._openGLRenderWindow.getWebgl2())return m;const p=[],y=e.width,x=e.height,S=e.components;if(m&&(!C5(y)||!C5(x))){const C=e.context.getExtension("OES_texture_half_float"),_=yg(y),T=yg(x),O=_*T*e.components;for(let M=0;M<m.length;M++)if(m[M]!==null){let I=null;const V=x/T,k=y/_;let L=!1;e.openGLDataType===e.context.FLOAT?I=new Float32Array(O):C&&e.openGLDataType===C.HALF_FLOAT_OES?(I=new Uint16Array(O),L=!0):I=new Uint8Array(O);for(let $=0;$<T;$++){const W=$*_*S,G=$*V;let oe=Math.floor(G),U=Math.ceil(G);U>=x&&(U=x-1);const Y=G-oe,J=1-Y;oe=oe*y*S,U=U*y*S;for(let ne=0;ne<_;ne++){const F=ne*S,ae=ne*k;let re=Math.floor(ae),te=Math.ceil(ae);te>=y&&(te=y-1);const ye=ae-re;re*=S,te*=S;for(let we=0;we<S;we++)L?I[W+F+we]=Lv.toHalf(Lv.fromHalf(m[M][oe+re+we])*J*(1-ye)+Lv.fromHalf(m[M][oe+te+we])*J*ye+Lv.fromHalf(m[M][U+re+we])*Y*(1-ye)+Lv.fromHalf(m[M][U+te+we])*Y*ye):I[W+F+we]=m[M][oe+re+we]*J*(1-ye)+m[M][oe+te+we]*J*ye+m[M][U+re+we]*Y*(1-ye)+m[M][U+te+we]*Y*ye}}p.push(I),e.width=_,e.height=T}else p.push(null)}if(p.length===0)for(let C=0;C<m.length;C++)p.push(m[C]);return p}function l(m){return e._openGLRenderWindow?e.resizable||e.renderable?.getResizable()?!1:e._openGLRenderWindow.getWebgl2()?!(e._openGLRenderWindow.getGLInformations().RENDERER.value.match(/WebKit/gi)&&navigator.platform.match(/Mac/gi)&&r()&&(m===vr.UNSIGNED_SHORT||m===vr.SHORT)):!1:!1}t.create2DFromRaw=function(m,p,y,x,S){let C=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1;if(t.getOpenGLDataType(x,!0),t.getInternalFormat(x,y),t.getFormat(x,y),!e.internalFormat||!e.format||!e.openGLDataType)return vv("Failed to determine texture parameters."),!1;e.target=e.context.TEXTURE_2D,e.components=y,e.width=m,e.height=p,e.depth=1,e.numberOfDimensions=2,e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind();const _=[S],T=t.updateArrayDataTypeForGL(x,_),O=c(T);return e.context.pixelStorei(e.context.UNPACK_FLIP_Y_WEBGL,C),e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),l(x)?(e.context.texStorage2D(e.target,1,e.internalFormat,e.width,e.height),O[0]!=null&&e.context.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.openGLDataType,O[0])):e.context.texImage2D(e.target,0,e.internalFormat,e.width,e.height,0,e.format,e.openGLDataType,O[0]),e.generateMipmap&&e.context.generateMipmap(e.target),C&&e.context.pixelStorei(e.context.UNPACK_FLIP_Y_WEBGL,!1),e.allocatedGPUMemoryInBytes=e.width*e.height*e.depth*y*e._openGLRenderWindow.getDefaultTextureByteSize(x,r(),t.useHalfFloat()),t.deactivate(),!0},t.createCubeFromRaw=(m,p,y,x,S)=>{if(t.getOpenGLDataType(x),t.getInternalFormat(x,y),t.getFormat(x,y),!e.internalFormat||!e.format||!e.openGLDataType)return vv("Failed to determine texture parameters."),!1;e.target=e.context.TEXTURE_CUBE_MAP,e.components=y,e.width=m,e.height=p,e.depth=1,e.numberOfDimensions=2,e._openGLRenderWindow.activateTexture(t),e.maxLevel=S.length/6-1,t.createTexture(),t.bind();const C=t.updateArrayDataTypeForGL(x,S),_=c(C),T=[];let O=e.width,M=e.height;for(let I=0;I<_.length;I++){I%6===0&&I!==0&&(O/=2,M/=2),T[I]=I2(x,M*O*e.components);for(let V=0;V<M;++V){const k=V*O*e.components,L=(M-V-1)*O*e.components;T[I].set(_[I].slice(L,L+O*e.components),k)}}e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),l(x)&&e.context.texStorage2D(e.target,6,e.internalFormat,e.width,e.height);for(let I=0;I<6;I++){let V=0,k=e.width,L=e.height;for(;k>=1&&L>=1;){let $=null;V<=e.maxLevel&&($=T[6*V+I]),l(x)?$!=null&&e.context.texSubImage2D(e.context.TEXTURE_CUBE_MAP_POSITIVE_X+I,V,0,0,k,L,e.format,e.openGLDataType,$):e.context.texImage2D(e.context.TEXTURE_CUBE_MAP_POSITIVE_X+I,V,e.internalFormat,k,L,0,e.format,e.openGLDataType,$),V++,k/=2,L/=2}}return e.allocatedGPUMemoryInBytes=e.width*e.height*e.depth*y*e._openGLRenderWindow.getDefaultTextureByteSize(x,r(),t.useHalfFloat()),t.deactivate(),!0},t.createDepthFromRaw=(m,p,y,x)=>(t.getOpenGLDataType(y),e.format=e.context.DEPTH_COMPONENT,e._openGLRenderWindow.getWebgl2()?y===vr.FLOAT?e.internalFormat=e.context.DEPTH_COMPONENT32F:e.internalFormat=e.context.DEPTH_COMPONENT16:e.internalFormat=e.context.DEPTH_COMPONENT,!e.internalFormat||!e.format||!e.openGLDataType?(vv("Failed to determine texture parameters."),!1):(e.target=e.context.TEXTURE_2D,e.components=1,e.width=m,e.height=p,e.depth=1,e.numberOfDimensions=2,e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind(),e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),l(y)?(e.context.texStorage2D(e.target,1,e.internalFormat,e.width,e.height),x!=null&&e.context.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.openGLDataType,x)):e.context.texImage2D(e.target,0,e.internalFormat,e.width,e.height,0,e.format,e.openGLDataType,x),e.generateMipmap&&e.context.generateMipmap(e.target),e.allocatedGPUMemoryInBytes=e.width*e.height*e.depth*e.components*e._openGLRenderWindow.getDefaultTextureByteSize(y,r(),t.useHalfFloat()),t.deactivate(),!0)),t.create2DFromImage=m=>{if(t.getOpenGLDataType(vr.UNSIGNED_CHAR),t.getInternalFormat(vr.UNSIGNED_CHAR,4),t.getFormat(vr.UNSIGNED_CHAR,4),!e.internalFormat||!e.format||!e.openGLDataType)return vv("Failed to determine texture parameters."),!1;e.target=e.context.TEXTURE_2D,e.components=4,e.depth=1,e.numberOfDimensions=2,e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind(),e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1);const p=!e._openGLRenderWindow.getWebgl2()&&(!C5(m.width)||!C5(m.height)),y=document.createElement("canvas");y.width=p?yg(m.width):m.width,y.height=p?yg(m.height):m.height,e.width=y.width,e.height=y.height;const x=y.getContext("2d");x.translate(0,y.height),x.scale(1,-1),x.drawImage(m,0,0,m.width,m.height,0,0,y.width,y.height);const S=y;return l(vr.UNSIGNED_CHAR)?(e.context.texStorage2D(e.target,1,e.internalFormat,e.width,e.height),S!=null&&e.context.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.openGLDataType,S)):e.context.texImage2D(e.target,0,e.internalFormat,e.width,e.height,0,e.format,e.openGLDataType,S),e.generateMipmap&&e.context.generateMipmap(e.target),e.allocatedGPUMemoryInBytes=e.width*e.height*e.depth*e.components*e._openGLRenderWindow.getDefaultTextureByteSize(vr.UNSIGNED_CHAR,r(),t.useHalfFloat()),t.deactivate(),!0};function u(m,p,y){const x=new Array(y),S=new Array(y);for(let C=0;C<y;++C)x[C]=m[C],S[C]=p[C]-m[C]||1;return{scale:S,offset:x}}function f(m,p){for(let y=0;y<m.length;y++){const x=m[y],S=p[y]+x;if(x<-2048||x>2048||S<-2048||S>2048)return!1}return!0}function d(m,p,y,x){t.getOpenGLDataType(m);const S=f(p,y)||x;let C=!1;if(e._openGLRenderWindow.getWebgl2())C=e.openGLDataType===e.context.FLOAT&&e.context.getExtension("OES_texture_float_linear")===null&&S||e.openGLDataType===e.context.HALF_FLOAT;else{const _=e.context.getExtension("OES_texture_half_float");C=_&&e.openGLDataType===_.HALF_FLOAT_OES}e.canUseHalfFloat=C&&S}function h(m,p){const y=m.getNumberOfComponents(),x=m.getDataType(),S=m.getData(),C=new Array(y),_=new Array(y);for(let O=0;O<y;++O){const[M,I]=m.getRange(O);C[O]=M,_[O]=I}const T=u(C,_,y);return d(x,T.offset,T.scale,p),t.useHalfFloat()||t.getOpenGLDataType(x,!0),{numComps:y,dataType:x,data:S,scaleOffsets:T}}t.create2DFilterableFromRaw=function(m,p,y,x,S){let C=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,_=arguments.length>6&&arguments[6]!==void 0?arguments[6]:void 0;return t.create2DFilterableFromDataArray(m,p,On.newInstance({numberOfComponents:y,dataType:x,values:S,ranges:_}),C)},t.create2DFilterableFromDataArray=function(m,p,y){let x=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const{numComps:S,dataType:C,data:_}=h(y,x);t.create2DFromRaw(m,p,S,C,_)},t.updateVolumeInfoForGL=(m,p)=>{let y=!1;const x=t.useHalfFloat();(!e.volumeInfo?.scale||!e.volumeInfo?.offset)&&(e.volumeInfo={scale:new Array(p),offset:new Array(p)});for(let S=0;S<p;++S)e.volumeInfo.scale[S]=1,e.volumeInfo.offset[S]=0;if(r()&&!x&&m===vr.SHORT){for(let S=0;S<p;++S)e.volumeInfo.scale[S]=32767;y=!0}if(r()&&!x&&m===vr.UNSIGNED_SHORT){for(let S=0;S<p;++S)e.volumeInfo.scale[S]=65535;y=!0}if(m===vr.UNSIGNED_CHAR){for(let S=0;S<p;++S)e.volumeInfo.scale[S]=255;y=!0}return(m===vr.FLOAT||x&&(m===vr.SHORT||m===vr.UNSIGNED_SHORT))&&(y=!0),y},t.create3DFromRaw=function(m,p,y,x,S,C){let _=arguments.length>6&&arguments[6]!==void 0?arguments[6]:[],T=S,O=C;if(!t.updateVolumeInfoForGL(T,x)&&O){const W=m*p*y,G=structuredClone(e.volumeInfo),oe=new Float32Array(W*x);e.volumeInfo.offset=G.offset,e.volumeInfo.scale=G.scale;let U=0;const Y=G.scale.map(J=>1/J);for(let J=0;J<W;J++)for(let ne=0;ne<x;ne++)oe[U]=(O[U]-G.offset[ne])*Y[ne],U++;T=vr.FLOAT,O=oe}if(t.getOpenGLDataType(T),t.getInternalFormat(T,x),t.getFormat(T,x),!e.internalFormat||!e.format||!e.openGLDataType)return vv("Failed to determine texture parameters."),!1;e.target=e.context.TEXTURE_3D,e.components=x,e.width=m,e.height=p,e.depth=y,e.numberOfDimensions=3,e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind();const M=_.length>0,I=!M||!_U(e._prevTexParams,n()),V=[O],L=t.updateArrayDataTypeForGL(T,V,!0,I?[]:_),$=c(L);if(e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),I)l(T)?(e.context.texStorage3D(e.target,1,e.internalFormat,e.width,e.height,e.depth),$[0]!=null&&e.context.texSubImage3D(e.target,0,0,0,0,e.width,e.height,e.depth,e.format,e.openGLDataType,$[0])):e.context.texImage3D(e.target,0,e.internalFormat,e.width,e.height,e.depth,0,e.format,e.openGLDataType,$[0]),e._prevTexParams=n();else if(M){const W=$[0];let G=0;for(let oe=0;oe<_.length;oe++){const U=_[oe],Y=i(U),J=a(U),ne=new W.constructor(W.buffer,G,J);G+=ne.byteLength,e.context.texSubImage3D(e.target,0,U[0],U[2],U[4],Y[0],Y[1],Y[2],e.format,e.openGLDataType,ne)}}return e.generateMipmap&&e.context.generateMipmap(e.target),e.allocatedGPUMemoryInBytes=e.width*e.height*e.depth*e.components*e._openGLRenderWindow.getDefaultTextureByteSize(T,r(),t.useHalfFloat()),t.deactivate(),!0},t.create3DFilterableFromRaw=function(m,p,y,x,S,C){let _=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!1,T=arguments.length>7&&arguments[7]!==void 0?arguments[7]:void 0,O=arguments.length>8&&arguments[8]!==void 0?arguments[8]:[];return t.create3DFilterableFromDataArray(m,p,y,On.newInstance({numberOfComponents:x,dataType:S,values:C,ranges:T}),_,O)},t.create3DFilterableFromDataArray=function(m,p,y,x){let S=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,C=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[];const{numComps:_,dataType:T,data:O,scaleOffsets:M}=h(x,S),I=[],V=[];for(let Oe=0;Oe<_;++Oe)I[Oe]=0,V[Oe]=1;if(e.volumeInfo={scale:V,offset:I,dataComputedScale:M.scale,dataComputedOffset:M.offset,width:m,height:p,depth:y},e._openGLRenderWindow.getWebgl2())return t.create3DFromRaw(m,p,y,_,T,O,C);const k=m*p*y,L=structuredClone(M);let $=(Oe,Te,Me,be,Ye)=>{Oe[Te]=Me},W=vr.UNSIGNED_CHAR;if(T===vr.UNSIGNED_CHAR)for(let Oe=0;Oe<_;++Oe)L.offset[Oe]=0,L.scale[Oe]=255;else e.context.getExtension("OES_texture_float")&&e.context.getExtension("OES_texture_float_linear")?(W=vr.FLOAT,$=(Oe,Te,Me,be,Ye)=>{Oe[Te]=(Me-be)/Ye}):(W=vr.UNSIGNED_CHAR,$=(Oe,Te,Me,be,Ye)=>{Oe[Te]=255*(Me-be)/Ye});if(t.getOpenGLDataType(W),t.getInternalFormat(W,_),t.getFormat(W,_),!e.internalFormat||!e.format||!e.openGLDataType)return vv("Failed to determine texture parameters."),!1;e.target=e.context.TEXTURE_2D,e.components=_,e.depth=1,e.numberOfDimensions=2;let G=e.context.getParameter(e.context.MAX_TEXTURE_SIZE);G>4096&&(W===vr.FLOAT||_>=3)&&(G=4096);let oe=1,U=1;k>G*G&&(oe=Math.ceil(Math.sqrt(k/(G*G))),U=oe);let Y=Math.sqrt(k)/oe;Y=yg(Y);const J=Math.floor(Y*oe/m),ne=Math.ceil(y/J),F=yg(p*ne/U);e.width=Y,e.height=F,e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind(),e.volumeInfo.xreps=J,e.volumeInfo.yreps=ne,e.volumeInfo.xstride=oe,e.volumeInfo.ystride=U,e.volumeInfo.offset=L.offset,e.volumeInfo.scale=L.scale;let ae;const re=Y*F*_;W===vr.FLOAT?ae=new Float32Array(re):ae=new Uint8Array(re);let te=0;const ye=Math.floor(m/oe),we=Math.floor(p/U);for(let Oe=0;Oe<ne;Oe++){const Te=Math.min(J,y-Oe*J),Me=_*(e.width-Te*Math.floor(m/oe));for(let be=0;be<we;be++){for(let Ye=0;Ye<Te;Ye++){const ft=_*((Oe*J+Ye)*m*p+U*be*m);for(let je=0;je<ye;je++)for(let It=0;It<_;It++)$(ae,te,O[ft+oe*je*_+It],L.offset[It],L.scale[It]),te++}te+=Me}}return e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),l(W)?(e.context.texStorage2D(e.target,1,e.internalFormat,e.width,e.height),ae!=null&&e.context.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.openGLDataType,ae)):e.context.texImage2D(e.target,0,e.internalFormat,e.width,e.height,0,e.format,e.openGLDataType,ae),t.deactivate(),!0},t.setOpenGLRenderWindow=m=>{e._openGLRenderWindow!==m&&(t.releaseGraphicsResources(),e._openGLRenderWindow=m,e.context=null,m&&(e.context=e._openGLRenderWindow.getContext()))},t.getMaximumTextureSize=m=>m&&m.isCurrent()?m.getIntegerv(m.MAX_TEXTURE_SIZE):-1,t.enableUseHalfFloat=m=>{e.enableUseHalfFloat=m}}const QTt={_openGLRenderWindow:null,_forceInternalFormat:!1,_prevTexParams:null,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:S0.CLAMP_TO_EDGE,wrapT:S0.CLAMP_TO_EDGE,wrapR:S0.CLAMP_TO_EDGE,minificationFilter:so.NEAREST,magnificationFilter:so.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0,enableUseHalfFloat:!0,canUseHalfFloat:!1};function lwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,QTt,n),La.extend(t,e,n),e.sendParametersTime={},yi(e.sendParametersTime,{mtime:0}),e.textureBuildTime={},yi(e.textureBuildTime,{mtime:0}),c3(t,e,["format","openGLDataType"]),Ja(t,e,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),sc(t,e,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),l3(t,e,["openGLRenderWindow"]),ZTt(t,e)}const uwe=ri(lwe,"vtkOpenGLTexture");var mi={newInstance:uwe,extend:lwe,...swe};jo("vtkTexture",uwe);function JTt(t,e){t.replaceShaderCoincidentOffset=(n,r,i)=>{const a=t.getCoincidentParameters(r,i);if(a&&(a.factor!==0||a.offset!==0)){let o=n.Fragment;o=Ie.substitute(o,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,e.context.getExtension("EXT_frag_depth")&&(a.factor!==0?(o=Ie.substitute(o,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,o=Ie.substitute(o,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):o=Ie.substitute(o,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),e._openGLRenderWindow.getWebgl2()&&(a.factor!==0?(o=Ie.substitute(o,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,o=Ie.substitute(o,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):o=Ie.substitute(o,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=o}}}function e6t(t,e){t.applyShaderReplacements=(n,r,i)=>{let a=null;if(r&&(a=r.ShaderReplacements),a)for(let o=0;o<a.length;o++){const s=a[o];if(i&&s.replaceFirst||!i&&!s.replaceFirst){const c=s.shaderType,l=n[c],u=Ie.substitute(l,s.originalValue,s.replacementValue,s.replaceAll);n[c]=u.result}}},t.buildShaders=(n,r,i)=>{t.getReplacedShaderTemplate(n,r,i),e.lastRenderPassShaderReplacement=e.currentRenderPass?e.currentRenderPass.getShaderReplacement():null,e.lastRenderPassShaderReplacement&&e.lastRenderPassShaderReplacement(n);const a=e.renderable.getViewSpecificProperties().OpenGL;t.applyShaderReplacements(n,a,!0),t.replaceShaderValues(n,r,i),t.applyShaderReplacements(n,a)},t.getReplacedShaderTemplate=(n,r,i)=>{const a=e.renderable.getViewSpecificProperties().OpenGL;t.getShaderTemplate(n,r,i);let o=n.Vertex;if(a){const l=a.VertexShaderCode;l!==void 0&&l!==""&&(o=l)}n.Vertex=o;let s=n.Fragment;if(a){const l=a.FragmentShaderCode;l!==void 0&&l!==""&&(s=l)}n.Fragment=s;let c=n.Geometry;if(a){const l=a.GeometryShaderCode;l!==void 0&&(c=l)}n.Geometry=c}}var sp={implementReplaceShaderCoincidentOffset:JTt,implementBuildShadersWithReplacements:e6t};let vF;function t6t(t,e){e.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),t.transformPoint=(n,r)=>(gr(r,n,e.matrix),r),t.transformPoints=(n,r)=>{const i=new Float64Array(3),a=new Float64Array(3);for(let o=0;o<n.length;o+=3)i[0]=n[o],i[1]=n[o+1],i[2]=n[o+2],gr(a,i,e.matrix),r[o]=a[0],r[o+1]=a[1],r[o+2]=a[2];return r},t.preMultiply=()=>{t.setPreMultiplyFlag(!0)},t.postMultiply=()=>{t.setPreMultiplyFlag(!1)},t.transformMatrix=(n,r)=>(e.preMultiplyFlag?Xn(r,e.matrix,n):Xn(r,n,e.matrix),r),t.transformMatrices=(n,r)=>{const i=new Float64Array(16),a=new Float64Array(16),o=e.preMultiplyFlag?()=>Xn(a,e.matrix,i):()=>Xn(a,i,e.matrix);for(let s=0;s<n.length;s+=16){for(let c=0;c<16;++c)i[c]=n[s+c];o();for(let c=0;c<16;++c)r[s+c]=a[c]}return r},t.getInverse=()=>vF({matrix:hu.invertMatrix(Array.from(e.matrix),[],4),preMultiplyFlag:e.preMultiplyFlag})}const n6t={preMultiplyFlag:!1,matrix:[...NU]};function fwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,n6t,n),se.obj(t,e),se.setGet(t,e,["preMultiplyFlag"]),se.setGetArray(t,e,["matrix"],16),t6t(t,e)}vF=se.newInstance(fwe,"vtkTransform");var r6t={newInstance:vF,extend:fwe};function Od(t,e,n){return t?`${t.getMTime()}-${e}-${n}`:"0"}function yF(t,e){return`${t.getMTime()}A${e.getMTime()}`}var i6t=`//VTK::System::Dec

/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkImageResliceMapperVS.glsl

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

// all variables that represent positions or directions have a suffix
// indicating the coordinate system they are in. The possible values are
// MC - Model coordinates
// WC - World coordinates
// VC - View coordinates
// DC - Display coordinates
// TC - Texture coordinates

// frag position in VC
//VTK::PositionVC::Dec

// Texture coordinates
//VTK::TCoord::Dec

// picking support
//VTK::Picking::Dec

// camera and actor matrix values
//VTK::Camera::Dec

void main()
{
  //VTK::PositionVC::Impl

  //VTK::TCoord::Impl

  //VTK::Picking::Impl
}
`,a6t=`//VTK::System::Dec

/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkImageResliceMapperFS.glsl

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// Template for the gpu image mapper fragment shader

// VC position of this fragment
//VTK::PositionVC::Dec

// Texture coordinates
//VTK::TCoord::Dec

// picking support
//VTK::Picking::Dec

// handle coincident offsets
//VTK::Coincident::Dec

//VTK::ZBuffer::Dec

// the output of this shader
//VTK::Output::Dec

void main()
{
  // VC position of this fragment. This should not branch/return/discard.
  //VTK::PositionVC::Impl

  // Place any calls that require uniform flow (e.g. dFdx) here.
  //VTK::UniformFlow::Impl

  // Set gl_FragDepth here (gl_FragCoord.z by default)
  //VTK::Depth::Impl

  // Early depth peeling abort:
  //VTK::DepthPeeling::PreColor

  //VTK::TCoord::Impl

  if (gl_FragData[0].a <= 0.0)
    {
    discard;
    }

  //VTK::DepthPeeling::Impl

  //VTK::Picking::Impl

  // handle coincident offsets
  //VTK::Coincident::Impl

  //VTK::ZBuffer::Impl

  //VTK::RenderPassFragmentShader::Impl
}
`;const Lm={NEAREST:0,LINEAR:1};var o6t={InterpolationType:Lm};const Of={Off:0,PolygonOffset:1};let hk=Of.PolygonOffset,XT=Of.Off;const s6t=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function c6t(){return hk}function l6t(t){const e=hk===t;return hk=t,e}function u6t(){return XT}function HE(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;const e=XT===t;return XT=t,e}function f6t(){return HE(Of.Off)}function d6t(){return HE(Of.Off)}function h6t(){return HE(Of.PolygonOffset)}function g6t(){return s6t[XT]}var gk={Resolve:Of,getResolveCoincidentTopologyAsString:g6t,getResolveCoincidentTopologyPolygonOffsetFaces:c6t,getResolveCoincidentTopology:u6t,setResolveCoincidentTopology:HE,setResolveCoincidentTopologyPolygonOffsetFaces:l6t,setResolveCoincidentTopologyToDefault:f6t,setResolveCoincidentTopologyToOff:d6t,setResolveCoincidentTopologyToPolygonOffset:h6t};function dwe(t,e,n){n.forEach(r=>{t[`get${r.method}`]=()=>e[r.key],t[`set${r.method}`]=se.objectSetterMap.object(t,e,{name:r.key,params:["factor","offset"]})})}const xF=["Polygon","Line","Point"],p6t={Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},m6t=()=>{},fm={modified:m6t};dwe(fm,p6t,xF.map(t=>({key:t,method:`ResolveCoincidentTopology${t}OffsetParameters`})));function v6t(t,e){e.resolveCoincidentTopology===void 0&&(e.resolveCoincidentTopology=!1),se.setGet(t,e,["resolveCoincidentTopology"]),e.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(gk).forEach(n=>{t[n]=gk[n]}),Object.keys(fm).filter(n=>n!=="modified").forEach(n=>{t[n]=fm[n]}),dwe(t,e.topologyOffset,xF.map(n=>({key:n,method:`RelativeCoincidentTopology${n}OffsetParameters`}))),t.getCoincidentTopologyPolygonOffsetParameters=()=>{const n=fm.getResolveCoincidentTopologyPolygonOffsetParameters(),r=t.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:n.factor+r.factor,offset:n.offset+r.offset}},t.getCoincidentTopologyLineOffsetParameters=()=>{const n=fm.getResolveCoincidentTopologyLineOffsetParameters(),r=t.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:n.factor+r.factor,offset:n.offset+r.offset}},t.getCoincidentTopologyPointOffsetParameter=()=>{const n=fm.getResolveCoincidentTopologyPointOffsetParameters(),r=t.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:n.factor+r.factor,offset:n.offset+r.offset}}}var qE={implementCoincidentTopologyMethods:v6t,staticOffsetAPI:fm,otherStaticMethods:gk,CATEGORIES:xF,Resolve:Of};const{vtkErrorMacro:zp}=Rs;function Wee(t,e,n){return e.identity(n),t.reduce((r,i,a)=>a===0?i?e.copy(r,i):e.identity(r):i?e.multiply(r,r,i):r,n)}function y6t(t,e){e.classHierarchy.push("vtkOpenGLImageResliceMapper");function n(i){[e._scalars,e._colorTransferFunc,e._pwFunc].forEach(a=>i.unregisterGraphicsResourceUser(a,t))}t.buildPass=i=>{if(i){e.currentRenderPass=null,e._openGLImageSlice=t.getFirstAncestorOfType("vtkOpenGLImageSlice"),e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer");const a=e._openGLRenderer.getRenderable();e._openGLCamera=e._openGLRenderer.getViewNodeFor(a.getActiveCamera());const o=e._openGLRenderWindow;e._openGLRenderWindow=e._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow"),o&&!o.isDeleted()&&o!==e._openGLRenderWindow&&n(o),e.context=e._openGLRenderWindow.getContext(),e.tris.setOpenGLRenderWindow(e._openGLRenderWindow)}},t.translucentPass=(i,a)=>{i&&(e.currentRenderPass=a,t.render())},t.zBufferPass=i=>{i&&(e.haveSeenDepthRequest=!0,e.renderDepth=!0,t.render(),e.renderDepth=!1)},t.opaqueZBufferPass=i=>t.zBufferPass(i),t.opaquePass=i=>{i&&t.render()},t.getCoincidentParameters=(i,a)=>e.renderable.getResolveCoincidentTopology()==Of.PolygonOffset?e.renderable.getCoincidentTopologyPolygonOffsetParameters():null,t.render=()=>{const i=e._openGLImageSlice.getRenderable(),a=e._openGLRenderer.getRenderable();t.renderPiece(a,i)},t.renderPiece=(i,a)=>{if(t.invokeEvent({type:"StartEvent"}),e.renderable.update(),e.currentInput=e.renderable.getInputData(),!e.currentInput){zp("No input!");return}t.updateResliceGeometry(),t.renderPieceStart(i,a),t.renderPieceDraw(i,a),t.renderPieceFinish(i,a),t.invokeEvent({type:"EndEvent"})},t.renderPieceStart=(i,a)=>{t.updateBufferObjects(i,a),a.getProperty().getInterpolationType()===Lm.NEAREST?(e.openGLTexture.setMinificationFilter(Kt.NEAREST),e.openGLTexture.setMagnificationFilter(Kt.NEAREST),e.colorTexture.setMinificationFilter(Kt.NEAREST),e.colorTexture.setMagnificationFilter(Kt.NEAREST),e.pwfTexture.setMinificationFilter(Kt.NEAREST),e.pwfTexture.setMagnificationFilter(Kt.NEAREST)):(e.openGLTexture.setMinificationFilter(Kt.LINEAR),e.openGLTexture.setMagnificationFilter(Kt.LINEAR),e.colorTexture.setMinificationFilter(Kt.LINEAR),e.colorTexture.setMagnificationFilter(Kt.LINEAR),e.pwfTexture.setMinificationFilter(Kt.LINEAR),e.pwfTexture.setMagnificationFilter(Kt.LINEAR)),e.lastBoundBO=null},t.renderPieceDraw=(i,a)=>{const o=e.context;e.openGLTexture.activate(),e.colorTexture.activate(),e.pwfTexture.activate(),t.updateShaders(e.tris,i,a),o.drawArrays(o.TRIANGLES,0,e.tris.getCABO().getElementCount()),e.tris.getVAO().release(),e.openGLTexture.deactivate(),e.colorTexture.deactivate(),e.pwfTexture.deactivate()},t.renderPieceFinish=(i,a)=>{},t.updateBufferObjects=(i,a)=>{t.getNeedToRebuildBufferObjects(i,a)&&t.buildBufferObjects(i,a)},t.getNeedToRebuildBufferObjects=(i,a)=>e.VBOBuildTime.getMTime()<t.getMTime()||e.VBOBuildTime.getMTime()<a.getMTime()||e.VBOBuildTime.getMTime()<e.renderable.getMTime()||e.VBOBuildTime.getMTime()<a.getProperty().getMTime()||e.VBOBuildTime.getMTime()<e.currentInput.getMTime()||e.VBOBuildTime.getMTime()<e.resliceGeom.getMTime()||!e.openGLTexture?.getHandle()||!e.colorTexture?.getHandle()||!e.pwfTexture?.getHandle(),t.buildBufferObjects=(i,a)=>{const o=e.currentInput;if(!o)return;const s=o.getPointData()?.getScalars();if(!s)return;const c=s.getNumberOfComponents();let l=yF(o,s);const u=e._openGLRenderWindow.getGraphicsResourceForObject(s),f=!u?.oglObject?.getHandle()||u?.hash!==l,d=e.renderable.getUpdatedExtents(),h=!!d.length;if(f&&!h){e.openGLTexture=mi.newInstance(),e.openGLTexture.setOpenGLRenderWindow(e._openGLRenderWindow),e.openGLTexture.setOglNorm16Ext(e.context.getExtension("EXT_texture_norm16")),e.openGLTexture.resetFormatAndType();const V=o.getDimensions();e.openGLTexture.create3DFilterableFromDataArray(V[0],V[1],V[2],s,!1,d),e._openGLRenderWindow.setGraphicsResourceForObject(s,e.openGLTexture,l),s!==e._scalars&&(e._openGLRenderWindow.registerGraphicsResourceUser(s,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._scalars,t)),e._scalars=s}else e.openGLTexture=u.oglObject;if(h){e.renderable.setUpdatedExtents([]);const V=o.getDimensions();e.openGLTexture.create3DFilterableFromDataArray(V[0],V[1],V[2],s,!1,d)}const m=a.getProperty(),p=m.getIndependentComponents(),y=p?c:1,x=p?2*y:1,S=m.getRGBTransferFunction();l=Od(S,p,y);const C=e._openGLRenderWindow.getGraphicsResourceForObject(S);if(!C?.oglObject?.getHandle()||C?.hash!==l){const k=1024*x*3,L=new Uint8ClampedArray(k);if(e.colorTexture=mi.newInstance(),e.colorTexture.setOpenGLRenderWindow(e._openGLRenderWindow),S){const $=new Float32Array(3072);for(let W=0;W<y;W++){const G=m.getRGBTransferFunction(W),oe=G.getRange();if(G.getTable(oe[0],oe[1],1024,$,1),p)for(let U=0;U<1024*3;U++)L[W*1024*6+U]=255*$[U],L[W*1024*6+U+1024*3]=255*$[U];else for(let U=0;U<1024*3;U++)L[W*1024*6+U]=255*$[U]}e.colorTexture.resetFormatAndType(),e.colorTexture.create2DFromRaw(1024,x,3,zn.UNSIGNED_CHAR,L)}else{for(let $=0;$<1024*3;++$)L[$]=255*$/(1023*3),L[$+1]=255*$/(1023*3),L[$+2]=255*$/(1023*3);e.colorTexture.resetFormatAndType(),e.colorTexture.create2DFromRaw(1024,1,3,zn.UNSIGNED_CHAR,L)}S&&(e._openGLRenderWindow.setGraphicsResourceForObject(S,e.colorTexture,l),S!==e._colorTransferFunc&&(e._openGLRenderWindow.registerGraphicsResourceUser(S,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._colorTransferFunc,t)),e._colorTransferFunc=S)}else e.colorTexture=C.oglObject;const T=m.getPiecewiseFunction();l=Od(T,p,y);const O=e._openGLRenderWindow.getGraphicsResourceForObject(T);if(!O?.oglObject?.getHandle()||O?.hash!==l){const k=1024*x,L=new Uint8ClampedArray(k);if(e.pwfTexture=mi.newInstance(),e.pwfTexture.setOpenGLRenderWindow(e._openGLRenderWindow),T){const $=new Float32Array(k),W=new Float32Array(1024);for(let G=0;G<y;++G){const oe=m.getPiecewiseFunction(G);if(oe===null)$.fill(1);else{const U=oe.getRange();if(oe.getTable(U[0],U[1],1024,W,1),p)for(let Y=0;Y<1024;Y++)$[G*1024*2+Y]=W[Y],$[G*1024*2+Y+1024]=W[Y];else for(let Y=0;Y<1024;Y++)$[G*1024*2+Y]=W[Y]}}e.pwfTexture.resetFormatAndType(),e.pwfTexture.create2DFromRaw(1024,x,1,zn.FLOAT,$)}else L.fill(255),e.pwfTexture.resetFormatAndType(),e.pwfTexture.create2DFromRaw(1024,1,1,zn.UNSIGNED_CHAR,L);T&&(e._openGLRenderWindow.setGraphicsResourceForObject(T,e.pwfTexture,l),T!==e._pwFunc&&(e._openGLRenderWindow.registerGraphicsResourceUser(T,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._pwFunc,t)),e._pwFunc=T)}else e.pwfTexture=O.oglObject;const I=`${e.resliceGeom.getMTime()}A${e.renderable.getSlabThickness()}`;if(!e.tris.getCABO().getElementCount()||e.VBOBuildString!==I){const V=On.newInstance({numberOfComponents:3,values:e.resliceGeom.getPoints().getData()});V.setName("points");const k=On.newInstance({numberOfComponents:1,values:e.resliceGeom.getPolys().getData()}),L={points:V,cellOffset:0};if(e.renderable.getSlabThickness()>0){const $=e.resliceGeom.getPointData().getNormals();$?L.normals=$:zp("Slab mode requested without normals")}e.tris.getCABO().createVBO(k,"polys",_l.SURFACE,L)}e.VBOBuildString=I,e.VBOBuildTime.modified()},t.updateShaders=(i,a,o)=>{if(e.lastBoundBO=i,t.getNeedToRebuildShaders(i,a,o)){const s={Vertex:null,Fragment:null,Geometry:null};t.buildShaders(s,a,o);const c=e._openGLRenderWindow.getShaderCache().readyShaderProgramArray(s.Vertex,s.Fragment,s.Geometry);c!==i.getProgram()&&(i.setProgram(c),i.getVAO().releaseGraphicsResources()),i.getShaderSourceTime().modified()}else e._openGLRenderWindow.getShaderCache().readyShaderProgram(i.getProgram());i.getVAO().bind(),t.setMapperShaderParameters(i,a,o),t.setCameraShaderParameters(i,a,o),t.setPropertyShaderParameters(i,a,o)},t.setMapperShaderParameters=(i,a,o)=>{const s=i.getProgram();if(i.getCABO().getElementCount()&&(e.VBOBuildTime.getMTime()>i.getAttributeUpdateTime().getMTime()||i.getShaderSourceTime().getMTime()>i.getAttributeUpdateTime().getMTime())){s.isUniformUsed("texture1")&&s.setUniformi("texture1",e.openGLTexture.getTextureUnit()),s.isAttributeUsed("vertexWC")&&(i.getVAO().addAttributeArray(s,i.getCABO(),"vertexWC",i.getCABO().getVertexOffset(),i.getCABO().getStride(),e.context.FLOAT,3,e.context.FALSE)||zp("Error setting vertexWC in shader VAO.")),s.isAttributeUsed("normalWC")&&(i.getVAO().addAttributeArray(s,i.getCABO(),"normalWC",i.getCABO().getNormalOffset(),i.getCABO().getStride(),e.context.FLOAT,3,e.context.FALSE)||zp("Error setting normalWC in shader VAO.")),s.isUniformUsed("slabThickness")&&s.setUniformf("slabThickness",e.renderable.getSlabThickness()),s.isUniformUsed("spacing")&&s.setUniform3fv("spacing",e.currentInput.getSpacing()),s.isUniformUsed("slabType")&&s.setUniformi("slabType",e.renderable.getSlabType()),s.isUniformUsed("slabType")&&s.setUniformi("slabType",e.renderable.getSlabType()),s.isUniformUsed("slabTrapezoid")&&s.setUniformi("slabTrapezoid",e.renderable.getSlabTrapezoidIntegration());const l=i.getCABO().getCoordShiftAndScaleEnabled()?i.getCABO().getInverseShiftAndScaleMatrix():null;if(s.isUniformUsed("WCTCMatrix")){const u=e.currentInput,f=u.getDimensions();pa(e.tmpMat4,u.getIndexToWorld()),Ma(e.tmpMat4,e.tmpMat4,[-.5,-.5,-.5]),Ed(e.tmpMat4,e.tmpMat4,f),Na(e.tmpMat4,e.tmpMat4),l&&Xn(e.tmpMat4,e.tmpMat4,l),s.setUniformMatrix("WCTCMatrix",e.tmpMat4)}s.isUniformUsed("vboScaling")&&s.setUniform3fv("vboScaling",i.getCABO().getCoordScale()??[1,1,1]),i.getAttributeUpdateTime().modified()}if(e.haveSeenDepthRequest&&i.getProgram().setUniformi("depthRequest",e.renderDepth?1:0),i.getProgram().isUniformUsed("coffset")){const c=t.getCoincidentParameters(a,o);i.getProgram().setUniformf("coffset",c.offset),i.getProgram().isUniformUsed("cfactor")&&i.getProgram().setUniformf("cfactor",c.factor)}},t.setCameraShaderParameters=(i,a,o)=>{const s=e._openGLCamera.getKeyMatrices(a),c=e._openGLImageSlice.getKeyMatrices(),u=i.getCABO().getCoordShiftAndScaleEnabled()?i.getCABO().getInverseShiftAndScaleMatrix():null,f=i.getProgram();f.isUniformUsed("MCPCMatrix")&&(sn(e.tmpMat4),f.setUniformMatrix("MCPCMatrix",Wee([s.wcpc,c.mcwc,u],BT,e.tmpMat4))),f.isUniformUsed("MCVCMatrix")&&(sn(e.tmpMat4),f.setUniformMatrix("MCVCMatrix",Wee([s.wcvc,c.mcwc,u],BT,e.tmpMat4)))},t.setPropertyShaderParameters=(i,a,o)=>{const s=i.getProgram(),c=o.getProperty(),l=c.getOpacity();s.setUniformf("opacity",l);const u=e.openGLTexture.getComponents(),f=c.getIndependentComponents();if(f)for(let p=0;p<u;++p)s.setUniformf(`mix${p}`,c.getComponentWeight(p));const d=e.openGLTexture.getVolumeInfo();for(let p=0;p<u;p++){let y=c.getColorWindow(),x=c.getColorLevel();const S=f?p:0,C=c.getRGBTransferFunction(S);if(C&&c.getUseLookupTableScalarRange()){const O=C.getRange();y=O[1]-O[0],x=.5*(O[1]+O[0])}const _=d.scale[p]/y,T=(d.offset[p]-x)/y+.5;s.setUniformf(`cshift${p}`,T),s.setUniformf(`cscale${p}`,_)}const h=e.colorTexture.getTextureUnit();s.setUniformi("colorTexture1",h);for(let p=0;p<u;p++){let y=1,x=0;const S=f?p:0,C=c.getPiecewiseFunction(S);if(C){const _=C.getRange(),T=_[1]-_[0],O=.5*(_[0]+_[1]);y=d.scale[p]/T,x=(d.offset[p]-O)/T+.5}s.setUniformf(`pwfshift${p}`,x),s.setUniformf(`pwfscale${p}`,y)}const m=e.pwfTexture.getTextureUnit();s.setUniformi("pwfTexture1",m),s.setUniform4fv("backgroundColor",e.renderable.getBackgroundColor())},t.getNeedToRebuildShaders=(i,a,o)=>{const s=e.openGLTexture.getComponents(),c=o.getProperty().getIndependentComponents(),l=e.renderable.getSlabThickness(),u=e.renderable.getSlabType(),f=e.renderable.getSlabTrapezoidIntegration();let d=!1;return(!e.currentRenderPass&&e.lastRenderPassShaderReplacement||e.currentRenderPass&&e.currentRenderPass.getShaderReplacement()!==e.lastRenderPassShaderReplacement)&&(d=!0),d||e.lastHaveSeenDepthRequest!==e.haveSeenDepthRequest||i.getProgram()?.getHandle()===0||e.lastTextureComponents!==s||e.lastIndependentComponents!==c||e.lastSlabThickness!==l||e.lastSlabType!==u||e.lastSlabTrapezoidIntegration!==f?(e.lastHaveSeenDepthRequest=e.haveSeenDepthRequest,e.lastTextureComponents=s,e.lastIndependentComponents=c,e.lastSlabThickness=l,e.lastSlabType=u,e.lastSlabTrapezoidIntegration=f,!0):!1},t.getShaderTemplate=(i,a,o)=>{i.Vertex=i6t,i.Fragment=a6t,i.Geometry=""},t.replaceShaderValues=(i,a,o)=>{if(t.replaceShaderTCoord(i,a,o),t.replaceShaderPositionVC(i,a,o),e.haveSeenDepthRequest){let s=i.Fragment;s=Ie.substitute(s,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,s=Ie.substitute(s,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,i.Fragment=s}t.replaceShaderCoincidentOffset(i,a,o)},t.replaceShaderTCoord=(i,a,o)=>{let s=i.Vertex;const c=i.Geometry;let l=i.Fragment;const u=["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"],f=e.renderable.getSlabThickness();s=Ie.substitute(s,"//VTK::TCoord::Dec",u).result;const d=["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"];s=Ie.substitute(s,"//VTK::TCoord::Impl",d).result;const h=e.openGLTexture.getComponents(),m=o.getProperty().getIndependentComponents();let p=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(m){for(let x=1;x<h;x++)p=p.concat([`uniform float cshift${x};`,`uniform float cscale${x};`,`uniform float pwfshift${x};`,`uniform float pwfscale${x};`]);switch(h){case 1:p=p.concat(["uniform float mix0;","#define height0 0.5"]);break;case 2:p=p.concat(["uniform float mix0;","uniform float mix1;","#define height0 0.25","#define height1 0.75"]);break;case 3:p=p.concat(["uniform float mix0;","uniform float mix1;","uniform float mix2;","#define height0 0.17","#define height1 0.5","#define height2 0.83"]);break;case 4:p=p.concat(["uniform float mix0;","uniform float mix1;","uniform float mix2;","uniform float mix3;","#define height0 0.125","#define height1 0.375","#define height2 0.625","#define height3 0.875"]);break;default:zp("Unsupported number of independent coordinates.")}}f>0&&(p=p.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),p=p.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{","  vec4 retVal = vec4(1.0);","  if (slabType == 0) // min","  {","    retVal = min(currVal, valToComp);","  }","  else if (slabType == 1) // max","  {","    retVal = max(currVal, valToComp);","  }","  else if (slabType == 3) // sum","  {","    retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); ","  }","  else // mean","  {","    retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); ","  }","  return retVal;","}"])),l=Ie.substitute(l,"//VTK::TCoord::Dec",p).result;let y=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{","  // set the background color and exit","  gl_FragData[0] = backgroundColor;","  return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(f>0&&(y=y.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{","  distTraveled += length(normalxspacing);","  float fnumSlices = float(numSlices);","  if (distTraveled > slabThickness * 0.5)","  {","    // Before stepping outside the slab, sample at the boundaries","    normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;","    trapezoid = slabTrapezoid;","  }","  vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;","  if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))","  {","    vec4 newVal = texture(texture1, fragTCoordNeg);","    tvalue = compositeValue(tvalue, newVal, trapezoid);","    numSlices += 1;","  }","  vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;","  if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))","  {","    vec4 newVal = texture(texture1, fragTCoordPos);","    tvalue = compositeValue(tvalue, newVal, trapezoid);","    numSlices += 1;","  }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{","  tvalue = tvalue / float(numSlices);","}"])),m){const x=["r","g","b","a"];for(let S=0;S<h;++S)y=y.concat([`vec3 tcolor${S} = mix${S} * texture2D(colorTexture1, vec2(tvalue.${x[S]} * cscale${S} + cshift${S}, height${S})).rgb;`,`float compWeight${S} = mix${S} * texture2D(pwfTexture1, vec2(tvalue.${x[S]} * pwfscale${S} + pwfshift${S}, height${S})).r;`]);switch(h){case 1:y=y.concat(["gl_FragData[0] = vec4(tcolor0.rgb, compWeight0 * opacity);"]);break;case 2:y=y.concat(["float weightSum = compWeight0 + compWeight1;","gl_FragData[0] = vec4(vec3((tcolor0.rgb * (compWeight0 / weightSum)) + (tcolor1.rgb * (compWeight1 / weightSum))), opacity);"]);break;case 3:y=y.concat(["float weightSum = compWeight0 + compWeight1 + compWeight2;","gl_FragData[0] = vec4(vec3((tcolor0.rgb * (compWeight0 / weightSum)) + (tcolor1.rgb * (compWeight1 / weightSum)) + (tcolor2.rgb * (compWeight2 / weightSum))), opacity);"]);break;case 4:y=y.concat(["float weightSum = compWeight0 + compWeight1 + compWeight2 + compWeight3;","gl_FragData[0] = vec4(vec3((tcolor0.rgb * (compWeight0 / weightSum)) + (tcolor1.rgb * (compWeight1 / weightSum)) + (tcolor2.rgb * (compWeight2 / weightSum)) + (tcolor3.rgb * (compWeight3 / weightSum))), opacity);"]);break;default:zp("Unsupported number of independent coordinates.")}}else switch(h){case 1:y=y.concat(["// Dependent components","float intensity = tvalue.r;","vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;","float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;","gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);"]);break;case 2:y=y.concat(["float intensity = tvalue.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tvalue.g + pwfshift0);"]);break;case 3:y=y.concat(["vec4 tcolor = cscale0*tvalue + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]);break;default:y=y.concat(["vec4 tcolor = cscale0*tvalue + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"])}l=Ie.substitute(l,"//VTK::TCoord::Impl",y).result,i.Vertex=s,i.Fragment=l,i.Geometry=c},t.replaceShaderPositionVC=(i,a,o)=>{let s=i.Vertex;const c=i.Geometry;let l=i.Fragment;const u=e.renderable.getSlabThickness();let f=["attribute vec4 vertexWC;"];f=f.concat([`//${t.getMTime()}${e.resliceGeomUpdateString}`]),u>0&&(f=f.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=Ie.substitute(s,"//VTK::PositionVC::Dec",f).result;let d=["gl_Position = MCPCMatrix * vertexWC;"];u>0&&(d=d.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),s=Ie.substitute(s,"//VTK::PositionVC::Impl",d).result,s=Ie.substitute(s,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let h=[];u>0&&(h=h.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),l=Ie.substitute(l,"//VTK::PositionVC::Dec",h).result,i.Vertex=s,i.Geometry=c,i.Fragment=l};function r(i){hu.normalize(i);const a=[0,0,0];for(let o=0;o<3;++o){bSt(a),a[o]=1;const s=hu.dot(i,a);if(s<-.999999||s>.999999)return[!0,o]}return[!1,2]}t.updateResliceGeometry=()=>{let i="";const a=e.currentInput,o=a?.getBounds();let s=!0,c=2;const l=e.renderable.getSlicePolyData(),u=e.renderable.getSlicePlane();if(l)i=i.concat(`PolyData${l.getMTime()}`);else if(u){i=i.concat(`Plane${u.getMTime()}`);const f=zU();a&&(i=i.concat(`Image${a.getMTime()}`),bxe(f,...a.getDirection()),g3(f,f));const d=[...u.getNormal()];NC(d,d,f),[s,c]=r(d)}else{const f=Os.newInstance();f.setNormal(0,0,1);let d=[0,1,0,1,0,1];a&&(d=o),f.setOrigin(d[0],d[2],.5*(d[5]+d[4])),e.renderable.setSlicePlane(f),i=i.concat(`Plane${u?.getMTime()}`),a&&(i=i.concat(`Image${a.getMTime()}`))}if(!e.resliceGeom||e.resliceGeomUpdateString!==i){if(l)e.resliceGeom||(e.resliceGeom=nh.newInstance()),e.resliceGeom.getPoints().setData(l.getPoints().getData(),3),e.resliceGeom.getPolys().setData(l.getPolys().getData(),1),e.resliceGeom.getPointData().setNormals(l.getPointData().getNormals());else if(u)if(s){const f=new Float32Array(12),d=a.worldToIndex(u.getOrigin(),[0,0,0]),h=[(c+1)%3,(c+2)%3].sort(),m=a.getSpatialExtent();let p=0;for(let _=0;_<2;++_)for(let T=0;T<2;++T)f[p+c]=d[c],f[p+h[0]]=m[2*h[0]+T],f[p+h[1]]=m[2*h[1]+_],p+=3;e.transform.setMatrix(a.getIndexToWorld()),e.transform.transformPoints(f,f);const y=new Uint16Array(8);y[0]=3,y[1]=0,y[2]=1,y[3]=3,y[4]=3,y[5]=0,y[6]=3,y[7]=2;const x=u.getNormal();hu.normalize(x);const S=new Float32Array(12);for(let _=0;_<4;++_)S[3*_]=x[0],S[3*_+1]=x[1],S[3*_+2]=x[2];e.resliceGeom||(e.resliceGeom=nh.newInstance()),e.resliceGeom.getPoints().setData(f,3),e.resliceGeom.getPolys().setData(y,1);const C=On.newInstance({numberOfComponents:3,values:S,name:"Normals"});e.resliceGeom.getPointData().setNormals(C)}else{e.outlineFilter.setInputData(a),e.cutter.setInputConnection(e.outlineFilter.getOutputPort()),e.cutter.setCutFunction(u),e.lineToSurfaceFilter.setInputConnection(e.cutter.getOutputPort()),e.lineToSurfaceFilter.update(),e.resliceGeom||(e.resliceGeom=nh.newInstance());const f=e.lineToSurfaceFilter.getOutputData();e.resliceGeom.getPoints().setData(f.getPoints().getData(),3),e.resliceGeom.getPolys().setData(f.getPolys().getData(),1),e.resliceGeom.getPointData().setNormals(f.getPointData().getNormals());const d=u.getNormal(),h=e.resliceGeom.getNumberOfPoints();hu.normalize(d);const m=new Float32Array(h*3);for(let y=0;y<h;++y)m[3*y]=d[0],m[3*y+1]=d[1],m[3*y+2]=d[2];const p=On.newInstance({numberOfComponents:3,values:m,name:"Normals"});e.resliceGeom.getPointData().setNormals(p)}else zp("Something went wrong.","A default slice plane should have been created in the beginning of","updateResliceGeometry.");e.resliceGeomUpdateString=i,e.resliceGeom?.modified()}},t.setOpenGLTexture=i=>{i&&(e.openGLTexture=i,e._externalOpenGLTexture=!0)},t.delete=u3(()=>{e._openGLRenderWindow&&n(e._openGLRenderWindow)},t.delete)}const x6t={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1};function w6t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,x6t,n),La.extend(t,e,n),sp.implementReplaceShaderCoincidentOffset(t,e,n),sp.implementBuildShadersWithReplacements(t,e,n),e.tris=Ph.newInstance(),e.openGLTexture=null,e.colorTexture=null,e.pwfTexture=null,e.VBOBuildTime={},yi(e.VBOBuildTime),e.tmpMat4=sn(new Float64Array(16)),e.outlineFilter=GTt.newInstance(),e.outlineFilter.setGenerateFaces(!0),e.outlineFilter.setGenerateLines(!1),e.cubePolyData=nh.newInstance(),e.cutter=oTt.newInstance(),e.lineToSurfaceFilter=tTt.newInstance(),e.transform=r6t.newInstance(),sc(t,e,["openGLTexture"]),y6t(t,e)}const b6t=ri(w6t,"vtkOpenGLImageResliceMapper");jo("vtkImageResliceMapper",b6t);const S6t={NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5};var KE={SlicingMode:S6t},wF=`//VTK::System::Dec

/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPolyDataVS.glsl

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

attribute vec4 vertexMC;

// frag position in VC
//VTK::PositionVC::Dec

// optional normal declaration
//VTK::Normal::Dec

// extra lighting parameters
//VTK::Light::Dec

// Texture coordinates
//VTK::TCoord::Dec

// material property values
//VTK::Color::Dec

// clipping plane vars
//VTK::Clip::Dec

// camera and actor matrix values
//VTK::Camera::Dec

// Apple Bug
//VTK::PrimID::Dec

// picking support
//VTK::Picking::Dec

void main()
{
  //VTK::Color::Impl

  //VTK::Normal::Impl

  //VTK::TCoord::Impl

  //VTK::Clip::Impl

  //VTK::PrimID::Impl

  //VTK::PositionVC::Impl

  //VTK::Light::Impl

  //VTK::Picking::Impl
}
`,v3=`//VTK::System::Dec

/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPolyDataFS.glsl

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// Template for the polydata mappers fragment shader

uniform int PrimitiveIDOffset;

// VC position of this fragment
//VTK::PositionVC::Dec

// optional color passed in from the vertex shader, vertexColor
//VTK::Color::Dec

// optional surface normal declaration
//VTK::Normal::Dec

// extra lighting parameters
//VTK::Light::Dec

// define vtkImageLabelOutlineOn
//VTK::ImageLabelOutlineOn

// Texture coordinates
//VTK::TCoord::Dec

// picking support
//VTK::Picking::Dec

// Depth Peeling Support
//VTK::DepthPeeling::Dec

// clipping plane vars
//VTK::Clip::Dec

// label outline 
//VTK::LabelOutline::Dec

// the output of this shader
//VTK::Output::Dec

// Apple Bug
//VTK::PrimID::Dec

// handle coincident offsets
//VTK::Coincident::Dec

//VTK::ZBuffer::Dec

//VTK::LabelOutlineHelperFunction

void main()
{
  // VC position of this fragment. This should not branch/return/discard.
  //VTK::PositionVC::Impl

  // Place any calls that require uniform flow (e.g. dFdx) here.
  //VTK::UniformFlow::Impl

  // Set gl_FragDepth here (gl_FragCoord.z by default)
  //VTK::Depth::Impl

  // Early depth peeling abort:
  //VTK::DepthPeeling::PreColor

  // Apple Bug
  //VTK::PrimID::Impl

  //VTK::Clip::Impl

  //VTK::Color::Impl

  // Generate the normal if we are not passed in one
  //VTK::Normal::Impl

  //VTK::TCoord::Impl

  //VTK::Light::Impl

  if (gl_FragData[0].a <= 0.0)
    {
    discard;
    }

  //VTK::DepthPeeling::Impl

  //VTK::Picking::Impl

  // handle coincident offsets
  //VTK::Coincident::Impl

  //VTK::ZBuffer::Impl

  //VTK::RenderPassFragmentShader::Impl
}
`;const{vtkErrorMacro:yv}=Rs,{SlicingMode:rl}=KE;function C6t(t){const e=t.split(`
`),n=[];for(let r=0;r<e.length;++r){const i=e[r].trim();i.length>0&&n.push(i)}return n}function _6t(t,e){e.classHierarchy.push("vtkOpenGLImageMapper");function n(r){e.openGLTexture.releaseGraphicsResources(r),[e._colorTransferFunc,e._pwFunc,e._labelOutlineThicknessArray].forEach(i=>r.unregisterGraphicsResourceUser(i,t))}t.buildPass=r=>{if(r){e.currentRenderPass=null,e.openGLImageSlice=t.getFirstAncestorOfType("vtkOpenGLImageSlice"),e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer");const i=e._openGLRenderWindow;e._openGLRenderWindow=e._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow"),i&&!i.isDeleted()&&i!==e._openGLRenderWindow&&n(i),e.context=e._openGLRenderWindow.getContext(),e.tris.setOpenGLRenderWindow(e._openGLRenderWindow);const a=e._openGLRenderer.getRenderable();e.openGLCamera=e._openGLRenderer.getViewNodeFor(a.getActiveCamera()),e.renderable.isA("vtkImageMapper")&&e.renderable.getSliceAtFocalPoint()&&e.renderable.setSliceFromCamera(a.getActiveCamera())}},t.translucentPass=(r,i)=>{r&&(e.currentRenderPass=i,t.render())},t.zBufferPass=r=>{r&&(e.haveSeenDepthRequest=!0,e.renderDepth=!0,t.render(),e.renderDepth=!1)},t.opaqueZBufferPass=r=>t.zBufferPass(r),t.opaquePass=r=>{r&&t.render()},t.getCoincidentParameters=(r,i)=>e.renderable.getResolveCoincidentTopology()==Of.PolygonOffset?e.renderable.getCoincidentTopologyPolygonOffsetParameters():null,t.render=()=>{const r=e.openGLImageSlice.getRenderable(),i=e._openGLRenderer.getRenderable();t.renderPiece(i,r)},t.getShaderTemplate=(r,i,a)=>{r.Vertex=wF,r.Fragment=v3,r.Geometry=""},t.replaceShaderValues=(r,i,a)=>{let o=r.Vertex,s=r.Fragment;o=Ie.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,o=Ie.substitute(o,"//VTK::PositionVC::Impl",["  gl_Position = MCPCMatrix * vertexMC;"]).result,o=Ie.substitute(o,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,o=Ie.substitute(o,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const c=e.openGLTexture.getComponents(),l=a.getProperty().getIndependentComponents();let u=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let d=1;d<c;d++)u=u.concat([`uniform float cshift${d};`,`uniform float cscale${d};`,`uniform float pwfshift${d};`,`uniform float pwfscale${d};`]);switch(c){case 1:u=u.concat(["uniform float mix0;","#define height0 0.5"]);break;case 2:u=u.concat(["uniform float mix0;","uniform float mix1;","#define height0 0.25","#define height1 0.75"]);break;case 3:u=u.concat(["uniform float mix0;","uniform float mix1;","uniform float mix2;","#define height0 0.17","#define height1 0.5","#define height2 0.83"]);break;case 4:u=u.concat(["uniform float mix0;","uniform float mix1;","uniform float mix2;","uniform float mix3;","#define height0 0.125","#define height1 0.375","#define height2 0.625","#define height3 0.875"]);break;default:yv("Unsupported number of independent coordinates.")}}if(s=Ie.substitute(s,"//VTK::TCoord::Dec",u).result,a.getProperty().getUseLabelOutline()===!0&&(s=Ie.substitute(s,"//VTK::LabelOutline::Dec",["uniform int outlineThickness;","uniform float vpWidth;","uniform float vpHeight;","uniform float vpOffsetX;","uniform float vpOffsetY;","uniform mat4 PCWCMatrix;","uniform mat4 vWCtoIDX;","uniform ivec3 imageDimensions;","uniform int sliceAxis;"]).result,s=Ie.substitute(s,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result,s=Ie.substitute(s,"//VTK::LabelOutlineHelperFunction",["#ifdef vtkImageLabelOutlineOn","vec3 fragCoordToIndexSpace(vec4 fragCoord) {","  vec4 pcPos = vec4(","    (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,","    (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,","    (fragCoord.z - 0.5) * 2.0,","    1.0);","","  vec4 worldCoord = PCWCMatrix * pcPos;","  vec4 vertex = (worldCoord/worldCoord.w);","","  vec3 index = (vWCtoIDX * vertex).xyz;","","  // half voxel fix for labelmapOutline","  return (index + vec3(0.5)) / vec3(imageDimensions);","}","vec2 getSliceCoords(vec3 coord, int axis) {","  if (axis == 0) return coord.yz;","  if (axis == 1) return coord.xz;","  if (axis == 2) return coord.xy;","}","#endif"]).result),l){const d=["r","g","b","a"];let h=["vec4 tvalue = texture2D(texture1, tcoordVCVSOutput);"];for(let m=0;m<c;m++)h=h.concat([`vec3 tcolor${m} = mix${m} * texture2D(colorTexture1, vec2(tvalue.${d[m]} * cscale${m} + cshift${m}, height${m})).rgb;`,`float compWeight${m} = mix${m} * texture2D(pwfTexture1, vec2(tvalue.${d[m]} * pwfscale${m} + pwfshift${m}, height${m})).r;`]);switch(c){case 1:h=h.concat(["gl_FragData[0] = vec4(tcolor0.rgb, opacity);"]);break;case 2:h=h.concat(["float weightSum = compWeight0 + compWeight1;","gl_FragData[0] = vec4(vec3((tcolor0.rgb * (compWeight0 / weightSum)) + (tcolor1.rgb * (compWeight1 / weightSum))), opacity);"]);break;case 3:h=h.concat(["float weightSum = compWeight0 + compWeight1 + compWeight2;","gl_FragData[0] = vec4(vec3((tcolor0.rgb * (compWeight0 / weightSum)) + (tcolor1.rgb * (compWeight1 / weightSum)) + (tcolor2.rgb * (compWeight2 / weightSum))), opacity);"]);break;case 4:h=h.concat(["float weightSum = compWeight0 + compWeight1 + compWeight2 + compWeight3;","gl_FragData[0] = vec4(vec3((tcolor0.rgb * (compWeight0 / weightSum)) + (tcolor1.rgb * (compWeight1 / weightSum)) + (tcolor2.rgb * (compWeight2 / weightSum)) + (tcolor3.rgb * (compWeight3 / weightSum))), opacity);"]);break;default:yv("Unsupported number of independent coordinates.")}s=Ie.substitute(s,"//VTK::TCoord::Impl",h).result}else switch(c){case 1:s=Ie.substitute(s,"//VTK::TCoord::Impl",[...C6t(`
                #ifdef vtkImageLabelOutlineOn
                  vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord);
                  float centerValue = texture2D(texture1, getSliceCoords(centerPosIS, sliceAxis)).r;
                  bool pixelOnBorder = false;
                  vec3 tColor = texture2D(colorTexture1, vec2(centerValue * cscale0 + cshift0, 0.5)).rgb;
                  float scalarOpacity = texture2D(pwfTexture1, vec2(centerValue * pwfscale0 + pwfshift0, 0.5)).r;
                  float opacityToUse = scalarOpacity * opacity;
                  int segmentIndex = int(centerValue * 255.0);
                  float textureCoordinate = float(segmentIndex - 1) / 1024.0;
                  float textureValue = texture2D(labelOutlineTexture1, vec2(textureCoordinate, 0.5)).r;
                  int actualThickness = int(textureValue * 255.0);

                  if (segmentIndex == 0){
                    gl_FragData[0] = vec4(0.0, 0.0, 0.0, 0.0);
                    return;
                  }

                  for (int i = -actualThickness; i <= actualThickness; i++) {
                    for (int j = -actualThickness; j <= actualThickness; j++) {
                      if (i == 0 || j == 0) {
                        continue;
                      }
                      vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),
                        gl_FragCoord.y + float(j),
                        gl_FragCoord.z, gl_FragCoord.w);
                      vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);
                      float value = texture2D(texture1, getSliceCoords(neighborPosIS, sliceAxis)).r;
                      if (value != centerValue) {
                        pixelOnBorder = true;
                        break;
                      }
                    }
                    if (pixelOnBorder == true) {
                      break;
                    }
                  }
                  if (pixelOnBorder == true) {
                    gl_FragData[0] = vec4(tColor, outlineOpacity);
                  }
                  else {
                    gl_FragData[0] = vec4(tColor, opacityToUse);
                  }
                #else
                  float intensity = texture2D(texture1, tcoordVCVSOutput).r;
                  vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;
                  float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;
                  gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);
                #endif
                `)]).result;break;case 2:s=Ie.substitute(s,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:s=Ie.substitute(s,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:s=Ie.substitute(s,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}e.haveSeenDepthRequest&&(s=Ie.substitute(s,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,s=Ie.substitute(s,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),r.Vertex=o,r.Fragment=s,t.replaceShaderClip(r,i,a),t.replaceShaderCoincidentOffset(r,i,a)},t.replaceShaderClip=(r,i,a)=>{let o=r.Vertex,s=r.Fragment;if(e.renderable.getNumberOfClippingPlanes()){let c=e.renderable.getNumberOfClippingPlanes();c>6&&(Yn("OpenGL has a limit of 6 clipping planes"),c=6),o=Ie.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ie.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)","    {","    if (planeNum >= numClipPlanes)","        {","        break;","        }","    clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);","    }"]).result,s=Ie.substitute(s,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,s=Ie.substitute(s,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)","    {","    if (planeNum >= numClipPlanes)","        {","        break;","        }","    if (clipDistancesVSOutput[planeNum] < 0.0) discard;","    }"]).result}r.Vertex=o,r.Fragment=s},t.getNeedToRebuildShaders=(r,i,a)=>{const o=e.openGLTexture.getComponents(),s=a.getProperty().getIndependentComponents();let c=!1;return(!e.currentRenderPass&&e.lastRenderPassShaderReplacement||e.currentRenderPass&&e.currentRenderPass.getShaderReplacement()!==e.lastRenderPassShaderReplacement)&&(c=!0),c||e.lastHaveSeenDepthRequest!==e.haveSeenDepthRequest||r.getProgram()?.getHandle()===0||e.lastTextureComponents!==o||e.lastIndependentComponents!==s?(e.lastHaveSeenDepthRequest=e.haveSeenDepthRequest,e.lastTextureComponents=o,e.lastIndependentComponents=s,!0):!1},t.updateShaders=(r,i,a)=>{if(e.lastBoundBO=r,t.getNeedToRebuildShaders(r,i,a)){const o={Vertex:null,Fragment:null,Geometry:null};t.buildShaders(o,i,a);const s=e._openGLRenderWindow.getShaderCache().readyShaderProgramArray(o.Vertex,o.Fragment,o.Geometry);s!==r.getProgram()&&(r.setProgram(s),r.getVAO().releaseGraphicsResources()),r.getShaderSourceTime().modified()}else e._openGLRenderWindow.getShaderCache().readyShaderProgram(r.getProgram());r.getVAO().bind(),t.setMapperShaderParameters(r,i,a),t.setCameraShaderParameters(r,i,a),t.setPropertyShaderParameters(r,i,a)},t.setMapperShaderParameters=(r,i,a)=>{r.getCABO().getElementCount()&&(e.VBOBuildTime>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())&&(r.getProgram().isAttributeUsed("vertexMC")&&(r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"vertexMC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),e.context.FLOAT,3,e.context.FALSE)||yv("Error setting vertexMC in shader VAO.")),r.getProgram().isAttributeUsed("tcoordMC")&&r.getCABO().getTCoordOffset()&&(r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"tcoordMC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),e.context.FLOAT,r.getCABO().getTCoordComponents(),e.context.FALSE)||yv("Error setting tcoordMC in shader VAO.")),r.getAttributeUpdateTime().modified());const o=e.openGLTexture.getTextureUnit();r.getProgram().setUniformi("texture1",o);const s=e.openGLTexture.getComponents(),c=a.getProperty().getIndependentComponents();if(c)for(let m=0;m<s;m++)r.getProgram().setUniformf(`mix${m}`,a.getProperty().getComponentWeight(m));const l=e.openGLTexture.getShiftAndScale();for(let m=0;m<s;m++){let p=a.getProperty().getColorWindow(),y=a.getProperty().getColorLevel();const x=c?m:0,S=a.getProperty().getRGBTransferFunction(x);if(S&&a.getProperty().getUseLookupTableScalarRange()){const T=S.getRange();p=T[1]-T[0],y=.5*(T[1]+T[0])}const C=l.scale/p,_=(l.shift-y)/p+.5;r.getProgram().setUniformf(`cshift${m}`,_),r.getProgram().setUniformf(`cscale${m}`,C)}for(let m=0;m<s;m++){let p=1,y=0;const x=c?m:0,S=a.getProperty().getPiecewiseFunction(x);if(S){const C=S.getRange(),_=C[1]-C[0],T=.5*(C[0]+C[1]);p=l.scale/_,y=(l.shift-T)/_+.5}r.getProgram().setUniformf(`pwfshift${m}`,y),r.getProgram().setUniformf(`pwfscale${m}`,p)}if(e.haveSeenDepthRequest&&r.getProgram().setUniformi("depthRequest",e.renderDepth?1:0),r.getProgram().isUniformUsed("coffset")){const m=t.getCoincidentParameters(i,a);r.getProgram().setUniformf("coffset",m.offset),r.getProgram().isUniformUsed("cfactor")&&r.getProgram().setUniformf("cfactor",m.factor)}const u=e.colorTexture.getTextureUnit();r.getProgram().setUniformi("colorTexture1",u);const f=e.pwfTexture.getTextureUnit();r.getProgram().setUniformi("pwfTexture1",f);const d=e.labelOutlineThicknessTexture.getTextureUnit();if(r.getProgram().setUniformi("labelOutlineTexture1",d),e.renderable.getNumberOfClippingPlanes()){let m=e.renderable.getNumberOfClippingPlanes();m>6&&(Yn("OpenGL has a limit of 6 clipping planes"),m=6);const y=r.getCABO().getCoordShiftAndScaleEnabled()?r.getCABO().getInverseShiftAndScaleMatrix():null,x=y?pa(e.imagematinv,a.getMatrix()):a.getMatrix();y&&(cr(x,x),Xn(x,x,y),cr(x,x)),cr(e.imagemat,e.currentInput.getIndexToWorld()),Xn(e.imagematinv,x,e.imagemat);const S=[];for(let C=0;C<m;C++){const _=[];e.renderable.getClippingPlaneInDataCoords(e.imagematinv,C,_);for(let T=0;T<4;T++)S.push(_[T])}r.getProgram().setUniformi("numClipPlanes",m),r.getProgram().setUniform4fv("clipPlanes",S)}if(a.getProperty().getUseLabelOutline()===!0){const m=a.getProperty().getLabelOutlineOpacity();r.getProgram().setUniformf("outlineOpacity",m)}},t.setCameraShaderParameters=(r,i,a)=>{const o=r.getProgram(),s=e.openGLImageSlice.getKeyMatrices(),c=e.currentInput,l=c.getIndexToWorld();Xn(e.imagemat,s.mcwc,l);const u=e.openGLCamera.getKeyMatrices(i);if(Xn(e.imagemat,u.wcpc,e.imagemat),r.getCABO().getCoordShiftAndScaleEnabled()){const d=r.getCABO().getInverseShiftAndScaleMatrix();Xn(e.imagemat,e.imagemat,d)}if(o.setUniformMatrix("MCPCMatrix",e.imagemat),a.getProperty().getUseLabelOutline()===!0){const d=c.getWorldToIndex(),h=c.getDimensions();let m=e.renderable.getClosestIJKAxis().ijkMode;m===rl.NONE&&(m=rl.K),o.setUniform3i("imageDimensions",h[0],h[1],h[2]),o.setUniformi("sliceAxis",m),o.setUniformMatrix("vWCtoIDX",d);const p=e.openGLCamera.getKeyMatrices(i);Na(e.projectionToWorld,p.wcpc),e.openGLCamera.getKeyMatrices(i),o.setUniformMatrix("PCWCMatrix",e.projectionToWorld);const y=t.getRenderTargetSize();o.setUniformf("vpWidth",y[0]),o.setUniformf("vpHeight",y[1]);const x=t.getRenderTargetOffset();o.setUniformf("vpOffsetX",x[0]/y[0]),o.setUniformf("vpOffsetY",x[1]/y[1])}},t.setPropertyShaderParameters=(r,i,a)=>{const o=r.getProgram(),c=a.getProperty().getOpacity();o.setUniformf("opacity",c)},t.renderPieceStart=(r,i)=>{t.updateBufferObjects(r,i),e.lastBoundBO=null},t.renderPieceDraw=(r,i)=>{const a=e.context;e.openGLTexture.activate(),e.colorTexture.activate(),e.labelOutlineThicknessTexture.activate(),e.pwfTexture.activate(),e.tris.getCABO().getElementCount()&&(t.updateShaders(e.tris,r,i),a.drawArrays(a.TRIANGLES,0,e.tris.getCABO().getElementCount()),e.tris.getVAO().release()),e.openGLTexture.deactivate(),e.colorTexture.deactivate(),e.labelOutlineThicknessTexture.deactivate(),e.pwfTexture.deactivate()},t.renderPieceFinish=(r,i)=>{},t.renderPiece=(r,i)=>{if(t.invokeEvent({type:"StartEvent"}),e.renderable.update(),e.currentInput=e.renderable.getCurrentImage(),t.invokeEvent({type:"EndEvent"}),!e.currentInput){yv("No input!");return}t.renderPieceStart(r,i),t.renderPieceDraw(r,i),t.renderPieceFinish(r,i)},t.computeBounds=(r,i)=>{if(!t.getInput()){P2(e.bounds);return}e.bounds=t.getInput().getBounds()},t.updateBufferObjects=(r,i)=>{t.getNeedToRebuildBufferObjects(r,i)&&t.buildBufferObjects(r,i)},t.getNeedToRebuildBufferObjects=(r,i)=>e.VBOBuildTime.getMTime()<t.getMTime()||e.VBOBuildTime.getMTime()<i.getMTime()||e.VBOBuildTime.getMTime()<e.renderable.getMTime()||e.VBOBuildTime.getMTime()<i.getProperty().getMTime()||e.VBOBuildTime.getMTime()<e.currentInput.getMTime()||!e.openGLTexture?.getHandle()||!e.colorTexture?.getHandle()||!e.labelOutlineThicknessTexture?.getHandle()||!e.pwfTexture?.getHandle(),t.buildBufferObjects=(r,i)=>{const a=e.currentInput;if(!a)return;const o=a.getPointData()&&a.getPointData().getScalars();if(!o)return;const s=o.getDataType(),c=o.getNumberOfComponents(),l=i.getProperty(),u=l.getInterpolationType(),f=l.getIndependentComponents(),d=f?c:1,h=f?2*d:1,m=l.getRGBTransferFunction(),p=Od(m,f,d),y=e._openGLRenderWindow.getGraphicsResourceForObject(m);if(!y?.oglObject?.getHandle()||y?.hash!==p){e.colorTexture=mi.newInstance({resizable:!0}),e.colorTexture.setOpenGLRenderWindow(e._openGLRenderWindow);const $=1024,W=$*h*3,G=new Uint8ClampedArray(W);if(u===Lm.NEAREST?(e.colorTexture.setMinificationFilter(Kt.NEAREST),e.colorTexture.setMagnificationFilter(Kt.NEAREST)):(e.colorTexture.setMinificationFilter(Kt.LINEAR),e.colorTexture.setMagnificationFilter(Kt.LINEAR)),m){const oe=new Float32Array($*3);for(let U=0;U<d;U++){const Y=l.getRGBTransferFunction(U),J=Y.getRange();if(Y.getTable(J[0],J[1],$,oe,1),f)for(let ne=0;ne<$*3;ne++)G[U*$*6+ne]=255*oe[ne],G[U*$*6+ne+$*3]=255*oe[ne];else for(let ne=0;ne<$*3;ne++)G[U*$*6+ne]=255*oe[ne]}e.colorTexture.resetFormatAndType(),e.colorTexture.create2DFromRaw($,h,3,zn.UNSIGNED_CHAR,G)}else{for(let oe=0;oe<$*3;++oe)G[oe]=255*oe/(($-1)*3),G[oe+1]=255*oe/(($-1)*3),G[oe+2]=255*oe/(($-1)*3);e.colorTexture.create2DFromRaw($,1,3,zn.UNSIGNED_CHAR,G)}m&&(e._openGLRenderWindow.setGraphicsResourceForObject(m,e.colorTexture,p),m!==e._colorTransferFunc&&(e._openGLRenderWindow.registerGraphicsResourceUser(m,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._colorTransferFunc,t)),e._colorTransferFunc=m)}else e.colorTexture=y.oglObject;const S=l.getPiecewiseFunction(),C=Od(S,f,d),_=e._openGLRenderWindow.getGraphicsResourceForObject(S);if(!_?.oglObject?.getHandle()||_?.hash!==C){const W=1024*h,G=new Uint8ClampedArray(W);if(e.pwfTexture=mi.newInstance({resizable:!0}),e.pwfTexture.setOpenGLRenderWindow(e._openGLRenderWindow),u===Lm.NEAREST?(e.pwfTexture.setMinificationFilter(Kt.NEAREST),e.pwfTexture.setMagnificationFilter(Kt.NEAREST)):(e.pwfTexture.setMinificationFilter(Kt.LINEAR),e.pwfTexture.setMagnificationFilter(Kt.LINEAR)),S){const oe=new Float32Array(W),U=new Float32Array(1024);for(let Y=0;Y<d;++Y){const J=l.getPiecewiseFunction(Y);if(J===null)oe.fill(1);else{const ne=J.getRange();if(J.getTable(ne[0],ne[1],1024,U,1),f)for(let F=0;F<1024;F++)oe[Y*1024*2+F]=U[F],oe[Y*1024*2+F+1024]=U[F];else for(let F=0;F<1024;F++)oe[Y*1024*2+F]=U[F]}}e.pwfTexture.resetFormatAndType(),e.pwfTexture.create2DFromRaw(1024,h,1,zn.FLOAT,oe)}else G.fill(255),e.pwfTexture.create2DFromRaw(1024,1,1,zn.UNSIGNED_CHAR,G);S&&(e._openGLRenderWindow.setGraphicsResourceForObject(S,e.pwfTexture,C),S!==e._pwFunc&&(e._openGLRenderWindow.registerGraphicsResourceUser(S,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._pwFunc,t)),e._pwFunc=S)}else e.pwfTexture=_.oglObject;t.updatelabelOutlineThicknessTexture(i);const{ijkMode:O}=e.renderable.getClosestIJKAxis();let M=e.renderable.getSlice();O!==e.renderable.getSlicingMode()&&(M=e.renderable.getSliceAtPosition(M));const I=e.renderable.isA("vtkImageArrayMapper")?e.renderable.getSubSlice():Math.round(M),V=a.getExtent();let k;O===rl.I&&(k=I-V[0]),O===rl.J&&(k=I-V[2]),(O===rl.K||O===rl.NONE)&&(k=I-V[4]);const L=`${M}A${a.getMTime()}A${o.getMTime()}B${t.getMTime()}C${e.renderable.getSlicingMode()}D${i.getProperty().getInterpolationType()}`;if(e.VBOBuildString!==L){const $=a.getDimensions();e.openGLTexture||(e.openGLTexture=mi.newInstance({resizable:!0})),e.openGLTexture.setOpenGLRenderWindow(e._openGLRenderWindow),e.openGLTexture.setOglNorm16Ext(e.context.getExtension("EXT_texture_norm16")),u===Lm.NEAREST?(new Set([1,3,4]).has(c)&&s===zn.UNSIGNED_CHAR&&!f&&e.openGLTexture.setGenerateMipmap(!0),e.openGLTexture.setMinificationFilter(Kt.NEAREST),e.openGLTexture.setMagnificationFilter(Kt.NEAREST)):(c===4&&s===zn.UNSIGNED_CHAR&&!f?(e.openGLTexture.setGenerateMipmap(!0),e.openGLTexture.setMinificationFilter(Kt.LINEAR_MIPMAP_LINEAR)):e.openGLTexture.setMinificationFilter(Kt.LINEAR),e.openGLTexture.setMagnificationFilter(Kt.LINEAR)),e.openGLTexture.setWrapS(Yw.CLAMP_TO_EDGE),e.openGLTexture.setWrapT(Yw.CLAMP_TO_EDGE);const W=$[0]*$[1]*c,G=new Float32Array(12),oe=new Float32Array(8);for(let we=0;we<4;we++)oe[we*2]=we%2?1:0,oe[we*2+1]=we>1?1:0;const U=[rl.X,rl.Y,rl.Z].includes(e.renderable.getSlicingMode())?M:I,Y=a.getSpatialExtent(),J=o.getData();let ne=null;if(O===rl.I){ne=new J.constructor($[2]*$[1]*c);let we=0;for(let Oe=0;Oe<$[2];Oe++)for(let Te=0;Te<$[1];Te++){let Me=(k+Te*$[0]+Oe*$[0]*$[1])*c;we=(Oe*$[1]+Te)*c;const be=Me+c;for(;Me<be;)ne[we++]=J[Me++]}$[0]=$[1],$[1]=$[2],G[0]=U,G[1]=Y[2],G[2]=Y[4],G[3]=U,G[4]=Y[3],G[5]=Y[4],G[6]=U,G[7]=Y[2],G[8]=Y[5],G[9]=U,G[10]=Y[3],G[11]=Y[5]}else if(O===rl.J){ne=new J.constructor($[2]*$[0]*c);let we=0;for(let Oe=0;Oe<$[2];Oe++)for(let Te=0;Te<$[0];Te++){let Me=(Te+k*$[0]+Oe*$[0]*$[1])*c;we=(Oe*$[0]+Te)*c;const be=Me+c;for(;Me<be;)ne[we++]=J[Me++]}$[1]=$[2],G[0]=Y[0],G[1]=U,G[2]=Y[4],G[3]=Y[1],G[4]=U,G[5]=Y[4],G[6]=Y[0],G[7]=U,G[8]=Y[5],G[9]=Y[1],G[10]=U,G[11]=Y[5]}else O===rl.K||O===rl.NONE?(ne=J.subarray(k*W,(k+1)*W),G[0]=Y[0],G[1]=Y[2],G[2]=U,G[3]=Y[1],G[4]=Y[2],G[5]=U,G[6]=Y[0],G[7]=Y[3],G[8]=U,G[9]=Y[1],G[10]=Y[3],G[11]=U):yv("Reformat slicing not yet supported.");const F=o.getRanges();e.openGLTexture.resetFormatAndType(),e.openGLTexture.create2DFilterableFromRaw($[0],$[1],c,o.getDataType(),ne,e.renderable.getPreferSizeOverAccuracy?.(),F),e.openGLTexture.activate(),e.openGLTexture.sendParameters(),e.openGLTexture.deactivate();const ae=On.newInstance({numberOfComponents:3,values:G});ae.setName("points");const re=On.newInstance({numberOfComponents:2,values:oe});re.setName("tcoords");const te=new Uint16Array(8);te[0]=3,te[1]=0,te[2]=1,te[3]=3,te[4]=3,te[5]=0,te[6]=3,te[7]=2;const ye=On.newInstance({numberOfComponents:1,values:te});e.tris.getCABO().createVBO(ye,"polys",_l.SURFACE,{points:ae,tcoords:re,cellOffset:0}),e.VBOBuildTime.modified(),e.VBOBuildString=L}},t.updatelabelOutlineThicknessTexture=r=>{const i=r.getProperty().getLabelOutlineThicknessByReference(),a=e._openGLRenderWindow.getGraphicsResourceForObject(i),o=`${i.join("-")}`;if(!a?.oglObject?.getHandle()||a?.hash!==o){const f=new Uint8Array(1024);for(let d=0;d<1024;++d){const h=typeof i[d]<"u"?i[d]:i[0];f[d]=h}e.labelOutlineThicknessTexture=mi.newInstance({resizable:!1}),e.labelOutlineThicknessTexture.setOpenGLRenderWindow(e._openGLRenderWindow),e.labelOutlineThicknessTexture.resetFormatAndType(),e.labelOutlineThicknessTexture.setMinificationFilter(Kt.NEAREST),e.labelOutlineThicknessTexture.setMagnificationFilter(Kt.NEAREST),e.labelOutlineThicknessTexture.create2DFromRaw(1024,1,1,zn.UNSIGNED_CHAR,f),i&&(e._openGLRenderWindow.setGraphicsResourceForObject(i,e.labelOutlineThicknessTexture,o),i!==e._labelOutlineThicknessArray&&(e._openGLRenderWindow.registerGraphicsResourceUser(i,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._labelOutlineThicknessArray,t)),e._labelOutlineThicknessArray=i)}else e.labelOutlineThicknessTexture=a.oglObject},t.getRenderTargetSize=()=>{if(e._useSmallViewport)return[e._smallViewportWidth,e._smallViewportHeight];const{usize:r,vsize:i}=e._openGLRenderer.getTiledSizeAndOrigin();return[r,i]},t.getRenderTargetOffset=()=>{const{lowerLeftU:r,lowerLeftV:i}=e._openGLRenderer.getTiledSizeAndOrigin();return[r,i]},t.delete=u3(()=>{e._openGLRenderWindow&&n(e._openGLRenderWindow)},t.delete)}const T6t={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0};function E6t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,T6t,n),La.extend(t,e,n),sp.implementReplaceShaderCoincidentOffset(t,e,n),sp.implementBuildShadersWithReplacements(t,e,n),e.tris=Ph.newInstance(),e.imagemat=sn(new Float64Array(16)),e.imagematinv=sn(new Float64Array(16)),e.projectionToWorld=sn(new Float64Array(16)),e.idxToView=sn(new Float64Array(16)),e.idxNormalMatrix=vf(new Float64Array(9)),e.modelToView=sn(new Float64Array(16)),e.projectionToView=sn(new Float64Array(16)),Ja(t,e,[]),e.VBOBuildTime={},yi(e.VBOBuildTime),_6t(t,e)}const hwe=ri(E6t,"vtkOpenGLImageMapper");var O6t={newInstance:hwe};jo("vtkAbstractImageMapper",hwe);const Gp={MAX:0,MIN:1,AVERAGE:2},{vtkErrorMacro:TS}=se;function D6t(t,e){e.classHierarchy.push("vtkOpenGLImageCPRMapper");function n(r){[e._scalars,e._colorTransferFunc,e._pwFunc].forEach(i=>r.unregisterGraphicsResourceUser(i,t))}t.buildPass=r=>{if(r){e.currentRenderPass=null,e.openGLImageSlice=t.getFirstAncestorOfType("vtkOpenGLImageSlice"),e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer");const i=e._openGLRenderWindow;e._openGLRenderWindow=e._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow"),i&&!i.isDeleted()&&i!==e._openGLRenderWindow&&n(i),e.context=e._openGLRenderWindow.getContext(),e.openGLCamera=e._openGLRenderer.getViewNodeFor(e._openGLRenderer.getRenderable().getActiveCamera()),e.tris.setOpenGLRenderWindow(e._openGLRenderWindow)}},t.opaquePass=(r,i)=>{r&&(e.currentRenderPass=i,t.render())},t.opaqueZBufferPass=r=>{r&&(e.haveSeenDepthRequest=!0,e.renderDepth=!0,t.render(),e.renderDepth=!1)},t.getCoincidentParameters=(r,i)=>e.renderable.getResolveCoincidentTopology()===Of.PolygonOffset?e.renderable.getCoincidentTopologyPolygonOffsetParameters():null,t.render=()=>{const r=e.openGLImageSlice.getRenderable(),i=e._openGLRenderer.getRenderable();t.renderPiece(i,r)},t.renderPiece=(r,i)=>{t.invokeEvent({type:"StartEvent"}),e.renderable.update(),t.invokeEvent({type:"EndEvent"}),e.renderable.preRenderCheck()&&(e.currentImageDataInput=e.renderable.getInputData(0),e.currentCenterlineInput=e.renderable.getOrientedCenterline(),t.renderPieceStart(r,i),t.renderPieceDraw(r,i),t.renderPieceFinish(r,i))},t.renderPieceStart=(r,i)=>{t.updateBufferObjects(r,i)},t.renderPieceDraw=(r,i)=>{const a=e.context;e.volumeTexture.activate(),e.colorTexture.activate(),e.pwfTexture.activate(),e.tris.getCABO().getElementCount()&&(t.updateShaders(e.tris,r,i),a.drawArrays(a.TRIANGLES,0,e.tris.getCABO().getElementCount()),e.tris.getVAO().release()),e.volumeTexture.deactivate(),e.colorTexture.deactivate(),e.pwfTexture.deactivate()},t.renderPieceFinish=(r,i)=>{},t.updateBufferObjects=(r,i)=>{t.getNeedToRebuildBufferObjects(r,i)&&t.buildBufferObjects(r,i),i.getProperty().getInterpolationType()===Lm.NEAREST?(e.volumeTexture.setMinificationFilter(Kt.NEAREST),e.volumeTexture.setMagnificationFilter(Kt.NEAREST),e.colorTexture.setMinificationFilter(Kt.NEAREST),e.colorTexture.setMagnificationFilter(Kt.NEAREST),e.pwfTexture.setMinificationFilter(Kt.NEAREST),e.pwfTexture.setMagnificationFilter(Kt.NEAREST)):(e.volumeTexture.setMinificationFilter(Kt.LINEAR),e.volumeTexture.setMagnificationFilter(Kt.LINEAR),e.colorTexture.setMinificationFilter(Kt.LINEAR),e.colorTexture.setMagnificationFilter(Kt.LINEAR),e.pwfTexture.setMinificationFilter(Kt.LINEAR),e.pwfTexture.setMagnificationFilter(Kt.LINEAR))},t.getNeedToRebuildBufferObjects=(r,i)=>{const a=e.VBOBuildTime.getMTime();return a<t.getMTime()||a<e.renderable.getMTime()||a<i.getMTime()||a<e.currentImageDataInput.getMTime()||a<e.currentCenterlineInput.getMTime()||!e.volumeTexture?.getHandle()},t.buildBufferObjects=(r,i)=>{const a=e.currentImageDataInput,o=e.currentCenterlineInput,s=a?.getPointData()?.getScalars();if(!s)return;const c=e._openGLRenderWindow.getGraphicsResourceForObject(s),l=yF(a,s),u=!c?.oglObject?.getHandle()||c?.hash!==l,f=e.renderable.getUpdatedExtents(),d=!!f.length;if(u){e.volumeTexture=mi.newInstance(),e.volumeTexture.setOpenGLRenderWindow(e._openGLRenderWindow);const k=a.getDimensions();e.volumeTexture.setOglNorm16Ext(e.context.getExtension("EXT_texture_norm16")),e.volumeTexture.resetFormatAndType(),e.volumeTexture.create3DFilterableFromDataArray(k[0],k[1],k[2],s,e.renderable.getPreferSizeOverAccuracy()),e._openGLRenderWindow.setGraphicsResourceForObject(s,e.volumeTexture,l),s!==e._scalars&&(e._openGLRenderWindow.registerGraphicsResourceUser(s,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._scalars,t)),e._scalars=s}else e.volumeTexture=c.oglObject;if(d){e.renderable.setUpdatedExtents([]);const k=a.getDimensions();e.volumeTexture.create3DFilterableFromDataArray(k[0],k[1],k[2],s,!1,f)}const h=s.getNumberOfComponents(),m=i.getProperty(),p=m.getIndependentComponents(),y=p?h:1,x=p?2*y:1,S=m.getRGBTransferFunction(),C=Od(S,p,y),_=e._openGLRenderWindow.getGraphicsResourceForObject(S);if(!_?.oglObject?.getHandle()||_?.hash!==C){const L=1024*x*3,$=new Uint8ClampedArray(L);if(e.colorTexture=mi.newInstance(),e.colorTexture.setOpenGLRenderWindow(e._openGLRenderWindow),S){const W=new Float32Array(3072);for(let G=0;G<y;G++){const oe=m.getRGBTransferFunction(G),U=oe.getRange();if(oe.getTable(U[0],U[1],1024,W,1),p)for(let Y=0;Y<1024*3;Y++)$[G*1024*6+Y]=255*W[Y],$[G*1024*6+Y+1024*3]=255*W[Y];else for(let Y=0;Y<1024*3;Y++)$[G*1024*6+Y]=255*W[Y]}e.colorTexture.resetFormatAndType(),e.colorTexture.create2DFromRaw(1024,x,3,zn.UNSIGNED_CHAR,$)}else{for(let W=0;W<1024*3;++W)$[W]=255*W/(1023*3),$[W+1]=255*W/(1023*3),$[W+2]=255*W/(1023*3);e.colorTexture.resetFormatAndType(),e.colorTexture.create2DFromRaw(1024,1,3,zn.UNSIGNED_CHAR,$)}S&&(e._openGLRenderWindow.setGraphicsResourceForObject(S,e.colorTexture,C),S!==e._colorTransferFunc&&(e._openGLRenderWindow.registerGraphicsResourceUser(S,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._colorTransferFunc,t)),e._colorTransferFunc=S)}else e.colorTexture=_.oglObject;const O=m.getPiecewiseFunction(),M=Od(O,p,y),I=e._openGLRenderWindow.getGraphicsResourceForObject(O);if(!I?.oglObject?.getHandle()||I?.hash!==M){const L=1024*x,$=new Uint8ClampedArray(L);if(e.pwfTexture=mi.newInstance(),e.pwfTexture.setOpenGLRenderWindow(e._openGLRenderWindow),O){const W=new Float32Array(L),G=new Float32Array(1024);for(let oe=0;oe<y;++oe){const U=m.getPiecewiseFunction(oe);if(U===null)W.fill(1);else{const Y=U.getRange();if(U.getTable(Y[0],Y[1],1024,G,1),p)for(let J=0;J<1024;J++)W[oe*1024*2+J]=G[J],W[oe*1024*2+J+1024]=G[J];else for(let J=0;J<1024;J++)W[oe*1024*2+J]=G[J]}}e.pwfTexture.resetFormatAndType(),e.pwfTexture.create2DFromRaw(1024,x,1,zn.FLOAT,W)}else $.fill(255),e.pwfTexture.resetFormatAndType(),e.pwfTexture.create2DFromRaw(1024,1,1,zn.UNSIGNED_CHAR,$);O&&(e._openGLRenderWindow.setGraphicsResourceForObject(O,e.pwfTexture,M),O!==e._pwFunc&&(e._openGLRenderWindow.registerGraphicsResourceUser(O,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._pwFunc,t)),e._pwFunc=O)}else e.pwfTexture=I.oglObject;if(e.VBOBuildTime.getMTime()<e.renderable.getMTime()||e.VBOBuildTime.getMTime()<o.getMTime()){const k=o.getNumberOfPoints(),L=k<=1?0:k-1,$=o.getDistancesToFirstPoint(),W=e.renderable.getHeight(),G=4*L,oe=new Float32Array(3*G),U=e.renderable.getWidth();for(let Me=0,be=0;Me<L;++Me)oe.set([0,W-$[Me],0],be),be+=3,oe.set([U,W-$[Me],0],be),be+=3,oe.set([U,W-$[Me+1],0],be),be+=3,oe.set([0,W-$[Me+1],0],be),be+=3;const Y=On.newInstance({numberOfComponents:3,values:oe});Y.setName("points");const J=new Uint16Array(5*L);for(let Me=0,be=0,Ye=0;Me<L;++Me)J.set([4,Ye+3,Ye+2,Ye+1,Ye],be),be+=5,Ye+=4;const ne=On.newInstance({numberOfComponents:1,values:J}),F=o.getPoints(),ae=new Float32Array(3*G),re=new Array(3),te=new Array(3);for(let Me=0,be=0;Me<L;++Me)F.getPoint(Me,re),F.getPoint(Me+1,te),ae.set(re,be),be+=3,ae.set(re,be),be+=3,ae.set(te,be),be+=3,ae.set(te,be),be+=3;const ye=On.newInstance({numberOfComponents:3,values:ae,name:"centerlinePosition"}),we=new Float32Array(G);for(let Me=0,be=0;Me<L;++Me)we.set([0,1,3,2],be),be+=4;const Oe=On.newInstance({numberOfComponents:1,values:we,name:"quadIndex"}),Te=[ye,Oe];if(!e.renderable.getUseUniformOrientation()){const Me=e.renderable.getOrientedCenterline().getOrientations()??[],be=new Float32Array(4*G),Ye=new Float32Array(4*G);for(let It=0;It<L;++It){const Rt=Me[It],cn=Me[It+1];for(let ln=0;ln<4;++ln){const tr=4*(ln+4*It);be.set(Rt,tr),Ye.set(cn,tr)}}const ft=On.newInstance({numberOfComponents:4,values:be,name:"centerlineTopOrientation"}),je=On.newInstance({numberOfComponents:4,values:Ye,name:"centerlineBotOrientation"});Te.push(ft,je)}e.tris.getCABO().createVBO(ne,"polys",_l.SURFACE,{points:Y,customAttributes:Te}),e.VBOBuildTime.modified()}},t.getNeedToRebuildShaders=(r,i,a)=>{const o=e.volumeTexture.getComponents(),s=a.getProperty().getIndependentComponents(),c=!!e.renderable.getCenterPoint(),l=e.renderable.getUseUniformOrientation(),u=e.renderable.isProjectionEnabled()&&e.renderable.getProjectionMode();return r.getProgram()===0||e.lastUseCenterPoint!==c||e.lastUseUniformOrientation!==l||e.lastProjectionMode!==u||e.lastHaveSeenDepthRequest!==e.haveSeenDepthRequest||e.lastTextureComponents!==o||e.lastIndependentComponents!==s?(e.lastUseCenterPoint=c,e.lastUseUniformOrientation=l,e.lastProjectionMode=u,e.lastHaveSeenDepthRequest=e.haveSeenDepthRequest,e.lastTextureComponents=o,e.lastIndependentComponents=s,!0):!1},t.buildShaders=(r,i,a)=>{t.getShaderTemplate(r,i,a),t.replaceShaderValues(r,i,a)},t.replaceShaderValues=(r,i,a)=>{let o=r.Vertex,s=r.Fragment;const c=["vec3 applyQuaternionToVec(vec4 q, vec3 v) {","  float uvx = q.y * v.z - q.z * v.y;","  float uvy = q.z * v.x - q.x * v.z;","  float uvz = q.x * v.y - q.y * v.x;","  float uuvx = q.y * uvz - q.z * uvy;","  float uuvy = q.z * uvx - q.x * uvz;","  float uuvz = q.x * uvy - q.y * uvx;","  float w2 = q.w * 2.0;","  uvx *= w2;","  uvy *= w2;","  uvz *= w2;","  uuvx *= 2.0;","  uuvy *= 2.0;","  uuvz *= 2.0;","  return vec3(v.x + uvx + uuvx, v.y + uvy + uuvy, v.z + uvz + uuvz);","}"];o=Ie.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,o=Ie.substitute(o,"//VTK::PositionVC::Impl",["  gl_Position = MCPCMatrix * vertexMC;"]).result;const l=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],u=e.renderable.isProjectionEnabled(),f=e.renderable.getUseUniformOrientation();f?(l.push("out vec3 samplingDirVSOutput;","uniform vec4 centerlineOrientation;","uniform vec3 tangentDirection;",...c),u&&l.push("out vec3 projectionDirVSOutput;","uniform vec3 bitangentDirection;")):l.push("out vec4 centerlineTopOrientationVSOutput;","out vec4 centerlineBotOrientationVSOutput;","attribute vec4 centerlineTopOrientation;","attribute vec4 centerlineBotOrientation;"),o=Ie.substitute(o,"//VTK::Color::Dec",l).result;const d=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];f?(d.push("samplingDirVSOutput = applyQuaternionToVec(centerlineOrientation, tangentDirection);"),u&&d.push("projectionDirVSOutput = applyQuaternionToVec(centerlineOrientation, bitangentDirection);")):d.push("centerlineTopOrientationVSOutput = centerlineTopOrientation;","centerlineBotOrientationVSOutput = centerlineBotOrientation;"),o=Ie.substitute(o,"//VTK::Color::Impl",d).result;const h=e.volumeTexture.getComponents(),m=a.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];u&&p.push("uniform vec3 volumeSizeMC;","uniform int projectionSlabNumberOfSamples;","uniform float projectionConstantOffset;","uniform float projectionStepLength;"),f?(p.push("in vec3 samplingDirVSOutput;"),u&&p.push("in vec3 projectionDirVSOutput;")):(p.push("uniform vec3 tangentDirection;","in vec4 centerlineTopOrientationVSOutput;","in vec4 centerlineBotOrientationVSOutput;",...c),u&&p.push("uniform vec3 bitangentDirection;"));const y=e.renderable.getCenterPoint();if(y&&p.push("uniform vec3 globalCenterPoint;"),m){for(let S=1;S<h;S++)p=p.concat([`uniform float cshift${S};`,`uniform float cscale${S};`,`uniform float pwfshift${S};`,`uniform float pwfscale${S};`]);switch(h){case 1:p=p.concat(["uniform float mix0;","#define height0 0.5"]);break;case 2:p=p.concat(["uniform float mix0;","uniform float mix1;","#define height0 0.25","#define height1 0.75"]);break;case 3:p=p.concat(["uniform float mix0;","uniform float mix1;","uniform float mix2;","#define height0 0.17","#define height1 0.5","#define height2 0.83"]);break;case 4:p=p.concat(["uniform float mix0;","uniform float mix1;","uniform float mix2;","uniform float mix3;","#define height0 0.125","#define height1 0.375","#define height2 0.625","#define height3 0.875"]);break;default:TS("Unsupported number of independent coordinates.")}}s=Ie.substitute(s,"//VTK::TCoord::Dec",p).result;let x=[];if(f?(x.push("vec3 samplingDirection = samplingDirVSOutput;"),u&&x.push("vec3 projectionDirection = projectionDirVSOutput;")):(x.push("vec4 q0 = centerlineBotOrientationVSOutput;","vec4 q1 = centerlineTopOrientationVSOutput;","float qCosAngle = dot(q0, q1);","vec4 interpolatedOrientation;","if (qCosAngle > 0.999 || qCosAngle < -0.999) {","  // Use LERP instead of SLERP when the two quaternions are close or opposite","  interpolatedOrientation = normalize(mix(q0, q1, quadOffsetVSOutput.y));","} else {","  float omega = acos(qCosAngle);","  interpolatedOrientation = normalize(sin((1.0 - quadOffsetVSOutput.y) * omega) * q0 + sin(quadOffsetVSOutput.y * omega) * q1);","}","vec3 samplingDirection = applyQuaternionToVec(interpolatedOrientation, tangentDirection);"),u&&x.push("vec3 projectionDirection = applyQuaternionToVec(interpolatedOrientation, bitangentDirection);")),y?x.push("float baseOffset = dot(samplingDirection, globalCenterPoint - centerlinePosVSOutput);","float horizontalOffset = quadOffsetVSOutput.x + baseOffset;"):x.push("float horizontalOffset = quadOffsetVSOutput.x;"),x.push("vec3 volumePosMC = centerlinePosVSOutput + horizontalOffset * samplingDirection;","vec3 volumePosTC = (MCTCMatrix * vec4(volumePosMC, 1.0)).xyz;","if (any(lessThan(volumePosTC, vec3(0.0))) || any(greaterThan(volumePosTC, vec3(1.0))))","{","  // set the background color and exit","  gl_FragData[0] = backgroundColor;","  return;","}"),u){const S=e.renderable.getProjectionMode();switch(S){case Gp.MIN:x.push("const vec4 initialProjectionTextureValue = vec4(1.0);");break;case Gp.MAX:case Gp.AVERAGE:default:x.push("const vec4 initialProjectionTextureValue = vec4(0.0);");break}switch(x.push("vec3 projectionScaledDirection = projectionDirection / volumeSizeMC;","vec3 projectionStep = projectionStepLength * projectionScaledDirection;","vec3 projectionStartPosition = volumePosTC + projectionConstantOffset * projectionScaledDirection;","vec4 tvalue = initialProjectionTextureValue;","for (int projectionSampleIdx = 0; projectionSampleIdx < projectionSlabNumberOfSamples; ++projectionSampleIdx) {","  vec3 projectionSamplePosition = projectionStartPosition + float(projectionSampleIdx) * projectionStep;","  vec4 sampledTextureValue = texture(volumeTexture, projectionSamplePosition);"),S){case Gp.MAX:x.push("  tvalue = max(tvalue, sampledTextureValue);");break;case Gp.MIN:x.push("  tvalue = min(tvalue, sampledTextureValue);");break;case Gp.AVERAGE:default:x.push("  tvalue = tvalue + sampledTextureValue;");break}x.push("}"),S===Gp.AVERAGE&&x.push("tvalue = tvalue / float(projectionSlabNumberOfSamples);")}else x.push("vec4 tvalue = texture(volumeTexture, volumePosTC);");if(m){const S=["r","g","b","a"];for(let C=0;C<h;++C)x=x.concat([`vec3 tcolor${C} = mix${C} * texture2D(colorTexture1, vec2(tvalue.${S[C]} * cscale${C} + cshift${C}, height${C})).rgb;`,`float compWeight${C} = mix${C} * texture2D(pwfTexture1, vec2(tvalue.${S[C]} * pwfscale${C} + pwfshift${C}, height${C})).r;`]);switch(h){case 1:x=x.concat(["gl_FragData[0] = vec4(tcolor0.rgb, compWeight0 * opacity);"]);break;case 2:x=x.concat(["float weightSum = compWeight0 + compWeight1;","gl_FragData[0] = vec4(vec3((tcolor0.rgb * (compWeight0 / weightSum)) + (tcolor1.rgb * (compWeight1 / weightSum))), opacity);"]);break;case 3:x=x.concat(["float weightSum = compWeight0 + compWeight1 + compWeight2;","gl_FragData[0] = vec4(vec3((tcolor0.rgb * (compWeight0 / weightSum)) + (tcolor1.rgb * (compWeight1 / weightSum)) + (tcolor2.rgb * (compWeight2 / weightSum))), opacity);"]);break;case 4:x=x.concat(["float weightSum = compWeight0 + compWeight1 + compWeight2 + compWeight3;","gl_FragData[0] = vec4(vec3((tcolor0.rgb * (compWeight0 / weightSum)) + (tcolor1.rgb * (compWeight1 / weightSum)) + (tcolor2.rgb * (compWeight2 / weightSum)) + (tcolor3.rgb * (compWeight3 / weightSum))), opacity);"]);break;default:TS("Unsupported number of independent coordinates.")}}else switch(h){case 1:x=x.concat(["// Dependent components","float intensity = tvalue.r;","vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;","float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;","gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);"]);break;case 2:x=x.concat(["float intensity = tvalue.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tvalue.g + pwfshift0);"]);break;case 3:x=x.concat(["vec4 tcolor = cscale0*tvalue + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]);break;default:x=x.concat(["vec4 tcolor = cscale0*tvalue + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,","  texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"])}s=Ie.substitute(s,"//VTK::TCoord::Impl",x).result,e.haveSeenDepthRequest&&(s=Ie.substitute(s,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,s=Ie.substitute(s,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),r.Vertex=o,r.Fragment=s,t.replaceShaderClip(r,i,a),t.replaceShaderCoincidentOffset(r,i,a)},t.replaceShaderClip=(r,i,a)=>{let o=r.Vertex,s=r.Fragment;if(e.renderable.getNumberOfClippingPlanes()){let c=e.renderable.getNumberOfClippingPlanes();c>6&&(se.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),c=6),o=Ie.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ie.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)","    {","    if (planeNum >= numClipPlanes)","        {","        break;","        }","    clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);","    }"]).result,s=Ie.substitute(s,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,s=Ie.substitute(s,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)","    {","    if (planeNum >= numClipPlanes)","        {","        break;","        }","    if (clipDistancesVSOutput[planeNum] < 0.0) discard;","    }"]).result}r.Vertex=o,r.Fragment=s},t.getShaderTemplate=(r,i,a)=>{r.Vertex=wF,r.Fragment=v3,r.Geometry=""},t.setMapperShaderParameters=(r,i,a)=>{const o=r.getProgram(),s=r.getCABO();s.getElementCount()&&(e.VBOBuildTime.getMTime()>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())&&(o.isAttributeUsed("vertexMC")&&(r.getVAO().addAttributeArray(o,s,"vertexMC",s.getVertexOffset(),s.getStride(),e.context.FLOAT,3,e.context.FALSE)||TS("Error setting vertexMC in shader VAO.")),r.getCABO().getCustomData().forEach(h=>{h&&o.isAttributeUsed(h.name)&&!r.getVAO().addAttributeArray(o,s,h.name,h.offset,s.getStride(),e.context.FLOAT,h.components,e.context.FALSE)&&TS(`Error setting ${h.name} in shader VAO.`)}),r.getAttributeUpdateTime().modified());const c=e.volumeTexture.getTextureUnit();if(o.setUniformi("volumeTexture",c),o.setUniformf("width",e.renderable.getWidth()),r.getProgram().setUniform4fv("backgroundColor",e.renderable.getBackgroundColor()),o.isUniformUsed("tangentDirection")){const h=e.renderable.getTangentDirection();r.getProgram().setUniform3fArray("tangentDirection",h)}if(o.isUniformUsed("bitangentDirection")){const h=e.renderable.getBitangentDirection();r.getProgram().setUniform3fArray("bitangentDirection",h)}if(o.isUniformUsed("centerlineOrientation")){const h=e.renderable.getUniformOrientation();r.getProgram().setUniform4fv("centerlineOrientation",h)}if(o.isUniformUsed("globalCenterPoint")){const h=e.renderable.getCenterPoint();o.setUniform3fArray("globalCenterPoint",h)}if(e.renderable.isProjectionEnabled()){const h=e.currentImageDataInput,m=h.getSpacing(),p=h.getDimensions(),y=e.renderable.getProjectionSlabThickness(),x=e.renderable.getProjectionSlabNumberOfSamples(),S=SSt([],m,p);o.setUniform3fArray("volumeSizeMC",S),o.setUniformi("projectionSlabNumberOfSamples",x);const C=-.5*y;o.setUniformf("projectionConstantOffset",C);const _=y/(x-1);o.setUniformf("projectionStepLength",_)}const l=e.currentImageDataInput,u=l.getWorldToIndex(),f=KU(new Float32Array(16),Nxe([],l.getDimensions())),d=FT(f,f,u);if(o.setUniformMatrix("MCTCMatrix",d),e.haveSeenDepthRequest&&r.getProgram().setUniformi("depthRequest",e.renderDepth?1:0),e.renderable.getNumberOfClippingPlanes()){let h=e.renderable.getNumberOfClippingPlanes();h>6&&(se.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),h=6);const p=s.getCoordShiftAndScaleEnabled()?s.getInverseShiftAndScaleMatrix():null,y=p?pa(e.imagematinv,a.getMatrix()):a.getMatrix();p&&(cr(y,y),Xn(y,y,p),cr(y,y)),cr(e.imagemat,e.currentImageDataInput.getIndexToWorld()),Xn(e.imagematinv,y,e.imagemat);const x=[];for(let S=0;S<h;S++){const C=[];e.renderable.getClippingPlaneInDataCoords(e.imagematinv,S,C);for(let _=0;_<4;_++)x.push(C[_])}o.setUniformi("numClipPlanes",h),o.setUniform4fv("clipPlanes",x)}if(o.isUniformUsed("coffset")){const h=t.getCoincidentParameters(i,a);o.setUniformf("coffset",h.offset),o.isUniformUsed("cfactor")&&o.setUniformf("cfactor",h.factor)}},t.setCameraShaderParameters=(r,i,a)=>{const o=e.openGLImageSlice.getKeyMatrices().mcwc,s=e.openGLCamera.getKeyMatrices(i).wcpc;if(Xn(e.imagemat,s,o),r.getCABO().getCoordShiftAndScaleEnabled()){const c=r.getCABO().getInverseShiftAndScaleMatrix();Xn(e.imagemat,e.imagemat,c)}r.getProgram().setUniformMatrix("MCPCMatrix",e.imagemat)},t.setPropertyShaderParameters=(r,i,a)=>{const o=r.getProgram(),s=a.getProperty(),c=s.getOpacity();o.setUniformf("opacity",c);const l=e.volumeTexture.getComponents(),u=s.getIndependentComponents();if(u)for(let m=0;m<l;++m)o.setUniformf(`mix${m}`,s.getComponentWeight(m));const f=e.volumeTexture.getVolumeInfo();for(let m=0;m<l;m++){let p=s.getColorWindow(),y=s.getColorLevel();const x=u?m:0,S=s.getRGBTransferFunction(x);if(S&&s.getUseLookupTableScalarRange()){const T=S.getRange();p=T[1]-T[0],y=.5*(T[1]+T[0])}const C=f.scale[m]/p,_=(f.offset[m]-y)/p+.5;o.setUniformf(`cshift${m}`,_),o.setUniformf(`cscale${m}`,C)}const d=e.colorTexture.getTextureUnit();o.setUniformi("colorTexture1",d);for(let m=0;m<l;m++){let p=1,y=0;const x=u?m:0,S=s.getPiecewiseFunction(x);if(S){const C=S.getRange(),_=C[1]-C[0],T=.5*(C[0]+C[1]);p=f.scale[m]/_,y=(f.offset[m]-T)/_+.5}o.setUniformf(`pwfshift${m}`,y),o.setUniformf(`pwfscale${m}`,p)}const h=e.pwfTexture.getTextureUnit();o.setUniformi("pwfTexture1",h)},t.updateShaders=(r,i,a)=>{if(t.getNeedToRebuildShaders(r,i,a)){const o={Vertex:null,Fragment:null,Geometry:null};t.buildShaders(o,i,a);const s=e._openGLRenderWindow.getShaderCache().readyShaderProgramArray(o.Vertex,o.Fragment,o.Geometry);s!==r.getProgram()&&(r.setProgram(s),r.getVAO().releaseGraphicsResources()),r.getShaderSourceTime().modified()}else e._openGLRenderWindow.getShaderCache().readyShaderProgram(r.getProgram());r.getVAO().bind(),t.setMapperShaderParameters(r,i,a),t.setCameraShaderParameters(r,i,a),t.setPropertyShaderParameters(r,i,a)},t.delete=se.chain(()=>{e._openGLRenderWindow&&n(e._openGLRenderWindow)},t.delete)}const M6t={currentRenderPass:null,volumeTexture:null,colorTexture:null,pwfTexture:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};function R6t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,M6t,n),La.extend(t,e,n),sp.implementReplaceShaderCoincidentOffset(t,e,n),se.algo(t,e,2,0),e.tris=Ph.newInstance(),e.volumeTexture=null,e.colorTexture=null,e.pwfTexture=null,e.imagemat=sn(new Float64Array(16)),e.imagematinv=sn(new Float64Array(16)),e.VBOBuildTime={},se.obj(e.VBOBuildTime,{mtime:0}),D6t(t,e)}const gwe=se.newInstance(R6t,"vtkOpenGLImageCPRMapper"),I6t={};var N6t={newInstance:gwe,...I6t};jo("vtkImageCPRMapper",gwe);function P6t(t,e){e.classHierarchy.push("vtkOpenGLImageSlice"),t.buildPass=n=>{if(!(!e.renderable||!e.renderable.getVisibility())&&n){if(!e.renderable)return;e._openGLRenderWindow=t.getLastAncestorOfType("vtkOpenGLRenderWindow"),e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer"),e.context=e._openGLRenderWindow.getContext(),t.prepareNodes(),t.addMissingNode(e.renderable.getMapper()),t.removeUnusedNodes()}},t.traverseZBufferPass=n=>{!e.renderable||!e.renderable.getNestedVisibility()||e._openGLRenderer.getSelector()&&!e.renderable.getNestedPickable()||(t.apply(n,!0),e.children.forEach(r=>{r.traverse(n)}),t.apply(n,!1))},t.traverseOpaqueZBufferPass=n=>t.traverseOpaquePass(n),t.traverseOpaquePass=n=>{!e.renderable||!e.renderable.getNestedVisibility()||!e.renderable.getIsOpaque()||e._openGLRenderer.getSelector()&&!e.renderable.getNestedPickable()||(t.apply(n,!0),e.children.forEach(r=>{r.traverse(n)}),t.apply(n,!1))},t.traverseTranslucentPass=n=>{!e.renderable||!e.renderable.getNestedVisibility()||e.renderable.getIsOpaque()||e._openGLRenderer.getSelector()&&!e.renderable.getNestedPickable()||(t.apply(n,!0),e.children.forEach(r=>{r.traverse(n)}),t.apply(n,!1))},t.queryPass=(n,r)=>{if(n){if(!e.renderable||!e.renderable.getVisibility())return;e.renderable.getIsOpaque()?r.incrementOpaqueActorCount():r.incrementTranslucentActorCount()}},t.zBufferPass=(n,r)=>t.opaquePass(n,r),t.opaqueZBufferPass=(n,r)=>t.opaquePass(n,r),t.opaquePass=(n,r)=>{n&&e.context.depthMask(!0)},t.translucentPass=(n,r)=>{e.context.depthMask(!n)},t.getKeyMatrices=()=>(e.renderable.getMTime()>e.keyMatrixTime.getMTime()&&(pa(e.keyMatrices.mcwc,e.renderable.getMatrix()),cr(e.keyMatrices.mcwc,e.keyMatrices.mcwc),e.keyMatrixTime.modified()),e.keyMatrices)}const k6t={context:null,keyMatrixTime:null,keyMatrices:null};function A6t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,k6t,n),La.extend(t,e,n),e.keyMatrixTime={},yi(e.keyMatrixTime,{mtime:0}),e.keyMatrices={mcwc:sn(new Float64Array(16))},Ja(t,e,["context"]),P6t(t,e)}const pwe=ri(A6t,"vtkOpenGLImageSlice");var L6t={newInstance:pwe};jo("vtkImageSlice",pwe);function V6t(t,e){e.classHierarchy.push("vtkOpenGLVolume"),t.buildPass=n=>{!e.renderable||!e.renderable.getVisibility()||n&&(e._openGLRenderWindow=t.getLastAncestorOfType("vtkOpenGLRenderWindow"),e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer"),e.context=e._openGLRenderWindow.getContext(),t.prepareNodes(),t.addMissingNode(e.renderable.getMapper()),t.removeUnusedNodes())},t.queryPass=(n,r)=>{if(n){if(!e.renderable||!e.renderable.getVisibility())return;r.incrementVolumeCount()}},t.traverseVolumePass=n=>{!e.renderable||!e.renderable.getNestedVisibility()||e._openGLRenderer.getSelector()&&!e.renderable.getNestedPickable()||(t.apply(n,!0),e.children[0].traverse(n),t.apply(n,!1))},t.volumePass=n=>{!e.renderable||!e.renderable.getVisibility()||e.context.depthMask(!n)},t.getKeyMatrices=()=>(e.renderable.getMTime()>e.keyMatrixTime.getMTime()&&(e.renderable.computeMatrix(),pa(e.MCWCMatrix,e.renderable.getMatrix()),cr(e.MCWCMatrix,e.MCWCMatrix),e.renderable.getIsIdentity()?vf(e.normalMatrix):(FE(e.normalMatrix,e.MCWCMatrix),g3(e.normalMatrix,e.normalMatrix),GU(e.normalMatrix,e.normalMatrix)),e.keyMatrixTime.modified()),{mcwc:e.MCWCMatrix,normalMatrix:e.normalMatrix})}const $6t={};function j6t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,$6t,n),La.extend(t,e,n),e.keyMatrixTime={},yi(e.keyMatrixTime,{mtime:0}),e.normalMatrix=new Float64Array(9),e.MCWCMatrix=new Float64Array(16),Ja(t,e,["context"]),V6t(t,e)}const mwe=ri(j6t,"vtkOpenGLVolume");var U6t={newInstance:mwe};jo("vtkVolume",mwe);function F6t(t,e){e.classHierarchy.push("vtkFramebuffer"),t.getBothMode=()=>e.context.FRAMEBUFFER,t.saveCurrentBindingsAndBuffers=n=>{const r=typeof n<"u"?n:t.getBothMode();t.saveCurrentBindings(r),t.saveCurrentBuffers(r)},t.saveCurrentBindings=n=>{if(!e.context){Yn("you must set the OpenGLRenderWindow before calling saveCurrentBindings");return}const r=e.context;e.previousDrawBinding=r.getParameter(e.context.FRAMEBUFFER_BINDING),e.previousActiveFramebuffer=e._openGLRenderWindow.getActiveFramebuffer()},t.saveCurrentBuffers=n=>{},t.restorePreviousBindingsAndBuffers=n=>{const r=typeof n<"u"?n:t.getBothMode();t.restorePreviousBindings(r),t.restorePreviousBuffers(r)},t.restorePreviousBindings=n=>{if(!e.context){Yn("you must set the OpenGLRenderWindow before calling restorePreviousBindings");return}const r=e.context;r.bindFramebuffer(r.FRAMEBUFFER,e.previousDrawBinding),e._openGLRenderWindow.setActiveFramebuffer(e.previousActiveFramebuffer)},t.restorePreviousBuffers=n=>{},t.bind=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;r===null&&(r=e.context.FRAMEBUFFER),e.context.bindFramebuffer(r,e.glFramebuffer);for(let i=0;i<e.colorBuffers.length;i++)e.colorBuffers[i].bind();e._openGLRenderWindow.setActiveFramebuffer(t)},t.create=(n,r)=>{if(!e.context){Yn("you must set the OpenGLRenderWindow before calling create");return}e.glFramebuffer=e.context.createFramebuffer(),e.glFramebuffer.width=n,e.glFramebuffer.height=r},t.setColorBuffer=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const i=e.context;if(!i){Yn("you must set the OpenGLRenderWindow before calling setColorBuffer");return}let a=i.COLOR_ATTACHMENT0;if(r>0)if(e._openGLRenderWindow.getWebgl2())a+=r;else{Yn("Using multiple framebuffer attachments requires WebGL 2");return}e.colorBuffers[r]=n,i.framebufferTexture2D(i.FRAMEBUFFER,a,i.TEXTURE_2D,n.getHandle(),0)},t.removeColorBuffer=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;const r=e.context;if(!r){Yn("you must set the OpenGLRenderWindow before calling removeColorBuffer");return}let i=r.COLOR_ATTACHMENT0;if(n>0)if(e._openGLRenderWindow.getWebgl2())i+=n;else{Yn("Using multiple framebuffer attachments requires WebGL 2");return}r.framebufferTexture2D(r.FRAMEBUFFER,i,r.TEXTURE_2D,null,0),e.colorBuffers=e.colorBuffers.splice(n,1)},t.setDepthBuffer=n=>{if(!e.context){Yn("you must set the OpenGLRenderWindow before calling setDepthBuffer");return}if(e._openGLRenderWindow.getWebgl2()){const r=e.context;r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,n.getHandle(),0)}else Yn("Attaching depth buffer textures to fbo requires WebGL 2")},t.removeDepthBuffer=()=>{if(!e.context){Yn("you must set the OpenGLRenderWindow before calling removeDepthBuffer");return}if(e._openGLRenderWindow.getWebgl2()){const n=e.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,null,0)}else Yn("Attaching depth buffer textures to framebuffers requires WebGL 2")},t.getGLFramebuffer=()=>e.glFramebuffer,t.setOpenGLRenderWindow=n=>{e._openGLRenderWindow!==n&&(t.releaseGraphicsResources(),e._openGLRenderWindow=n,e.context=null,n&&(e.context=e._openGLRenderWindow.getContext()))},t.releaseGraphicsResources=()=>{e.glFramebuffer&&e.context.deleteFramebuffer(e.glFramebuffer)},t.getSize=()=>e.glFramebuffer==null?null:[e.glFramebuffer.width,e.glFramebuffer.height],t.populateFramebuffer=()=>{if(!e.context){Yn("you must set the OpenGLRenderWindow before calling populateFrameBuffer");return}t.bind();const n=e.context,r=mi.newInstance();r.setOpenGLRenderWindow(e._openGLRenderWindow),r.setMinificationFilter(Kt.LINEAR),r.setMagnificationFilter(Kt.LINEAR),r.create2DFromRaw(e.glFramebuffer.width,e.glFramebuffer.height,4,zn.UNSIGNED_CHAR,null),t.setColorBuffer(r),e.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,e.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,e.glFramebuffer.width,e.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e.depthTexture)},t.getColorTexture=()=>e.colorBuffers[0]}const B6t={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function vwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,B6t,n),yi(t,e),e.colorBuffers&&Yn("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),e.colorBuffers=[],N2(t,e,["colorBuffers"]),F6t(t,e)}const z6t=ri(vwe,"vtkFramebuffer");var y3={newInstance:z6t,extend:vwe},G6t=`//VTK::System::Dec

/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPolyDataVS.glsl

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

attribute vec4 vertexDC;

varying vec3 vertexVCVSOutput;
uniform mat4 PCVCMatrix;

uniform float dcxmin;
uniform float dcxmax;
uniform float dcymin;
uniform float dcymax;

void main()
{
  // dcsmall is the device coords reduced to the
  // x y area covered by the volume
  vec4 dcsmall = vec4(
    dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),
    dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),
    vertexDC.z,
    vertexDC.w);
  vec4 vcpos = PCVCMatrix * dcsmall;
  vertexVCVSOutput = vcpos.xyz/vcpos.w;
  gl_Position = dcsmall;
}
`,W6t=`//VTK::System::Dec

/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkVolumeFS.glsl

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// Template for the volume mappers fragment shader

// the output of this shader
//VTK::Output::Dec

varying vec3 vertexVCVSOutput;

// first declare the settings from the mapper
// that impact the code paths in here

// always set vtkNumComponents 1,2,3,4
//VTK::NumComponents

// possibly define vtkTrilinearOn
//VTK::TrilinearOn

// possibly define UseIndependentComponents
//VTK::IndependentComponentsOn

// possibly define vtkCustomComponentsColorMix
//VTK::CustomComponentsColorMixOn

// possibly define any "proportional" components
//VTK::vtkProportionalComponents

// possibly define any components that are forced to nearest interpolation
//VTK::vtkForceNearestComponents

// Define the blend mode to use
#define vtkBlendMode //VTK::BlendMode

// Possibly define vtkImageLabelOutlineOn
//VTK::ImageLabelOutlineOn

// Possibly define vtkLabelEdgeProjectionOn
//VTK::LabelEdgeProjectionOn


#ifdef vtkImageLabelOutlineOn
  uniform float outlineOpacity;
  uniform float vpWidth;
  uniform float vpHeight;
  uniform float vpOffsetX;
  uniform float vpOffsetY;
  uniform mat4 PCWCMatrix;
  uniform mat4 vWCtoIDX;

  const int MAX_SEGMENT_INDEX = 256; // Define as per expected maximum
  // bool seenSegmentsByOriginalPos[MAX_SEGMENT_INDEX];
  #define MAX_SEGMENTS 256
  #define UINT_SIZE 32
  #define BITMASK_SIZE ((MAX_SEGMENTS + UINT_SIZE - 1) / UINT_SIZE)

  uint bitmask[BITMASK_SIZE];

  // Set the corresponding bit in the bitmask
  void setBit(int segmentIndex) {
    int index = segmentIndex / UINT_SIZE;
    int bitIndex = segmentIndex % UINT_SIZE;
    bitmask[index] |= 1u << bitIndex;
  }

  // Check if a bit is set in the bitmask
  bool isBitSet(int segmentIndex) {
    int index = segmentIndex / UINT_SIZE;
    int bitIndex = segmentIndex % UINT_SIZE;
    return ((bitmask[index] & (1u << bitIndex)) != 0u);
  }
#endif

// define vtkLightComplexity
//VTK::LightComplexity
#if vtkLightComplexity > 0
uniform float vSpecularPower;
uniform float vAmbient;
uniform float vDiffuse;
uniform float vSpecular;
//VTK::Light::Dec
#endif

//VTK::VolumeShadowOn
//VTK::SurfaceShadowOn
//VTK::localAmbientOcclusionOn
//VTK::LAO::Dec
//VTK::VolumeShadow::Dec

// define vtkComputeNormalFromOpacity
//VTK::vtkComputeNormalFromOpacity

// possibly define vtkGradientOpacityOn
//VTK::GradientOpacityOn
#ifdef vtkGradientOpacityOn
uniform float goscale0;
uniform float goshift0;
uniform float gomin0;
uniform float gomax0;
#ifdef UseIndependentComponents
#if vtkNumComponents > 1
uniform float goscale1;
uniform float goshift1;
uniform float gomin1;
uniform float gomax1;
#if vtkNumComponents > 2
uniform float goscale2;
uniform float goshift2;
uniform float gomin2;
uniform float gomax2;
#if vtkNumComponents > 3
uniform float goscale3;
uniform float goshift3;
uniform float gomin3;
uniform float gomax3;
#endif
#endif
#endif
#endif
#endif

// if you want to see the raw tiled
// data in webgl1 uncomment the following line
// #define debugtile

// camera values
uniform float camThick;
uniform float camNear;
uniform float camFar;
uniform int cameraParallel;

// values describing the volume geometry
uniform vec3 vOriginVC;
uniform vec3 vSpacing;
uniform ivec3 volumeDimensions; // 3d texture dimensions
uniform vec3 vPlaneNormal0;
uniform float vPlaneDistance0;
uniform vec3 vPlaneNormal1;
uniform float vPlaneDistance1;
uniform vec3 vPlaneNormal2;
uniform float vPlaneDistance2;
uniform vec3 vPlaneNormal3;
uniform float vPlaneDistance3;
uniform vec3 vPlaneNormal4;
uniform float vPlaneDistance4;
uniform vec3 vPlaneNormal5;
uniform float vPlaneDistance5;

//VTK::ClipPlane::Dec

// opacity and color textures
uniform sampler2D otexture;
uniform float oshift0;
uniform float oscale0;
uniform sampler2D ctexture;
uniform float cshift0;
uniform float cscale0;

#if vtkNumComponents >= 2
uniform float oshift1;
uniform float oscale1;
uniform float cshift1;
uniform float cscale1;
#endif
#if vtkNumComponents >= 3
uniform float oshift2;
uniform float oscale2;
uniform float cshift2;
uniform float cscale2;
#endif
#if vtkNumComponents >= 4
uniform float oshift3;
uniform float oscale3;
uniform float cshift3;
uniform float cscale3;
#endif

// jitter texture
uniform sampler2D jtexture;
uniform sampler2D ttexture;


// some 3D texture values
uniform float sampleDistance;
uniform vec3 vVCToIJK;
uniform vec3 volumeSpacings; // spacing in the world coorindates


// the heights defined below are the locations
// for the up to four components of the tfuns
// the tfuns have a height of 2XnumComps pixels so the
// values are computed to hit the middle of the two rows
// for that component
#ifdef UseIndependentComponents
#if vtkNumComponents == 1
uniform float mix0;
#define height0 0.5
#endif
#if vtkNumComponents == 2
uniform float mix0;
uniform float mix1;
#define height0 0.25
#define height1 0.75
#endif
#if vtkNumComponents == 3
uniform float mix0;
uniform float mix1;
uniform float mix2;
#define height0 0.17
#define height1 0.5
#define height2 0.83
#endif
#if vtkNumComponents == 4
uniform float mix0;
uniform float mix1;
uniform float mix2;
uniform float mix3;
#define height0 0.125
#define height1 0.375
#define height2 0.625
#define height3 0.875
#endif
#endif

uniform vec4 ipScalarRangeMin;
uniform vec4 ipScalarRangeMax;

// declaration for intermixed geometry
//VTK::ZBuffer::Dec

//=======================================================================
// global and custom variables (a temporary section before photorealistics rendering module is complete)
vec3 rayDirVC;
float sampleDistanceISVS;
float sampleDistanceIS;

#define SQRT3    1.7321
#define INV4PI   0.0796
#define EPSILON  0.001
#define PI       3.1415
#define PI2      9.8696

//=======================================================================
// Webgl2 specific version of functions
#if __VERSION__ == 300

uniform highp sampler3D texture1;

vec4 getTextureValue(vec3 pos)
{
  vec4 tmp = texture(texture1, pos);

  #if defined(vtkComponent0ForceNearest) || \\
      defined(vtkComponent1ForceNearest) || \\
      defined(vtkComponent2ForceNearest) || \\
      defined(vtkComponent3ForceNearest)
    vec3 nearestPos = (floor(pos * vec3(volumeDimensions)) + 0.5) / vec3(volumeDimensions);
    vec4 nearestValue = texture(texture1, nearestPos);
    #ifdef vtkComponent0ForceNearest
      tmp[0] = nearestValue[0];
    #endif
    #ifdef vtkComponent1ForceNearest
      tmp[1] = nearestValue[1];
    #endif
    #ifdef vtkComponent2ForceNearest
      tmp[2] = nearestValue[2];
    #endif
    #ifdef vtkComponent3ForceNearest
      tmp[3] = nearestValue[3];
    #endif
  #endif

  #ifndef UseIndependentComponents
    #if vtkNumComponents == 1
      tmp.a = tmp.r;
    #endif
    #if vtkNumComponents == 2
      tmp.a = tmp.g;
    #endif
    #if vtkNumComponents == 3
      tmp.a = length(tmp.rgb);
    #endif
  #endif

  return tmp;
}

//=======================================================================
// WebGL1 specific version of functions
#else

uniform sampler2D texture1;

uniform float texWidth;
uniform float texHeight;
uniform int xreps;
uniform int xstride;
uniform int ystride;

// if computing trilinear values from multiple z slices
#ifdef vtkTrilinearOn
vec4 getTextureValue(vec3 ijk)
{
  float zoff = 1.0/float(volumeDimensions.z);
  vec4 val1 = getOneTextureValue(ijk);
  vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));

  float indexZ = float(volumeDimensions)*ijk.z;
  float zmix =  indexZ - floor(indexZ);

  return mix(val1, val2, zmix);
}

vec4 getOneTextureValue(vec3 ijk)
#else // nearest or fast linear
vec4 getTextureValue(vec3 ijk)
#endif
{
  vec3 tdims = vec3(volumeDimensions);

#ifdef debugtile
  vec2 tpos = vec2(ijk.x, ijk.y);
  vec4 tmp = texture2D(texture1, tpos);
  tmp.a = 1.0;

#else
  int z = int(ijk.z * tdims.z);
  int yz = z / xreps;
  int xz = z - yz*xreps;

  int tileWidth = volumeDimensions.x/xstride;
  int tileHeight = volumeDimensions.y/ystride;

  xz *= tileWidth;
  yz *= tileHeight;

  float ni = float(xz) + (ijk.x*float(tileWidth));
  float nj = float(yz) + (ijk.y*float(tileHeight));

  vec2 tpos = vec2(ni/texWidth, nj/texHeight);

  vec4 tmp = texture2D(texture1, tpos);

#if vtkNumComponents == 1
  tmp.a = tmp.r;
#endif
#if vtkNumComponents == 2
  tmp.g = tmp.a;
#endif
#if vtkNumComponents == 3
  tmp.a = length(tmp.rgb);
#endif
#endif

  return tmp;
}

// End of Webgl1 specific code
//=======================================================================
#endif

//=======================================================================
// transformation between VC and IS space

// convert vector position from idx to vc
#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)
vec3 IStoVC(vec3 posIS){
  vec3 posVC = posIS / vVCToIJK;
  return posVC.x * vPlaneNormal0 +
         posVC.y * vPlaneNormal2 +
         posVC.z * vPlaneNormal4 +
         vOriginVC;
}

// convert vector position from vc to idx
vec3 VCtoIS(vec3 posVC){
  posVC = posVC - vOriginVC;
  posVC = vec3(
    dot(posVC, vPlaneNormal0),
    dot(posVC, vPlaneNormal2),
    dot(posVC, vPlaneNormal4));
  return posVC * vVCToIJK;
}
#endif

//Rotate vector to view coordinate
#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)
void rotateToViewCoord(inout vec3 dirIS){
  dirIS.xyz =
    dirIS.x * vPlaneNormal0 +
    dirIS.y * vPlaneNormal2 +
    dirIS.z * vPlaneNormal4;
}

//Rotate vector to idx coordinate
vec3 rotateToIDX(vec3 dirVC){
  vec3 dirIS;
  dirIS.xyz = vec3(
    dot(dirVC, vPlaneNormal0),
    dot(dirVC, vPlaneNormal2),
    dot(dirVC, vPlaneNormal4));
  return dirIS;
}
#endif

//=======================================================================
// Given a normal compute the gradient opacity factors
float computeGradientOpacityFactor(
  float normalMag, float goscale, float goshift, float gomin, float gomax)
{
  return clamp(normalMag * goscale + goshift, gomin, gomax);
}

//=======================================================================
// compute the normal and gradient magnitude for a position, uses forward difference
#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)
  #ifdef vtkClippingPlanesOn
    void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)
    {
      vec3 g1VC[3];
      for (int i = 0; i < 3; ++i)
      {
        g1VC[i] = IStoVC(texPos[i]);
      }
      vec3 posVC = IStoVC(pos);
      for (int i = 0; i < clip_numPlanes; ++i)
      {
        for (int j = 0; j < 3; ++j)
        {
          if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)
          {
            g1[j] = 0.0;
          }
        }
      }
    }
  #endif

  #ifdef vtkComputeNormalFromOpacity
    vec4 computeDensityNormal(vec3 opacityUCoords[2], float opactityTextureHeight, float gradientOpacity) {
      vec3 opacityG1, opacityG2;
      opacityG1.x = texture2D(otexture, vec2(opacityUCoords[0].x, opactityTextureHeight)).r;
      opacityG1.y = texture2D(otexture, vec2(opacityUCoords[0].y, opactityTextureHeight)).r;
      opacityG1.z = texture2D(otexture, vec2(opacityUCoords[0].z, opactityTextureHeight)).r;
      opacityG2.x = texture2D(otexture, vec2(opacityUCoords[1].x, opactityTextureHeight)).r;
      opacityG2.y = texture2D(otexture, vec2(opacityUCoords[1].y, opactityTextureHeight)).r;
      opacityG2.z = texture2D(otexture, vec2(opacityUCoords[1].z, opactityTextureHeight)).r;
      opacityG1.xyz *= gradientOpacity;
      opacityG2.xyz *= gradientOpacity;

      vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);
      // divide by spacing
      opacityG.xyz /= vSpacing;
      opacityG.w = length(opacityG.xyz);
      // rotate to View Coords
      rotateToViewCoord(opacityG.xyz);
      if (!all(equal(opacityG.xyz, vec3(0.0)))) {
        return vec4(normalize(opacityG.xyz),opacityG.w);
      } else {
        return vec4(0.0);
      }
    }

    vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2], const int opacityComponent)
    {
      vec3 xvec = vec3(tstep.x, 0.0, 0.0);
      vec3 yvec = vec3(0.0, tstep.y, 0.0);
      vec3 zvec = vec3(0.0, 0.0, tstep.z);
      vec3 texPosPVec[3];
      texPosPVec[0] = pos + xvec;
      texPosPVec[1] = pos + yvec;
      texPosPVec[2] = pos + zvec;
      vec3 texPosNVec[3];
      texPosNVec[0] = pos - xvec;
      texPosNVec[1] = pos - yvec;
      texPosNVec[2] = pos - zvec;
      vec3 g1, g2;

      scalarInterp[0].x = getTextureValue(texPosPVec[0])[opacityComponent];
      scalarInterp[0].y = getTextureValue(texPosPVec[1])[opacityComponent];
      scalarInterp[0].z = getTextureValue(texPosPVec[2])[opacityComponent];
      scalarInterp[1].x = getTextureValue(texPosNVec[0])[opacityComponent];
      scalarInterp[1].y = getTextureValue(texPosNVec[1])[opacityComponent];
      scalarInterp[1].z = getTextureValue(texPosNVec[2])[opacityComponent];

      #ifdef vtkClippingPlanesOn
        adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);
        adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);
      #endif
      vec4 result;
      result.x = scalarInterp[0].x - scalarInterp[1].x;
      result.y = scalarInterp[0].y - scalarInterp[1].y;
      result.z = scalarInterp[0].z - scalarInterp[1].z;
      // divide by spacing
      result.xyz /= vSpacing;
      result.w = length(result.xyz);
      // rotate to View Coords
      rotateToViewCoord(result.xyz);
      if (length(result.xyz) > 0.0) {
        return vec4(normalize(result.xyz),result.w);
      } else {
        return vec4(0.0);
      }
    }
  #endif

  // only works with dependent components
  vec4 computeNormal(vec3 pos, vec3 tstep)
  {
    vec3 xvec = vec3(tstep.x, 0.0, 0.0);
    vec3 yvec = vec3(0.0, tstep.y, 0.0);
    vec3 zvec = vec3(0.0, 0.0, tstep.z);
    vec3 texPosPVec[3];
    texPosPVec[0] = pos + xvec;
    texPosPVec[1] = pos + yvec;
    texPosPVec[2] = pos + zvec;
    vec3 texPosNVec[3];
    texPosNVec[0] = pos - xvec;
    texPosNVec[1] = pos - yvec;
    texPosNVec[2] = pos - zvec;
    vec3 g1, g2;
    g1.x = getTextureValue(texPosPVec[0]).a;
    g1.y = getTextureValue(texPosPVec[1]).a;
    g1.z = getTextureValue(texPosPVec[2]).a;
    g2.x = getTextureValue(texPosNVec[0]).a;
    g2.y = getTextureValue(texPosNVec[1]).a;
    g2.z = getTextureValue(texPosNVec[2]).a;
    #ifdef vtkClippingPlanesOn
      adjustClippedVoxelValues(pos, texPosPVec, g1);
      adjustClippedVoxelValues(pos, texPosNVec, g2);
    #endif
    vec4 result;
    result = vec4(g1 - g2, -1.0);
    // divide by spacing
    result.xyz /= vSpacing;
    result.w = length(result.xyz);
    if (result.w > 0.0){
      // rotate to View Coords
      rotateToViewCoord(result.xyz);
      return vec4(normalize(result.xyz),result.w);
    } else {
      return vec4(0.0);
    }
  }
#endif


#ifdef vtkImageLabelOutlineOn
  vec4 fragCoordToPCPos(vec4 fragCoord) {
    return vec4(
      (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,
      (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,
      (fragCoord.z - 0.5) * 2.0,
      1.0);
  }

  vec4 pcPosToWorldCoord(vec4 pcPos) {
    return PCWCMatrix * pcPos;
  }

  vec3 fragCoordToIndexSpace(vec4 fragCoord) {
    vec4 pcPos = fragCoordToPCPos(fragCoord);
    vec4 worldCoord = pcPosToWorldCoord(pcPos);
    vec4 vertex = (worldCoord / worldCoord.w);

    vec3 index = (vWCtoIDX * vertex).xyz;

    // half voxel fix for labelmapOutline
    return (index + vec3(0.5)) / vec3(volumeDimensions);
  }

  vec3 fragCoordToWorld(vec4 fragCoord) {
    vec4 pcPos = fragCoordToPCPos(fragCoord);
    vec4 worldCoord = pcPosToWorldCoord(pcPos);
    return worldCoord.xyz;
  }
#endif

//=======================================================================
// compute the normals and gradient magnitudes for a position
// for independent components
mat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)
{
  mat4 result;
  vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;
  vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;
  vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;

  // divide by spacing
  distX /= vSpacing.x;
  distY /= vSpacing.y;
  distZ /= vSpacing.z;

  mat3 rot;
  rot[0] = vPlaneNormal0;
  rot[1] = vPlaneNormal2;
  rot[2] = vPlaneNormal4;

#if !defined(vtkComponent0Proportional)
  result[0].xyz = vec3(distX.r, distY.r, distZ.r);
  result[0].a = length(result[0].xyz);
  result[0].xyz *= rot;
  if (result[0].w > 0.0)
  {
    result[0].xyz /= result[0].w;
  }
#endif

// optionally compute the 2nd component
#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)
  result[1].xyz = vec3(distX.g, distY.g, distZ.g);
  result[1].a = length(result[1].xyz);
  result[1].xyz *= rot;
  if (result[1].w > 0.0)
  {
    result[1].xyz /= result[1].w;
  }
#endif

// optionally compute the 3rd component
#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)
  result[2].xyz = vec3(distX.b, distY.b, distZ.b);
  result[2].a = length(result[2].xyz);
  result[2].xyz *= rot;
  if (result[2].w > 0.0)
  {
    result[2].xyz /= result[2].w;
  }
#endif

// optionally compute the 4th component
#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)
  result[3].xyz = vec3(distX.a, distY.a, distZ.a);
  result[3].a = length(result[3].xyz);
  result[3].xyz *= rot;
  if (result[3].w > 0.0)
  {
    result[3].xyz /= result[3].w;
  }
#endif

  return result;
}

//=======================================================================
// global shadow - secondary ray
#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)
float random()
{
  float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);
  float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;
  uint pcg_state = floatBitsToUint(jitter);
  uint state = pcg_state;
  pcg_state = pcg_state * uint(747796405) + uint(2891336453);
  uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);
  return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;
}
#endif

#ifdef VolumeShadowOn
// henyey greenstein phase function
float phase_function(float cos_angle)
{
  // divide by 2.0 instead of 4pi to increase intensity
  return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;
}

// Computes the intersection between a ray and a box
struct Hit
{
  float tmin;
  float tmax;
};

struct Ray
{
  vec3 origin;
  vec3 dir;
  vec3 invDir;
};

bool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)
{
  vec3 tbot = r.invDir * (boundMin - r.origin);
  vec3 ttop = r.invDir * (boundMax - r.origin);
  vec3 tmin = min(ttop, tbot);
  vec3 tmax = max(ttop, tbot);
  vec2 t = max(tmin.xx, tmin.yz);
  float t0 = max(t.x, t.y);
  t = min(tmax.xx, tmax.yz);
  float t1 = min(t.x, t.y);
  hit.tmin = t0;
  hit.tmax = t1;
  return t1 > max(t0,0.0);
}

// As BBoxIntersect requires the inverse of the ray coords,
// this function is used to avoid numerical issues
void safe_0_vector(inout Ray ray)
{
  if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;
  if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;
  if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;
}

float volume_shadow(vec3 posIS, vec3 lightDirNormIS)
{
  float shadow = 1.0;
  float opacity = 0.0;

  // modify sample distance with a random number between 1.5 and 3.0
  float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());
  float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;

  // in case the first sample near surface has a very tiled light ray, we need to offset start position
  posIS += sampleDistanceISVS_jitter * lightDirNormIS;

  // compute the start and end points for the ray
  Ray ray;
  Hit hit;
  ray.origin = posIS;
  ray.dir = lightDirNormIS;
  safe_0_vector(ray);
  ray.invDir = 1.0/ray.dir;

  if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))
  {
    return 1.0;
  }
  float maxdist = hit.tmax;

  // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach
  float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);
  maxdist = min(maxdist,maxgi);
  if(maxdist < EPSILON) {
    return 1.0;
  }

  float current_dist = 0.0;
  float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);
  float clamped_step = 0.0;

  vec4 scalar = vec4(0.0);
  while(current_dist < maxdist)
  {
#ifdef vtkClippingPlanesOn
    vec3 posVC = IStoVC(posIS);
    for (int i = 0; i < clip_numPlanes; ++i)
    {
      if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)
      {
        current_dist = maxdist;
      }
    }
#endif
    scalar = getTextureValue(posIS);
    opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;
    #if defined(vtkGradientOpacityOn) && !defined(UseIndependentComponents)
      vec4 normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));
      opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);
    #endif
    shadow *= 1.0 - opacity;

    // optimization: early termination
    if (shadow < EPSILON){
      return 0.0;
    }

    clamped_step = min(maxdist - current_dist, current_step);
    posIS += clamped_step * lightDirNormIS;
    current_dist += current_step;
  }

  return shadow;
}

vec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)
{
  vec3 vertLight = vec3(0.0);
  vec3 secondary_contrib = vec3(0.0);
  // here we assume only positional light, no effect of cones
  for (int i = 0; i < lightNum; i++)
  {
    #if(vtkLightComplexity==3)
      if (lightPositional[i] == 1){
        vertLight = lightPositionVC[i] - IStoVC(posIS);
      }else{
        vertLight = - lightDirectionVC[i];
      }
    #else
      vertLight = - lightDirectionVC[i];
    #endif
    // here we assume achromatic light, only intensity
    float dDotL = dot(viewDirectionVC, normalize(vertLight));
    // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity
    float phase_attenuation = 0.5;
    if (abs(anisotropy) > EPSILON){
      phase_attenuation = phase_function(dDotL);
    }
    float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));
    secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;
    secondary_contrib += tColor * vAmbient;
  }
  return secondary_contrib;
}
#endif

//=======================================================================
// local ambient occlusion
#ifdef localAmbientOcclusionOn
vec3 sample_direction_uniform(int i)
{
  float rand = random() * 0.5;
  float theta = PI2 * (kernelSample[i][0] + rand);
  float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;
  return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));
}

// return a matrix that transform startDir into z axis; startDir should be normalized
mat3 zBaseRotationalMatrix(vec3 startDir){
  vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));
  float cosA = startDir.z;
  float k = 1.0 / (1.0 + cosA);
  mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,
              (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,
              (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);
  return matrix;
}

float computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){
  // apply LAO only at selected locations, otherwise return full brightness
  if (normal.w > 0.0 && op > 0.05){
    float total_transmittance = 0.0;
    mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));
    vec3 currPos, randomDirStep;
    float weight, transmittance, opacity;
    for (int i = 0; i < kernelSize; i++)
    {
      randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;
      weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));
      currPos = posIS;
      transmittance = 1.0;
      for (int j = 0; j < kernelRadius ; j++){
        currPos += randomDirStep;
        // check if it's at clipping plane, if so return full brightness
        if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){
          opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;
          #ifdef vtkGradientOpacityOn
             opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);
          #endif
          transmittance *= 1.0 - opacity;
        }
        else{
          break;
        }
      }
      total_transmittance += transmittance / float(kernelRadius) * weight;

      // early termination if fully translucent
      if (total_transmittance > 1.0 - EPSILON){
        return 1.0;
      }
    }
    // average transmittance and reduce variance
    return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);
  } else {
    return 1.0;
  }
}
#endif

//=======================================================================
// surface light contribution
#if vtkLightComplexity > 0
  void applyLighting(inout vec3 tColor, vec4 normal)
  {
    vec3 diffuse = vec3(0.0, 0.0, 0.0);
    vec3 specular = vec3(0.0, 0.0, 0.0);
    float df, sf = 0.0;
    for (int i = 0; i < lightNum; i++){
        df = abs(dot(normal.rgb, -lightDirectionVC[i]));
        diffuse += df * lightColor[i];
        sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);
        specular += sf * lightColor[i];
    }
    tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;
  }
  #ifdef SurfaceShadowOn
  #if vtkLightComplexity < 3
    vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)
    {
      // everything in VC
      vec3 diffuse = vec3(0.0);
      vec3 specular = vec3(0.0);
      #ifdef localAmbientOcclusionOn
        vec3 ambient = vec3(0.0);
      #endif
      vec3 vertLightDirection;
      for (int i = 0; i < lightNum; i++){
        float ndotL,vdotR;
        vertLightDirection = lightDirectionVC[i];
        ndotL = dot(normal.xyz, vertLightDirection);
        if (ndotL < 0.0 && twoSidedLighting)
        {
          ndotL = -ndotL;
        }
        if (ndotL > 0.0)
        {
          diffuse += ndotL * lightColor[i];
          //specular
          vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));
          if (vdotR > 0.0)
          {
            specular += pow(vdotR, vSpecularPower) * lightColor[i];
          }
        }
        #ifdef localAmbientOcclusionOn
            ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);
        #endif
      }
      #ifdef localAmbientOcclusionOn
        return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;
      #else
        return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;
      #endif
    }
  #else
    vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)
    {
      // everything in VC
      vec3 diffuse = vec3(0.0);
      vec3 specular = vec3(0.0);
      #ifdef localAmbientOcclusionOn
        vec3 ambient = vec3(0.0);
      #endif
      vec3 vertLightDirection;
      for (int i = 0; i < lightNum; i++){
        float distance,attenuation,ndotL,vdotR;
        vec3 lightDir;
        if (lightPositional[i] == 1){
          lightDir = lightDirectionVC[i];
          vertLightDirection = posVC - lightPositionVC[i];
          distance = length(vertLightDirection);
          vertLightDirection = normalize(vertLightDirection);
          attenuation = 1.0 / (lightAttenuation[i].x
                              + lightAttenuation[i].y * distance
                              + lightAttenuation[i].z * distance * distance);
          // per OpenGL standard cone angle is 90 or less for a spot light
          if (lightConeAngle[i] <= 90.0){
            float coneDot = dot(vertLightDirection, lightDir);
            if (coneDot >= cos(radians(lightConeAngle[i]))){  // if inside cone
              attenuation = attenuation * pow(coneDot, lightExponent[i]);
            }
            else {
              attenuation = 0.0;
            }
          }
          ndotL = dot(normal.xyz, vertLightDirection);
          if (ndotL < 0.0 && twoSidedLighting)
          {
            ndotL = -ndotL;
          }
          if (ndotL > 0.0)
          {
            diffuse += ndotL * attenuation * lightColor[i];
            //specular
            vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));
            if (vdotR > 0.0)
            {
              specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];
            }
          }
          #ifdef localAmbientOcclusionOn
            ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);
          #endif
        } else {
          vertLightDirection = lightDirectionVC[i];
          ndotL = dot(normal.xyz, vertLightDirection);
          if (ndotL < 0.0 && twoSidedLighting)
          {
            ndotL = -ndotL;
          }
          if (ndotL > 0.0)
          {
            diffuse += ndotL * lightColor[i];
            //specular
            vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));
            if (vdotR > 0.0)
            {
              specular += pow(vdotR, vSpecularPower) * lightColor[i];
            }
          }
          #ifdef localAmbientOcclusionOn
            ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);
          #endif
        }
      }
      #ifdef localAmbientOcclusionOn
        return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;
      #else
        return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;
      #endif
    }
  #endif
  #endif
#endif

// LAO of surface shadows and volume shadows only work with dependent components
vec3 applyAllLightning(vec3 tColor, float alpha, vec3 posIS, vec4 normalLight) {
  #if vtkLightComplexity > 0
    // surface shadows if needed
    #ifdef SurfaceShadowOn
      #if vtkLightComplexity < 3
        vec3 tColorS = applyLightingDirectional(posIS, vec4(tColor, alpha), normalLight);
      #else
        vec3 tColorS = applyLightingPositional(posIS, vec4(tColor, alpha), normalLight, IStoVC(posIS));
      #endif
    #endif

    // volume shadows if needed
    #ifdef VolumeShadowOn
      vec3 tColorVS = applyShadowRay(tColor, posIS, rayDirVC);
    #endif

    // merge
    #ifdef VolumeShadowOn
      #ifdef SurfaceShadowOn
        // surface shadows + volumetric shadows
        float vol_coef = volumetricScatteringBlending * (1.0 - alpha / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);
        tColor = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;
      #else
        // volumetric shadows only
        tColor = tColorVS;
      #endif
    #else
      #ifdef SurfaceShadowOn
        // surface shadows only
        tColor = tColorS;
      #else
        // no shadows
        applyLighting(tColor, normal3);
      #endif
    #endif
  #endif
  return tColor;
}

  
vec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)
{

// If labeloutline and not the edge labelmap, since in the edge labelmap blend
// we need the underlying data to sample through
#if defined(vtkImageLabelOutlineOn) && !defined(vtkLabelEdgeProjectionOn)
  vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space
  vec4 centerValue = getTextureValue(centerPosIS);
  bool pixelOnBorder = false;
  vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));

  // Get alpha of segment from opacity function.
  tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;

  int segmentIndex = int(centerValue.r * 255.0);
  
  // Use texture sampling for outlineThickness
  float textureCoordinate = float(segmentIndex - 1) / 1024.0;
  float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;

  int actualThickness = int(textureValue * 255.0);


  // If it is the background (segment index 0), we should quickly bail out. 
  // Previously, this was determined by tColor.a, which was incorrect as it
  // prevented the outline from appearing when the fill is 0.
  if (segmentIndex == 0){
    return vec4(0, 0, 0, 0);
  }

  // Only perform outline check on fragments rendering voxels that aren't invisible.
  // Saves a bunch of needless checks on the background.
  // TODO define epsilon when building shader?
  for (int i = -actualThickness; i <= actualThickness; i++) {
    for (int j = -actualThickness; j <= actualThickness; j++) {
      if (i == 0 || j == 0) {
        continue;
      }

      vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),
        gl_FragCoord.y + float(j),
        gl_FragCoord.z, gl_FragCoord.w);

      vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);
      vec4 value = getTextureValue(neighborPosIS);

      // If any of my neighbours are not the same value as I
      // am, this means I am on the border of the segment.
      // We can break the loops
      if (any(notEqual(value, centerValue))) {
        pixelOnBorder = true;
        break;
      }
    }

    if (pixelOnBorder == true) {
      break;
    }
  }

  // If I am on the border, I am displayed at full opacity
  if (pixelOnBorder == true) {
    tColor.a = outlineOpacity;
  }

  return tColor;

#else
  // compute the normal and gradient magnitude if needed
  // We compute it as a vec4 if possible otherwise a mat4

  #ifdef UseIndependentComponents

    // sample textures
    vec3 tColor0 = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0)).rgb;
    float pwfValue0 = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;

    #if vtkNumComponents > 1
      vec3 tColor1 = texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;
      float pwfValue1 = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;

      #if vtkNumComponents > 2
        vec3 tColor2 = texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;
        float pwfValue2 = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;

        #if vtkNumComponents > 3
          vec3 tColor3 = texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;
          float pwfValue3 = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;
        #endif
      #endif
    #endif

    #if !defined(vtkCustomComponentsColorMix)
      // default path for component color mix

      // compute the normal vectors as needed
      #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)
        mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);
      #endif

      // compute gradient opacity factors as needed
      vec4 goFactor = vec4(1.0, 1.0 ,1.0 ,1.0);
      #if defined(vtkGradientOpacityOn)
        #if !defined(vtkComponent0Proportional)
          goFactor.x =
            computeGradientOpacityFactor(normalMat[0].a, goscale0, goshift0, gomin0, gomax0);
        #endif
        #if vtkNumComponents > 1
          #if !defined(vtkComponent1Proportional)
            goFactor.y =
              computeGradientOpacityFactor(normalMat[1].a, goscale1, goshift1, gomin1, gomax1);
          #endif
          #if vtkNumComponents > 2
            #if !defined(vtkComponent2Proportional)
              goFactor.z =
                computeGradientOpacityFactor(normalMat[2].a, goscale2, goshift2, gomin2, gomax2);
            #endif
            #if vtkNumComponents > 3
              #if !defined(vtkComponent3Proportional)
                goFactor.w =
                  computeGradientOpacityFactor(normalMat[3].a, goscale3, goshift3, gomin3, gomax3);
              #endif
            #endif
          #endif
        #endif
      #endif

      // process color and opacity for each component
      #if !defined(vtkComponent0Proportional)
        float alpha = goFactor.x*mix0*pwfValue0;
        #if vtkLightComplexity > 0
          applyLighting(tColor0, normalMat[0]);
        #endif
      #else
        tColor0 *= pwfValue0;
        float alpha = mix(pwfValue0, 1.0, (1.0 - mix0));
      #endif

      #if vtkNumComponents > 1
        #if !defined(vtkComponent1Proportional)
          alpha += goFactor.y*mix1*pwfValue1;
          #if vtkLightComplexity > 0
            applyLighting(tColor1, normalMat[1]);
          #endif
        #else
          tColor1 *= pwfValue1;
          alpha *= mix(pwfValue1, 1.0, (1.0 - mix1));
        #endif

        #if vtkNumComponents > 2
          #if !defined(vtkComponent2Proportional)
            alpha += goFactor.z*mix2*pwfValue2;
            #if vtkLightComplexity > 0
              applyLighting(tColor2, normalMat[2]);
            #endif
          #else
            tColor2 *= pwfValue2;
            alpha *= mix(pwfValue2, 1.0, (1.0 - mix2));
          #endif
        #endif

        #if vtkNumComponents > 3
          #if !defined(vtkComponent3Proportional)
            alpha += goFactor.w*mix3*pwfValue3;
            #if vtkLightComplexity > 0
              applyLighting(tColor3, normalMat[3]);
            #endif
          #else
            tColor3 *= pwfValue3;
            alpha *= mix(pwfValue3, 1.0, (1.0 - mix3));
          #endif
        #endif
      #endif

      // perform final independent blend
      vec3 tColor = mix0 * tColor0;
      #if vtkNumComponents > 1
        tColor += mix1 * tColor1;
        #if vtkNumComponents > 2
          tColor += mix2 * tColor2;
          #if vtkNumComponents > 3
            tColor += mix3 * tColor3;
          #endif
        #endif
      #endif

      return vec4(tColor, alpha);
    #else
      /*
       * Mix the color information from all the independent components to get a single rgba output
       * Gradient opactity factors and normals are not computed
       *
       * You can compute these using:
       * - computeMat4Normal: always available, compute normal only for non proportional components, used by default independent component mix
       * - computeDensityNormal & computeNormalForDensity: available if ((LightComplexity > 0) || GradientOpacityOn) && ComputeNormalFromOpacity),
       *                                                   used by dependent component color mix, see code for Additive preset in OpenGl/VolumeMapper
       * - computeGradientOpacityFactor: always available, used in a lot of places
       *
       * Using applyAllLightning() is advised for shading but some features don't work well with it (volume shadows, LAO)
       * mix0, mix1, ... are defined for each component that is used and correspond to the componentWeight
       */
      //VTK::CustomComponentsColorMix::Impl
    #endif
  #else
    // dependent components

    // compute normal if needed
    #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)
      // use component 3 of the opacity texture as getTextureValue() sets alpha to the opacity value
      #ifdef vtkComputeNormalFromOpacity
        vec3 scalarInterp[2];
        vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp, 3);
      #else
        vec4 normal0 = computeNormal(posIS, tstep);
      #endif
    #endif

    // compute gradient opacity factor enabled
    #if defined(vtkGradientOpacityOn)
      float gradientOpacity = computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);
    #else
      const float gradientOpacity = 1.0;
    #endif

    // get color and opacity
    #if vtkNumComponents == 1
      vec3 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5)).rgb;
      float alpha = gradientOpacity*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;
      if (alpha < EPSILON){
        return vec4(0.0);
      }
    #endif
    #if vtkNumComponents == 2
      vec3 tColor = vec3(tValue.r * cscale0 + cshift0);
      float alpha = gradientOpacity*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;
    #endif
    #if vtkNumComponents == 3
      vec3 tColor;
      tColor.r = tValue.r * cscale0 + cshift0;
      tColor.g = tValue.g * cscale1 + cshift1;
      tColor.b = tValue.b * cscale2 + cshift2;
      float alpha = gradientOpacity*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;
    #endif
    #if vtkNumComponents == 4
      vec3 tColor;
      tColor.r = tValue.r * cscale0 + cshift0;
      tColor.g = tValue.g * cscale1 + cshift1;
      tColor.b = tValue.b * cscale2 + cshift2;
      float alpha = gradientOpacity*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;
    #endif

    // lighting
    #if (vtkLightComplexity > 0)
      #ifdef vtkComputeNormalFromOpacity
        vec4 normalLight;
        if (!all(equal(normal0, vec4(0.0)))) {
          scalarInterp[0] = scalarInterp[0] * oscale0 + oshift0;
          scalarInterp[1] = scalarInterp[1] * oscale0 + oshift0;
          normalLight = computeDensityNormal(scalarInterp, 0.5, gradientOpacity);
          if (all(equal(normalLight, vec4(0.0)))) {
            normalLight = normal0;
          }
        }
      #else
        vec4 normalLight = normal0;
      #endif
      tColor = applyAllLightning(tColor, alpha, posIS, normalLight);
    #endif

    return vec4(tColor, alpha);
  #endif // dependent
#endif
}

bool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {
  bool withinRange = false;
  #if vtkNumComponents == 1
    if (val.r >= min.r && val.r <= max.r) {
      withinRange = true;
    }
  #else
    #ifdef UseIndependentComponents
      #if vtkNumComponents == 2
        if (val.r >= min.r && val.r <= max.r &&
            val.g >= min.g && val.g <= max.g) {
          withinRange = true;
        }
      #else
        if (all(greaterThanEqual(val, ipScalarRangeMin)) &&
            all(lessThanEqual(val, ipScalarRangeMax))) {
          withinRange = true;
        }
      #endif
    #endif
  #endif
  return withinRange;
}

#if vtkBlendMode == 6 
bool checkOnEdgeForNeighbor(int i, int j, int s, vec3 stepIS) {
    vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i), gl_FragCoord.y + float(j), gl_FragCoord.z, gl_FragCoord.w);
    vec3 originalNeighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);

    bool justSawIt = false;

    vec3 neighborPosIS = originalNeighborPosIS;

    float stepsTraveled = 0.0;


    // float neighborValue;
    for (int k = 0; k < //VTK::MaximumSamplesValue /2 ; ++k) {
        ivec3 texCoord = ivec3(neighborPosIS * vec3(volumeDimensions));
        vec4 texValue = texelFetch(texture1, texCoord, 0);

        if (int(texValue.g) == s) {
            justSawIt = true;
            break;
        }
        neighborPosIS += stepIS;
    }

    if (justSawIt){
      return false;
    }

   
    neighborPosIS = originalNeighborPosIS;
    for (int k = 0; k < //VTK::MaximumSamplesValue /2 ; ++k) {
        ivec3 texCoord = ivec3(neighborPosIS * vec3(volumeDimensions));
        vec4 texValue = texelFetch(texture1, texCoord, 0);

        if (int(texValue.g) == s) {
            justSawIt = true;
            break;
        }
        neighborPosIS -= stepIS;
    }


    if (!justSawIt) {
        // onedge
        vec3 tColorSegment = texture2D(ctexture, vec2(float(s) * cscale1 + cshift1, height1)).rgb;
        float pwfValueSegment = texture2D(otexture, vec2(float(s) * oscale1 + oshift1, height1)).r;
        gl_FragData[0] = vec4(tColorSegment, pwfValueSegment);
        return true;
    }

    // not on edge
    return false;
}

#endif


//=======================================================================
// Apply the specified blend mode operation along the ray's path.
//
void applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)
{
  vec3 tstep = 1.0/tdims;

  // start slightly inside and apply some jitter
  vec3 delta = endIS - posIS;
  vec3 stepIS = normalize(delta)*sampleDistanceIS;
  float raySteps = length(delta)/sampleDistanceIS;

  // Initialize arrays to false
  // avoid 0.0 jitter
  float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;
  float stepsTraveled = jitter;

  // local vars for the loop
  vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
  vec4 tValue;
  vec4 tColor;

  // if we have less than one step then pick the middle point
  // as our value
  // if (raySteps <= 1.0)
  // {
  //   posIS = (posIS + endIS)*0.5;
  // }

  // Perform initial step at the volume boundary
  // compute the scalar
  tValue = getTextureValue(posIS);
  
  #if vtkBlendMode == 6 
    if (raySteps <= 1.0)
    {
      gl_FragData[0] = getColorForValue(tValue, posIS, tstep);
      return;
    }

    vec4 value = tValue;
    posIS += (jitter*stepIS);
    vec3 maxPosIS = posIS; // Store the position of the max value
    int segmentIndex = int(value.g);
    bool originalPosHasSeenNonZero = false;

    uint bitmask = 0u;

    if (segmentIndex != 0) {
      // Tried using the segment index in an boolean array but reading 
      // from the array by dynamic indexing was horrondously slow
      // so use bit masking instead and assign 1 to the bit corresponding to the segment index
      // and later check if the bit is set via bit operations
      setBit(segmentIndex);
    }
    
    // Sample along the ray until MaximumSamplesValue,
    // ending slightly inside the total distance
    for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)
    {
      // If we have reached the last step, break
      if (stepsTraveled + 1.0 >= raySteps) { break; }

      // compute the scalar
      tValue = getTextureValue(posIS);
      segmentIndex = int(tValue.g);

      if (segmentIndex != 0) {
        originalPosHasSeenNonZero = true;
        setBit(segmentIndex);
      }

      if (tValue.r > value.r) {
        value =  tValue; // Update the max value
        maxPosIS = posIS; // Update the position where max occurred
      }

      // Otherwise, continue along the ray
      stepsTraveled++;
      posIS += stepIS;
    }

    // Perform the last step along the ray using the
    // residual distance
    posIS = endIS;
    tValue = getTextureValue(posIS);

    if (tValue.r > value.r) {
      value = tValue; // Update the max value
      maxPosIS = posIS; // Update the position where max occurred
    }  

    // If we have not seen any non-zero segments, we can return early
    // and grab color from the actual center value first component (image)
    if (!originalPosHasSeenNonZero) {
      gl_FragData[0] = getColorForValue(value, maxPosIS, tstep);
      return;
    }

    // probably we can make this configurable but for now we will use the same
    // sample distance as the original sample distance
    float neighborSampleDistanceIS = sampleDistanceIS;

    vec3 neighborRayStepsIS = stepIS;
    float neighborRaySteps = raySteps;
    bool shouldLookInAllNeighbors = false;

    float minVoxelSpacing = min(volumeSpacings[0], min(volumeSpacings[1], volumeSpacings[2]));
    vec4 base = vec4(gl_FragCoord.x, gl_FragCoord.y, gl_FragCoord.z, gl_FragCoord.w);

    vec4 baseXPlus = vec4(gl_FragCoord.x + 1.0, gl_FragCoord.y, gl_FragCoord.z, gl_FragCoord.w);
    vec4 baseYPlus = vec4(gl_FragCoord.x, gl_FragCoord.y + 1.0, gl_FragCoord.z, gl_FragCoord.w);

    vec3 baseWorld = fragCoordToWorld(base);
    vec3 baseXPlusWorld = fragCoordToWorld(baseXPlus);
    vec3 baseYPlusWorld = fragCoordToWorld(baseYPlus);

    float XPlusDiff = length(baseXPlusWorld - baseWorld);
    float YPlusDiff = length(baseYPlusWorld - baseWorld);

    float minFragSpacingWorld = min(XPlusDiff, YPlusDiff);

    for (int s = 1; s < MAX_SEGMENT_INDEX; s++) {
      // bail out quickly if the segment index has not 
      // been seen by the center segment
      if (!isBitSet(s)) {
       continue;
      }

      // Use texture sampling for outlineThickness so that we can have 
      // per segment thickness
      float textureCoordinate = float(s - 1) / 1024.0;
      float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;

      int actualThickness = int(textureValue * 255.0);

      // check the extreme points in the neighborhood since there is a better
      // chance of finding the edge there, so that we can bail out 
      // faster if we find the edge
      bool onEdge =
          checkOnEdgeForNeighbor(-actualThickness, -actualThickness, s, stepIS) ||
          checkOnEdgeForNeighbor(actualThickness, actualThickness, s, stepIS) ||
          checkOnEdgeForNeighbor(actualThickness, -actualThickness, s, stepIS) ||
          checkOnEdgeForNeighbor(-actualThickness, +actualThickness, s, stepIS);

      if (onEdge) {
        return;
      }

      // since the next step is computationally expensive, we need to perform
      // some optimizations to avoid it if possible. One of the optimizations
      // is to check the whether the minimum of the voxel spacing is greater than 
      // the 2 * the thickness of the outline segment. If that is the case
      // then we can safely skip the next step since we can be sure that the
      // the previous 4 checks on the extreme points would caught the entirety 
      // of the all the fragments inside. i.e., this happens when we zoom out, 
      if (minVoxelSpacing > (2.0 * float(actualThickness) - 1.0) * minFragSpacingWorld) {
        continue;
      }
      
      // Loop through the rest, skipping the processed extremes and the center
      for (int i = -actualThickness; i <= actualThickness; i++) {
            for (int j = -actualThickness; j <= actualThickness; j++) {
                if (i == 0 && j == 0) continue; // Skip the center
                if (abs(i) == actualThickness && abs(j) == actualThickness) continue; // Skip corners
                if (checkOnEdgeForNeighbor(i, j, s, stepIS )) {
                    return;
                }
          }
      }
    }

    vec3 tColor0 = texture2D(ctexture, vec2(value.r * cscale0 + cshift0, height0)).rgb;
    float pwfValue0 = texture2D(otexture, vec2(value.r * oscale0 + oshift0, height0)).r;
    gl_FragData[0] = vec4(tColor0, pwfValue0);
  #endif
  #if vtkBlendMode == 0 // COMPOSITE_BLEND
    // now map through opacity and color
    tColor = getColorForValue(tValue, posIS, tstep);

    // handle very thin volumes
    if (raySteps <= 1.0)
    {
      tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);
      gl_FragData[0] = tColor;
      return;
    }

    tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);
    color = vec4(tColor.rgb*tColor.a, tColor.a);
    posIS += (jitter*stepIS);

    for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)
    {
      if (stepsTraveled + 1.0 >= raySteps) { break; }

      // compute the scalar
      tValue = getTextureValue(posIS);

      // now map through opacity and color
      tColor = getColorForValue(tValue, posIS, tstep);

      float mix = (1.0 - color.a);

      // this line should not be needed but nvidia seems to not handle
      // the break correctly on windows/chrome 58 angle
      //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));

      color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;
      stepsTraveled++;
      posIS += stepIS;
      if (color.a > 0.99) { color.a = 1.0; break; }
    }

    if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)
    {
      posIS = endIS;

      // compute the scalar
      tValue = getTextureValue(posIS);

      // now map through opacity and color
      tColor = getColorForValue(tValue, posIS, tstep);
      tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);

      float mix = (1.0 - color.a);
      color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;
    }

    gl_FragData[0] = vec4(color.rgb/color.a, color.a);
  #endif
  #if vtkBlendMode == 1 || vtkBlendMode == 2
    // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND
    // Find maximum/minimum intensity along the ray.

    // Define the operation we will use (min or max)
    #if vtkBlendMode == 1
    #define OP max
    #else
    #define OP min
    #endif

    // If the clipping range is shorter than the sample distance
    // we can skip the sampling loop along the ray.
    if (raySteps <= 1.0)
    {
      gl_FragData[0] = getColorForValue(tValue, posIS, tstep);
      return;
    }

    vec4 value = tValue;
    posIS += (jitter*stepIS);

    // Sample along the ray until MaximumSamplesValue,
    // ending slightly inside the total distance
    for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)
    {
      // If we have reached the last step, break
      if (stepsTraveled + 1.0 >= raySteps) { break; }

      // compute the scalar
      tValue = getTextureValue(posIS);

      // Update the maximum value if necessary
      value = OP(tValue, value);

      // Otherwise, continue along the ray
      stepsTraveled++;
      posIS += stepIS;
    }

    // Perform the last step along the ray using the
    // residual distance
    posIS = endIS;
    tValue = getTextureValue(posIS);
    value = OP(tValue, value);

    // Now map through opacity and color
    gl_FragData[0] = getColorForValue(value, posIS, tstep);
  #endif
  #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND
    vec4 sum = vec4(0.);

    if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {
      sum += tValue;
    }

    if (raySteps <= 1.0) {
      gl_FragData[0] = getColorForValue(sum, posIS, tstep);
      return;
    }

    posIS += (jitter*stepIS);

    // Sample along the ray until MaximumSamplesValue,
    // ending slightly inside the total distance
    for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)
    {
      // If we have reached the last step, break
      if (stepsTraveled + 1.0 >= raySteps) { break; }

      // compute the scalar
      tValue = getTextureValue(posIS);

      // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.
      // Notes:
      // - We are comparing all values in the texture to see if any of them
      //   are outside of the scalar range. In the future we might want to allow
      //   scalar ranges for each component.
      if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {
        // Sum the values across each step in the path
        sum += tValue;
      }
      stepsTraveled++;
      posIS += stepIS;
    }

    // Perform the last step along the ray using the
    // residual distance
    posIS = endIS;

    // compute the scalar
    tValue = getTextureValue(posIS);

    // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation
    if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {
      sum += tValue;

      stepsTraveled++;
    }

    #if vtkBlendMode == 3 // Average
      sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);
    #endif

    gl_FragData[0] = getColorForValue(sum, posIS, tstep);
  #endif
  #if vtkBlendMode == 5 // RADON
    float normalizedRayIntensity = 1.0;

    // handle very thin volumes
    if (raySteps <= 1.0)
    {
      tValue = getTextureValue(posIS);
      normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;
      gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));
      return;
    }

    posIS += (jitter*stepIS);

    for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)
    {
      if (stepsTraveled + 1.0 >= raySteps) { break; }

      // compute the scalar value
      tValue = getTextureValue(posIS);

      // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity
      normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;

      posIS += stepIS;
      stepsTraveled++;
    }

    // map normalizedRayIntensity to color
    gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));

  #endif
}

//=======================================================================
// Compute a new start and end point for a given ray based
// on the provided bounded clipping plane (aka a rectangle)
void getRayPointIntersectionBounds(
  vec3 rayPos, vec3 rayDir,
  vec3 planeDir, float planeDist,
  inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,
  float vSize1, float vSize2)
{
  float result = dot(rayDir, planeDir);
  if (abs(result) < 1e-6)
  {
    return;
  }
  result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;
  vec3 xposVC = rayPos + rayDir*result;
  vec3 vxpos = xposVC - vOriginVC;
  vec2 vpos = vec2(
    dot(vxpos, vPlaneX),
    dot(vxpos, vPlaneY));

  // on some apple nvidia systems this does not work
  // if (vpos.x < 0.0 || vpos.x > vSize1 ||
  //     vpos.y < 0.0 || vpos.y > vSize2)
  // even just
  // if (vpos.x < 0.0 || vpos.y < 0.0)
  // fails
  // so instead we compute a value that represents in and out
  //and then compute the return using this value
  float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); //  0 means in bounds
  float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); //  0 means in bounds, 1 = out

  tbounds = mix(
   vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value
   tbounds, // out value
   check);  // 0 in 1 out
}

//=======================================================================
// given a
// - ray direction (rayDir)
// - starting point (vertexVCVSOutput)
// - bounding planes of the volume
// - optionally depth buffer values
// - far clipping plane
// compute the start/end distances of the ray we need to cast
vec2 computeRayDistances(vec3 rayDir, vec3 tdims)
{
  vec2 dists = vec2(100.0*camFar, -1.0);

  vec3 vSize = vSpacing*tdims;

  // all this is in View Coordinates
  getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,
    vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,
    vSize.y, vSize.z);
  getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,
    vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,
    vSize.y, vSize.z);
  getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,
    vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,
    vSize.x, vSize.z);
  getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,
    vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,
    vSize.x, vSize.z);
  getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,
    vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,
    vSize.x, vSize.y);
  getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,
    vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,
    vSize.x, vSize.y);

  //VTK::ClipPlane::Impl

  // do not go behind front clipping plane
  dists.x = max(0.0,dists.x);

  // do not go PAST far clipping plane
  float farDist = -camThick/rayDir.z;
  dists.y = min(farDist,dists.y);

  // Do not go past the zbuffer value if set
  // This is used for intermixing opaque geometry
  //VTK::ZBuffer::Impl

  return dists;
}

//=======================================================================
// Compute the index space starting position (pos) and end
// position
//
void computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)
{
  // compute starting and ending values in volume space
  pos = vertexVCVSOutput + dists.x*rayDir;
  pos = pos - vOriginVC;
  // convert to volume basis and origin
  pos = vec3(
    dot(pos, vPlaneNormal0),
    dot(pos, vPlaneNormal2),
    dot(pos, vPlaneNormal4));

  endPos = vertexVCVSOutput + dists.y*rayDir;
  endPos = endPos - vOriginVC;
  endPos = vec3(
    dot(endPos, vPlaneNormal0),
    dot(endPos, vPlaneNormal2),
    dot(endPos, vPlaneNormal4));

  float delta = length(endPos - pos);

  pos *= vVCToIJK;
  endPos *= vVCToIJK;

  float delta2 = length(endPos - pos);
  sampleDistanceIS = sampleDistance*delta2/delta;
  #ifdef VolumeShadowOn
    sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;
  #endif
}

void main()
{

  if (cameraParallel == 1)
  {
    // Camera is parallel, so the rayDir is just the direction of the camera.
    rayDirVC = vec3(0.0, 0.0, -1.0);
  } else {
    // camera is at 0,0,0 so rayDir for perspective is just the vc coord
    rayDirVC = normalize(vertexVCVSOutput);
  }

  vec3 tdims = vec3(volumeDimensions);

  // compute the start and end points for the ray
  vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);

  // do we need to composite? aka does the ray have any length
  // If not, bail out early
  if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)
  {
    discard;
  }

  // IS = Index Space
  vec3 posIS;
  vec3 endIS;
  computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);

  // Perform the blending operation along the ray
  applyBlend(posIS, endIS, tdims);
}
`;const{vtkWarningMacro:H6t,vtkErrorMacro:kR}=Rs;function q6t(t){switch(t){case LC.CUSTOM:return"//VTK::CustomColorMix";case LC.ADDITIVE:return`
        // compute normals
        mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);
        #if (vtkLightComplexity > 0) && defined(vtkComputeNormalFromOpacity)
          vec3 scalarInterp0[2];
          vec4 normalLight0 = computeNormalForDensity(posIS, tstep, scalarInterp0, 0);
          scalarInterp0[0] = scalarInterp0[0] * oscale0 + oshift0;
          scalarInterp0[1] = scalarInterp0[1] * oscale0 + oshift0;
          normalLight0 = computeDensityNormal(scalarInterp0, height0, 1.0);

          vec3 scalarInterp1[2];
          vec4 normalLight1 = computeNormalForDensity(posIS, tstep, scalarInterp1, 1);
          scalarInterp1[0] = scalarInterp1[0] * oscale1 + oshift1;
          scalarInterp1[1] = scalarInterp1[1] * oscale1 + oshift1;
          normalLight1 = computeDensityNormal(scalarInterp1, height1, 1.0);
        #else
          vec4 normalLight0 = normalMat[0];
          vec4 normalLight1 = normalMat[1];
        #endif

        // compute opacities
        float opacity0 = pwfValue0;
        float opacity1 = pwfValue1;
        #ifdef vtkGradientOpacityOn
          float gof0 = computeGradientOpacityFactor(normalMat[0].a, goscale0, goshift0, gomin0, gomax0);
          opacity0 *= gof0;
          float gof1 = computeGradientOpacityFactor(normalMat[1].a, goscale1, goshift1, gomin1, gomax1);
          opacity1 *= gof1;
        #endif
        float opacitySum = opacity0 + opacity1;
        if (opacitySum <= 0.0) {
          return vec4(0.0);
        }

        // mix the colors and opacities
        tColor0 = applyAllLightning(tColor0, opacity0, posIS, normalLight0);
        tColor1 = applyAllLightning(tColor1, opacity1, posIS, normalLight1);
        vec3 mixedColor = (opacity0 * tColor0 + opacity1 * tColor1) / opacitySum;
        return vec4(mixedColor, min(1.0, opacitySum));
`;case LC.COLORIZE:return`
        // compute normals
        mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);
        #if (vtkLightComplexity > 0) && defined(vtkComputeNormalFromOpacity)
          vec3 scalarInterp0[2];
          vec4 normalLight0 = computeNormalForDensity(posIS, tstep, scalarInterp0, 0);
          scalarInterp0[0] = scalarInterp0[0] * oscale0 + oshift0;
          scalarInterp0[1] = scalarInterp0[1] * oscale0 + oshift0;
          normalLight0 = computeDensityNormal(scalarInterp0, height0, 1.0);
        #else
          vec4 normalLight0 = normalMat[0];
        #endif

        // compute opacities
        float opacity0 = pwfValue0;
        #ifdef vtkGradientOpacityOn
          float gof0 = computeGradientOpacityFactor(normalMat[0].a, goscale0, goshift0, gomin0, gomax0);
          opacity0 *= gof0;
        #endif

        // mix the colors and opacities
        vec3 color = tColor0 * mix(vec3(1.0), tColor1, pwfValue1);
        color = applyAllLightning(color, opacity0, posIS, normalLight0);
        return vec4(color, opacity0);
`;default:return null}}function K6t(t,e){e.classHierarchy.push("vtkOpenGLVolumeMapper");function n(i){[e._scalars,e._scalarOpacityFunc,e._colorTransferFunc,e._labelOutlineThicknessArray].forEach(a=>i.unregisterGraphicsResourceUser(a,t))}t.buildPass=()=>{e.zBufferTexture=null},t.zBufferPass=(i,a)=>{if(i){const o=a.getZBufferTexture();o!==e.zBufferTexture&&(e.zBufferTexture=o)}},t.opaqueZBufferPass=(i,a)=>t.zBufferPass(i,a),t.volumePass=(i,a)=>{if(i){const o=e._openGLRenderWindow;e._openGLRenderWindow=t.getLastAncestorOfType("vtkOpenGLRenderWindow"),o&&!o.isDeleted()&&o!==e._openGLRenderWindow&&n(o),e.context=e._openGLRenderWindow.getContext(),e.tris.setOpenGLRenderWindow(e._openGLRenderWindow),e.jitterTexture.setOpenGLRenderWindow(e._openGLRenderWindow),e.framebuffer.setOpenGLRenderWindow(e._openGLRenderWindow),e.openGLVolume=t.getFirstAncestorOfType("vtkOpenGLVolume");const s=e.openGLVolume.getRenderable();e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer");const c=e._openGLRenderer.getRenderable();e.openGLCamera=e._openGLRenderer.getViewNodeFor(c.getActiveCamera()),t.renderPiece(c,s)}},t.getShaderTemplate=(i,a,o)=>{i.Vertex=G6t,i.Fragment=W6t,i.Geometry=""},t.useIndependentComponents=i=>{const a=i.getIndependentComponents(),s=e.currentInput?.getPointData()?.getScalars()?.getNumberOfComponents(),c=i.getColorMixPreset();return a&&s>=2||!!c},t.replaceShaderValues=(i,a,o)=>{const s=o.getProperty();let c=i.Fragment;s.getInterpolationType()===lk.LINEAR&&(c=Ie.substitute(c,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),t.isLabelmapOutlineRequired(o)===!0&&(c=Ie.substitute(c,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result),e.renderable.getBlendMode()===wC.LABELMAP_EDGE_PROJECTION_BLEND&&(c=Ie.substitute(c,"//VTK::LabelEdgeProjectionOn","#define vtkLabelEdgeProjectionOn").result);const d=e.scalarTexture.getComponents();c=Ie.substitute(c,"//VTK::NumComponents",`#define vtkNumComponents ${d}`).result;const h=t.useIndependentComponents(s);h&&(c=Ie.substitute(c,"//VTK::IndependentComponentsOn","#define UseIndependentComponents").result);const m=[],p=[];for(let M=0;M<d;M++)s.getOpacityMode(M)===b5e.PROPORTIONAL&&m.push(`#define vtkComponent${M}Proportional`),s.getForceNearestInterpolation(M)&&p.push(`#define vtkComponent${M}ForceNearest`);c=Ie.substitute(c,"//VTK::vtkProportionalComponents",m.join(`
`)).result,c=Ie.substitute(c,"//VTK::vtkForceNearestComponents",p.join(`
`)).result;const y=s.getColorMixPreset(),x=q6t(y);x&&(c=Ie.substitute(c,"//VTK::CustomComponentsColorMixOn","#define vtkCustomComponentsColorMix").result,c=Ie.substitute(c,"//VTK::CustomComponentsColorMix::Impl",x).result);const S=e.currentInput.getSpatialExtent(),C=e.currentInput.getSpacing(),_=new Float64Array(3);_r(_,(S[1]-S[0])*C[0],(S[3]-S[2])*C[1],(S[5]-S[4])*C[2]);const T=ec(_)/t.getCurrentSampleDistance(a);c=Ie.substitute(c,"//VTK::MaximumSamplesValue",`${Math.ceil(T)}`).result,c=Ie.substitute(c,"//VTK::LightComplexity",`#define vtkLightComplexity ${e.lightComplexity}`).result,e.lightComplexity>0&&(e.renderable.getVolumetricScatteringBlending()>0&&(c=Ie.substitute(c,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),e.renderable.getVolumetricScatteringBlending()<1&&(c=Ie.substitute(c,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),e.renderable.getLocalAmbientOcclusion()&&s.getAmbient()>0&&(c=Ie.substitute(c,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result));const O=h?d:1;e.gopacity=!1;for(let M=0;!e.gopacity&&M<O;++M)e.gopacity||=s.getUseGradientOpacity(M);e.gopacity&&(c=Ie.substitute(c,"//VTK::GradientOpacityOn","#define vtkGradientOpacityOn").result),e.renderable.getComputeNormalFromOpacity()&&(c=Ie.substitute(c,"//VTK::vtkComputeNormalFromOpacity","#define vtkComputeNormalFromOpacity").result),e.zBufferTexture!==null&&(c=Ie.substitute(c,"//VTK::ZBuffer::Dec",["uniform sampler2D zBufferTexture;","uniform float vpZWidth;","uniform float vpZHeight;"]).result,c=Ie.substitute(c,"//VTK::ZBuffer::Impl",["vec4 depthVec = texture2D(zBufferTexture, vec2(gl_FragCoord.x / vpZWidth, gl_FragCoord.y/vpZHeight));","float zdepth = (depthVec.r*256.0 + depthVec.g)/257.0;","zdepth = zdepth * 2.0 - 1.0;","if (cameraParallel == 0) {","zdepth = -2.0 * camFar * camNear / (zdepth*(camFar-camNear)-(camFar+camNear)) - camNear;}","else {",`zdepth = (zdepth + 1.0) * 0.5 * (camFar - camNear);}
`,"zdepth = -zdepth/rayDir.z;","dists.y = min(zdepth,dists.y);"]).result),c=Ie.substitute(c,"//VTK::BlendMode",`${e.renderable.getBlendMode()}`).result,i.Fragment=c,t.replaceShaderLight(i,a,o),t.replaceShaderClippingPlane(i,a,o)},t.replaceShaderLight=(i,a,o)=>{if(e.lightComplexity===0)return;let s=i.Fragment,c=0;a.getLights().forEach(l=>{l.getSwitch()&&(c+=1)}),s=Ie.substitute(s,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${c}];`,`uniform vec3 lightDirectionVC[${c}]; // normalized`,`uniform vec3 lightHalfAngleVC[${c}];`,"//VTK::Light::Dec"],!1).result,e.lightComplexity===3&&(s=Ie.substitute(s,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${c}];`,`uniform vec3 lightAttenuation[${c}];`,`uniform float lightConeAngle[${c}];`,`uniform float lightExponent[${c}];`,`uniform int lightPositional[${c}];`],!1).result),e.renderable.getVolumetricScatteringBlending()>0&&(s=Ie.substitute(s,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),e.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(s=Ie.substitute(s,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${e.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),i.Fragment=s},t.replaceShaderClippingPlane=(i,a,o)=>{let s=i.Fragment;if(e.renderable.getClippingPlanes().length>0){const c=e.renderable.getClippingPlanes().length;s=Ie.substitute(s,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,s=Ie.substitute(s,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${c}; i++) {`,"  float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);","  float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];","  if (rayDirRatio == 0.0)","  {","    if (equationResult < 0.0) dists.x = dists.y;","    continue;","  }","  float result = -1.0 * equationResult / rayDirRatio;","  if (rayDirRatio < 0.0) dists.y = min(dists.y, result);","  else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}i.Fragment=s};const r=(i,a)=>{let o=0;i.getProperty().getShade()&&e.renderable.getBlendMode()===wC.COMPOSITE_BLEND&&(o=0,e.numberOfLights=0,a.forEach(s=>{s.getSwitch()>0&&(e.numberOfLights++,o===0&&(o=1)),o===1&&(e.numberOfLights>1||s.getIntensity()!==1||!s.lightTypeIsHeadLight())&&(o=2),o<3&&s.getPositional()&&(o=3)})),o!==e.lightComplexity&&(e.lightComplexity=o,t.modified())};t.getNeedToRebuildShaders=(i,a,o)=>{const s=o.getProperty();r(o,a.getLights());const c=e.scalarTexture.getComponents(),l=[],u=[];for(let x=0;x<c;x++)l.push(s.getOpacityMode(x)),u.push(s.getForceNearestInterpolation(x));const f=e.currentInput.getSpatialExtent(),d=e.currentInput.getSpacing(),h=new Float64Array(3);_r(h,(f[1]-f[0])*d[0],(f[3]-f[2])*d[1],(f[5]-f[4])*d[2]);const m=ec(h)/t.getCurrentSampleDistance(a),p=!!e.zBufferTexture,y={iComps:s.getIndependentComponents(),colorMixPreset:s.getColorMixPreset(),interpolationType:s.getInterpolationType(),useLabelOutline:t.isLabelmapOutlineRequired(o),numComp:c,maxSamples:m,useGradientOpacity:s.getUseGradientOpacity(0),blendMode:e.renderable.getBlendMode(),hasZBufferTexture:p,opacityModes:l,forceNearestInterps:u};return i.getProgram()?.getHandle()===0||i.getShaderSourceTime().getMTime()<t.getMTime()||i.getShaderSourceTime().getMTime()<e.renderable.getMTime()||!e.previousState||!_U(e.previousState,y)?(e.previousState=y,!0):!1},t.updateShaders=(i,a,o)=>{if(t.getNeedToRebuildShaders(i,a,o)){const s={Vertex:null,Fragment:null,Geometry:null};t.buildShaders(s,a,o);const c=e._openGLRenderWindow.getShaderCache().readyShaderProgramArray(s.Vertex,s.Fragment,s.Geometry);c!==i.getProgram()&&(i.setProgram(c),i.getVAO().releaseGraphicsResources()),i.getShaderSourceTime().modified()}else e._openGLRenderWindow.getShaderCache().readyShaderProgram(i.getProgram());i.getVAO().bind(),t.setMapperShaderParameters(i,a,o),t.setCameraShaderParameters(i,a,o),t.setPropertyShaderParameters(i,a,o),t.getClippingPlaneShaderParameters(i,a,o)},t.setMapperShaderParameters=(i,a,o)=>{const s=i.getProgram();i.getCABO().getElementCount()&&(e.VBOBuildTime.getMTime()>i.getAttributeUpdateTime().getMTime()||i.getShaderSourceTime().getMTime()>i.getAttributeUpdateTime().getMTime())&&(s.isAttributeUsed("vertexDC")&&(i.getVAO().addAttributeArray(s,i.getCABO(),"vertexDC",i.getCABO().getVertexOffset(),i.getCABO().getStride(),e.context.FLOAT,3,e.context.FALSE)||kR("Error setting vertexDC in shader VAO.")),i.getAttributeUpdateTime().modified()),s.setUniformi("texture1",e.scalarTexture.getTextureUnit()),s.setUniformf("sampleDistance",t.getCurrentSampleDistance(a));const c=e.scalarTexture.getVolumeInfo(),l=e.renderable.getIpScalarRange();if(c?.dataComputedScale?.length){const u=[],f=[];for(let d=0;d<4;d++)u[d]=l[0]*c.dataComputedScale[d]+c.dataComputedOffset[d],f[d]=l[1]*c.dataComputedScale[d]+c.dataComputedOffset[d],u[d]=(u[d]-c.offset[d])/c.scale[d],f[d]=(f[d]-c.offset[d])/c.scale[d];s.setUniform4f("ipScalarRangeMin",u[0],u[1],u[2],u[3]),s.setUniform4f("ipScalarRangeMax",f[0],f[1],f[2],f[3])}if(e.zBufferTexture!==null){s.setUniformi("zBufferTexture",e.zBufferTexture.getTextureUnit());const u=e._useSmallViewport?[e._smallViewportWidth,e._smallViewportHeight]:e._openGLRenderWindow.getFramebufferSize();s.setUniformf("vpZWidth",u[0]),s.setUniformf("vpZHeight",u[1])}},t.setCameraShaderParameters=(i,a,o)=>{const s=e.openGLCamera.getKeyMatrices(a),c=e.openGLVolume.getKeyMatrices();Xn(e.modelToView,s.wcvc,c.mcwc);const l=i.getProgram(),u=e.openGLCamera.getRenderable(),f=u.getClippingRange();l.setUniformf("camThick",f[1]-f[0]),l.setUniformf("camNear",f[0]),l.setUniformf("camFar",f[1]);const d=e.currentInput.getBounds(),h=e.currentInput.getDimensions(),m=new Float64Array(3),p=new Float64Array(3);let y=1,x=-1,S=1,C=-1;for(let U=0;U<8;++U){if(_r(m,d[U%2],d[2+Math.floor(U/2)%2],d[4+Math.floor(U/4)]),gr(m,m,e.modelToView),!u.getParallelProjection()){Vr(p,m);const Y=-f[0]/m[2];gd(m,p,Y)}gr(m,m,s.vcpc),y=Math.min(m[0],y),x=Math.max(m[0],x),S=Math.min(m[1],S),C=Math.max(m[1],C)}l.setUniformf("dcxmin",y),l.setUniformf("dcxmax",x),l.setUniformf("dcymin",S),l.setUniformf("dcymax",C),l.isUniformUsed("cameraParallel")&&l.setUniformi("cameraParallel",u.getParallelProjection());const _=e.currentInput.getSpatialExtent(),T=e.currentInput.getSpacing(),O=new Float64Array(3);_r(O,(_[1]-_[0])*T[0],(_[3]-_[2])*T[1],(_[5]-_[4])*T[2]),l.setUniform3f("vSpacing",T[0],T[1],T[2]),_r(m,_[0],_[2],_[4]),e.currentInput.indexToWorldVec3(m,m),gr(m,m,e.modelToView),l.setUniform3f("vOriginVC",m[0],m[1],m[2]);const M=e.currentInput.getIndexToWorld();Xn(e.idxToView,e.modelToView,M),zy(e.idxNormalMatrix,s.normalMatrix,c.normalMatrix),zy(e.idxNormalMatrix,e.idxNormalMatrix,e.currentInput.getDirectionByReference());const I=ec(O)/t.getCurrentSampleDistance(a);I>e.renderable.getMaximumSamplesPerRay()&&H6t(`The number of steps required ${Math.ceil(I)} is larger than the
        specified maximum number of steps ${e.renderable.getMaximumSamplesPerRay()}.
        Please either change the
        volumeMapper sampleDistance or its maximum number of samples.`);const V=new Float64Array(3);if(_r(V,1,1,1),xSt(V,V,O),l.setUniform3f("vVCToIJK",V[0],V[1],V[2]),l.setUniform3i("volumeDimensions",h[0],h[1],h[2]),l.setUniform3f("volumeSpacings",T[0],T[1],T[2]),!e._openGLRenderWindow.getWebgl2()){const U=e.scalarTexture.getVolumeInfo();l.setUniformf("texWidth",e.scalarTexture.getWidth()),l.setUniformf("texHeight",e.scalarTexture.getHeight()),l.setUniformi("xreps",U.xreps),l.setUniformi("xstride",U.xstride),l.setUniformi("ystride",U.ystride)}const k=new Float64Array(3),L=new Float64Array(3);for(let U=0;U<6;++U){switch(U){case 1:_r(k,-1,0,0),_r(L,_[0],_[2],_[4]);break;case 2:_r(k,0,1,0),_r(L,_[1],_[3],_[5]);break;case 3:_r(k,0,-1,0),_r(L,_[0],_[2],_[4]);break;case 4:_r(k,0,0,1),_r(L,_[1],_[3],_[5]);break;case 5:_r(k,0,0,-1),_r(L,_[0],_[2],_[4]);break;case 0:default:_r(k,1,0,0),_r(L,_[1],_[3],_[5]);break}NC(k,k,e.idxNormalMatrix),gr(L,L,e.idxToView);const Y=-1*Vt(L,k);l.setUniform3f(`vPlaneNormal${U}`,k[0],k[1],k[2]),l.setUniformf(`vPlaneDistance${U}`,Y)}if(t.isLabelmapOutlineRequired(o)){const Y=e.currentInput.getWorldToIndex();l.setUniformMatrix("vWCtoIDX",Y);const J=a.getActiveCamera(),[ne,F]=J.getClippingRange(),ae=J.getDistance();J.setClippingRange(ae,ae+.1);const re=e.openGLCamera.getKeyMatrices(a);Na(e.projectionToWorld,re.wcpc),J.setClippingRange(ne,F),e.openGLCamera.getKeyMatrices(a),l.setUniformMatrix("PCWCMatrix",e.projectionToWorld);const te=t.getRenderTargetSize();l.setUniformf("vpWidth",te[0]),l.setUniformf("vpHeight",te[1]);const ye=t.getRenderTargetOffset();l.setUniformf("vpOffsetX",ye[0]/te[0]),l.setUniformf("vpOffsetY",ye[1]/te[1])}if(Na(e.projectionToView,s.vcpc),l.setUniformMatrix("PCVCMatrix",e.projectionToView),e.lightComplexity===0)return;let $=0;const W=[],G=[],oe=[];if(a.getLights().forEach(U=>{if(U.getSwitch()>0){const J=U.getColor(),ne=U.getIntensity();W[0+$*3]=J[0]*ne,W[1+$*3]=J[1]*ne,W[2+$*3]=J[2]*ne;const F=U.getDirection();_r(k,F[0],F[1],F[2]),NC(k,k,s.normalMatrix),Vr(k,k),G[0+$*3]=k[0],G[1+$*3]=k[1],G[2+$*3]=k[2],oe[0+$*3]=-.5*k[0],oe[1+$*3]=-.5*k[1],oe[2+$*3]=-.5*(k[2]-1),$++}}),l.setUniformi("twoSidedLighting",a.getTwoSidedLighting()),l.setUniformi("lightNum",$),l.setUniform3fv("lightColor",W),l.setUniform3fv("lightDirectionVC",G),l.setUniform3fv("lightHalfAngleVC",oe),e.lightComplexity===3){$=0;const U=[],Y=[],J=[],ne=[],F=[];a.getLights().forEach(ae=>{if(ae.getSwitch()>0){const te=ae.getAttenuationValues();Y[0+$*3]=te[0],Y[1+$*3]=te[1],Y[2+$*3]=te[2],ne[$]=ae.getExponent(),J[$]=ae.getConeAngle(),F[$]=ae.getPositional();const ye=ae.getTransformedPosition();gr(ye,ye,e.modelToView),U[0+$*3]=ye[0],U[1+$*3]=ye[1],U[2+$*3]=ye[2],$+=1}}),l.setUniform3fv("lightPositionVC",U),l.setUniform3fv("lightAttenuation",Y),l.setUniformfv("lightConeAngle",J),l.setUniformfv("lightExponent",ne),l.setUniformiv("lightPositional",F)}if(e.renderable.getVolumetricScatteringBlending()>0&&(l.setUniformf("giReach",e.renderable.getGlobalIlluminationReach()),l.setUniformf("volumetricScatteringBlending",e.renderable.getVolumetricScatteringBlending()),l.setUniformf("volumeShadowSamplingDistFactor",e.renderable.getVolumeShadowSamplingDistFactor()),l.setUniformf("anisotropy",e.renderable.getAnisotropy()),l.setUniformf("anisotropy2",e.renderable.getAnisotropy()**2)),e.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const U=e.renderable.getLAOKernelSize();l.setUniformi("kernelSize",U);const Y=[];for(let J=0;J<U;J++)Y[J*2]=Math.random()*.5,Y[J*2+1]=Math.random()*.5;l.setUniform2fv("kernelSample",Y),l.setUniformi("kernelRadius",e.renderable.getLAOKernelRadius())}},t.setPropertyShaderParameters=(i,a,o)=>{const s=i.getProgram();s.setUniformi("ctexture",e.colorTexture.getTextureUnit()),s.setUniformi("otexture",e.opacityTexture.getTextureUnit()),s.setUniformi("jtexture",e.jitterTexture.getTextureUnit()),s.setUniformi("ttexture",e.labelOutlineThicknessTexture.getTextureUnit());const c=e.scalarTexture.getVolumeInfo(),l=o.getProperty(),u=e.scalarTexture.getComponents(),f=t.useIndependentComponents(l);if(f)for(let h=0;h<u;h++)s.setUniformf(`mix${h}`,o.getProperty().getComponentWeight(h));for(let h=0;h<u;h++){const m=f?h:0,p=c.scale[h],x=l.getScalarOpacity(m).getRange(),S=p/(x[1]-x[0]),C=(c.offset[h]-x[0])/(x[1]-x[0]);s.setUniformf(`oshift${h}`,C),s.setUniformf(`oscale${h}`,S);const T=l.getRGBTransferFunction(m).getRange(),O=(c.offset[h]-T[0])/(T[1]-T[0]),M=p/(T[1]-T[0]);s.setUniformf(`cshift${h}`,O),s.setUniformf(`cscale${h}`,M)}if(e.gopacity)if(f)for(let h=0;h<u;++h){const m=c.scale[h];if(l.getUseGradientOpacity(h)){const y=l.getGradientOpacityMinimumOpacity(h),x=l.getGradientOpacityMaximumOpacity(h);s.setUniformf(`gomin${h}`,y),s.setUniformf(`gomax${h}`,x);const S=[l.getGradientOpacityMinimumValue(h),l.getGradientOpacityMaximumValue(h)];s.setUniformf(`goscale${h}`,m*(x-y)/(S[1]-S[0])),s.setUniformf(`goshift${h}`,-S[0]*(x-y)/(S[1]-S[0])+y)}else s.setUniformf(`gomin${h}`,1),s.setUniformf(`gomax${h}`,1),s.setUniformf(`goscale${h}`,0),s.setUniformf(`goshift${h}`,1)}else{const h=c.scale[u-1],m=l.getGradientOpacityMinimumOpacity(0),p=l.getGradientOpacityMaximumOpacity(0);s.setUniformf("gomin0",m),s.setUniformf("gomax0",p);const y=[l.getGradientOpacityMinimumValue(0),l.getGradientOpacityMaximumValue(0)];s.setUniformf("goscale0",h*(p-m)/(y[1]-y[0])),s.setUniformf("goshift0",-y[0]*(p-m)/(y[1]-y[0])+m)}if(t.isLabelmapOutlineRequired(o)===!0){const h=o.getProperty().getLabelOutlineOpacity();s.setUniformf("outlineOpacity",h)}e.lightComplexity>0&&(s.setUniformf("vAmbient",l.getAmbient()),s.setUniformf("vDiffuse",l.getDiffuse()),s.setUniformf("vSpecular",l.getSpecular()),s.setUniformf("vSpecularPower",l.getSpecularPower()))},t.getClippingPlaneShaderParameters=(i,a,o)=>{if(e.renderable.getClippingPlanes().length>0){const s=e.openGLCamera.getKeyMatrices(a),c=[],l=[],u=[],f=e.renderable.getClippingPlanes(),d=f.length;for(let m=0;m<d;++m){const p=f[m].getNormal(),y=f[m].getOrigin();NC(p,p,s.normalMatrix),gr(y,y,s.wcvc);const x=-1*Vt(y,p);c.push(p[0]),c.push(p[1]),c.push(p[2]),l.push(x),u.push(y[0]),u.push(y[1]),u.push(y[2])}const h=i.getProgram();h.setUniform3fv("vClipPlaneNormals",c),h.setUniformfv("vClipPlaneDistances",l),h.setUniform3fv("vClipPlaneOrigins",u),h.setUniformi("clip_numPlanes",d)}},t.delete=u3(()=>{e._animationRateSubscription&&(e._animationRateSubscription.unsubscribe(),e._animationRateSubscription=null)},()=>{e._openGLRenderWindow&&n(e._openGLRenderWindow)},t.delete),t.getRenderTargetSize=()=>{if(e._useSmallViewport)return[e._smallViewportWidth,e._smallViewportHeight];const{usize:i,vsize:a}=e._openGLRenderer.getTiledSizeAndOrigin();return[i,a]},t.getRenderTargetOffset=()=>{const{lowerLeftU:i,lowerLeftV:a}=e._openGLRenderer.getTiledSizeAndOrigin();return[i,a]},t.getCurrentSampleDistance=i=>{const a=i.getVTKWindow().getInteractor(),o=e.renderable.getSampleDistance();if(a.isAnimating()){const s=e.renderable.getInteractionSampleDistanceFactor();return o*s}return o},t.renderPieceStart=(i,a)=>{const o=i.getVTKWindow().getInteractor();if(e._lastScale||(e._lastScale=e.renderable.getInitialInteractionScale()),e._useSmallViewport=!1,o.isAnimating()&&e._lastScale>1.5&&(e._useSmallViewport=!0),e._animationRateSubscription||(e._animationRateSubscription=o.onAnimationFrameRateUpdate(()=>{if(e.renderable.getAutoAdjustSampleDistances()){const c=o.getRecentAnimationFrameRate(),l=o.getDesiredUpdateRate()/c;(l>1.15||l<.85)&&(e._lastScale*=l),e._lastScale>400&&(e._lastScale=400),e._lastScale<1.5&&(e._lastScale=1.5)}else e._lastScale=e.renderable.getImageSampleDistance()*e.renderable.getImageSampleDistance()})),e._useSmallViewport){const c=e._openGLRenderWindow.getFramebufferSize(),l=1/Math.sqrt(e._lastScale);if(e._smallViewportWidth=Math.ceil(l*c[0]),e._smallViewportHeight=Math.ceil(l*c[1]),e._smallViewportHeight>c[1]&&(e._smallViewportHeight=c[1]),e._smallViewportWidth>c[0]&&(e._smallViewportWidth=c[0]),e.framebuffer.saveCurrentBindingsAndBuffers(),e.framebuffer.getGLFramebuffer()===null)e.framebuffer.create(c[0],c[1]),e.framebuffer.populateFramebuffer();else{const f=e.framebuffer.getSize();(!f||f[0]!==c[0]||f[1]!==c[1])&&(e.framebuffer.create(c[0],c[1]),e.framebuffer.populateFramebuffer())}e.framebuffer.bind();const u=e.context;u.clearColor(0,0,0,0),u.colorMask(!0,!0,!0,!0),u.clear(u.COLOR_BUFFER_BIT),u.viewport(0,0,e._smallViewportWidth,e._smallViewportHeight),e.fvp=[e._smallViewportWidth/c[0],e._smallViewportHeight/c[1]]}e.context.disable(e.context.DEPTH_TEST),t.updateBufferObjects(i,a),a.getProperty().getInterpolationType()===lk.NEAREST?(e.scalarTexture.setMinificationFilter(Kt.NEAREST),e.scalarTexture.setMagnificationFilter(Kt.NEAREST)):(e.scalarTexture.setMinificationFilter(Kt.LINEAR),e.scalarTexture.setMagnificationFilter(Kt.LINEAR)),e.zBufferTexture!==null&&e.zBufferTexture.activate()},t.renderPieceDraw=(i,a)=>{const o=e.context;e.scalarTexture.activate(),e.opacityTexture.activate(),e.labelOutlineThicknessTexture.activate(),e.colorTexture.activate(),e.jitterTexture.activate(),t.updateShaders(e.tris,i,a),o.drawArrays(o.TRIANGLES,0,e.tris.getCABO().getElementCount()),e.tris.getVAO().release(),e.scalarTexture.deactivate(),e.colorTexture.deactivate(),e.opacityTexture.deactivate(),e.labelOutlineThicknessTexture.deactivate(),e.jitterTexture.deactivate()},t.renderPieceFinish=(i,a)=>{if(e.zBufferTexture!==null&&e.zBufferTexture.deactivate(),e._useSmallViewport){if(e.framebuffer.restorePreviousBindingsAndBuffers(),e.copyShader===null){e.copyShader=e._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join(`
`),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join(`
`),"");const l=e.copyShader;e.copyVAO=WE.newInstance(),e.copyVAO.setOpenGLRenderWindow(e._openGLRenderWindow),e.tris.getCABO().bind(),e.copyVAO.addAttributeArray(l,e.tris.getCABO(),"vertexDC",e.tris.getCABO().getVertexOffset(),e.tris.getCABO().getStride(),e.context.FLOAT,3,e.context.FALSE)||kR("Error setting vertexDC in copy shader VAO.")}else e._openGLRenderWindow.getShaderCache().readyShaderProgram(e.copyShader);const o=e._openGLRenderWindow.getFramebufferSize();e.context.viewport(0,0,o[0],o[1]);const s=e.framebuffer.getColorTexture();s.activate(),e.copyShader.setUniformi("texture",s.getTextureUnit()),e.copyShader.setUniform2f("tfactor",e.fvp[0],e.fvp[1]);const c=e.context;c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA),e.context.drawArrays(e.context.TRIANGLES,0,e.tris.getCABO().getElementCount()),s.deactivate(),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}},t.renderPiece=(i,a)=>{if(t.invokeEvent({type:"StartEvent"}),e.renderable.update(),e.currentInput=e.renderable.getInputData(),t.invokeEvent({type:"EndEvent"}),!e.currentInput){kR("No input!");return}t.renderPieceStart(i,a),t.renderPieceDraw(i,a),t.renderPieceFinish(i,a)},t.computeBounds=(i,a)=>{if(!t.getInput()){P2(e.Bounds);return}e.bounds=t.getInput().getBounds()},t.updateBufferObjects=(i,a)=>{t.getNeedToRebuildBufferObjects(i,a)&&t.buildBufferObjects(i,a)},t.getNeedToRebuildBufferObjects=(i,a)=>e.VBOBuildTime.getMTime()<t.getMTime()||e.VBOBuildTime.getMTime()<a.getMTime()||e.VBOBuildTime.getMTime()<e.renderable.getMTime()||e.VBOBuildTime.getMTime()<a.getProperty().getMTime()||e.VBOBuildTime.getMTime()<e.currentInput.getMTime()||!e.scalarTexture?.getHandle()||!e.colorTexture?.getHandle()||!e.labelOutlineThicknessTexture?.getHandle(),t.buildBufferObjects=(i,a)=>{const o=e.currentInput;if(!o)return;const s=o.getPointData()&&o.getPointData().getScalars();if(!s)return;const c=a.getProperty();if(!e.jitterTexture.getHandle()){const M=new Uint8Array(1024);for(let I=0;I<1024;++I)M[I]=255*Math.random();e.jitterTexture.setMinificationFilter(Kt.LINEAR),e.jitterTexture.setMagnificationFilter(Kt.LINEAR),e.jitterTexture.create2DFromRaw(32,32,1,zn.UNSIGNED_CHAR,M)}const l=s.getNumberOfComponents(),u=t.useIndependentComponents(c),f=u?l:1,d=c.getScalarOpacity(),h=e._openGLRenderWindow.getGraphicsResourceForObject(d);let m=Od(d,u,f);if(!h?.oglObject||h.hash!==m){e.opacityTexture=mi.newInstance(),e.opacityTexture.setOpenGLRenderWindow(e._openGLRenderWindow);const M=1024,I=M*2*f,V=new Float32Array(I),k=new Float32Array(M);for(let L=0;L<f;++L){const $=c.getScalarOpacity(L),W=t.getCurrentSampleDistance(i)/c.getScalarOpacityUnitDistance(L),G=$.getRange();$.getTable(G[0],G[1],M,k,1);for(let oe=0;oe<M;++oe)V[L*M*2+oe]=1-(1-k[oe])**W,V[L*M*2+oe+M]=V[L*M*2+oe]}if(e.opacityTexture.resetFormatAndType(),e.opacityTexture.setMinificationFilter(Kt.LINEAR),e.opacityTexture.setMagnificationFilter(Kt.LINEAR),e._openGLRenderWindow.getWebgl2()||e.context.getExtension("OES_texture_float")&&e.context.getExtension("OES_texture_float_linear"))e.opacityTexture.create2DFromRaw(M,2*f,1,zn.FLOAT,V);else{const L=new Uint8ClampedArray(I);for(let $=0;$<I;++$)L[$]=255*V[$];e.opacityTexture.create2DFromRaw(M,2*f,1,zn.UNSIGNED_CHAR,L)}d&&(e._openGLRenderWindow.setGraphicsResourceForObject(d,e.opacityTexture,m),d!==e._scalarOpacityFunc&&(e._openGLRenderWindow.registerGraphicsResourceUser(d,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._scalarOpacityFunc,t)),e._scalarOpacityFunc=d)}else e.opacityTexture=h.oglObject;const y=c.getRGBTransferFunction();m=Od(y,u,f);const x=e._openGLRenderWindow.getGraphicsResourceForObject(y);if(!x?.oglObject?.getHandle()||x?.hash!==m){e.colorTexture=mi.newInstance(),e.colorTexture.setOpenGLRenderWindow(e._openGLRenderWindow);const M=1024,I=M*2*f*3,V=new Uint8ClampedArray(I),k=new Float32Array(M*3);for(let L=0;L<f;++L){const $=c.getRGBTransferFunction(L),W=$.getRange();$.getTable(W[0],W[1],M,k,1);for(let G=0;G<M*3;++G)V[L*M*6+G]=255*k[G],V[L*M*6+G+M*3]=255*k[G]}e.colorTexture.resetFormatAndType(),e.colorTexture.setMinificationFilter(Kt.LINEAR),e.colorTexture.setMagnificationFilter(Kt.LINEAR),e.colorTexture.create2DFromRaw(M,2*f,3,zn.UNSIGNED_CHAR,V),y&&(e._openGLRenderWindow.setGraphicsResourceForObject(y,e.colorTexture,m),y!==e._colorTransferFunc&&(e._openGLRenderWindow.registerGraphicsResourceUser(y,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._colorTransferFunc,t)),e._colorTransferFunc=y)}else e.colorTexture=x.oglObject;t.updateLabelOutlineThicknessTexture(a);const C=e._openGLRenderWindow.getGraphicsResourceForObject(s);m=yF(o,s);const _=!C?.oglObject?.getHandle()||C?.hash!==m,T=e.renderable.getUpdatedExtents(),O=!!T.length;if(_&&!O){e.scalarTexture=mi.newInstance(),e.scalarTexture.setOpenGLRenderWindow(e._openGLRenderWindow);const M=o.getDimensions();e.scalarTexture.setOglNorm16Ext(e.context.getExtension("EXT_texture_norm16")),e.scalarTexture.resetFormatAndType(),e.scalarTexture.create3DFilterableFromDataArray(M[0],M[1],M[2],s),s&&(e._openGLRenderWindow.setGraphicsResourceForObject(s,e.scalarTexture,m),s!==e._scalars&&(e._openGLRenderWindow.registerGraphicsResourceUser(s,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._scalars,t)),e._scalars=s)}else e.scalarTexture=C.oglObject;if(O){e.renderable.setUpdatedExtents([]);const M=o.getDimensions();e.scalarTexture.create3DFilterableFromDataArray(M[0],M[1],M[2],s,!1,T)}if(!e.tris.getCABO().getElementCount()){const M=new Float32Array(12);for(let L=0;L<4;L++)M[L*3]=L%2*2-1,M[L*3+1]=L>1?1:-1,M[L*3+2]=-1;const I=new Uint16Array(8);I[0]=3,I[1]=0,I[2]=1,I[3]=3,I[4]=3,I[5]=0,I[6]=3,I[7]=2;const V=On.newInstance({numberOfComponents:3,values:M});V.setName("points");const k=On.newInstance({numberOfComponents:1,values:I});e.tris.getCABO().createVBO(k,"polys",_l.SURFACE,{points:V,cellOffset:0})}e.VBOBuildTime.modified()},t.updateLabelOutlineThicknessTexture=i=>{const a=i.getProperty().getLabelOutlineThickness(),o=e._openGLRenderWindow.getGraphicsResourceForObject(a),s=`${a.join("-")}`;if(!o?.oglObject?.getHandle()||o?.hash!==s){e.labelOutlineThicknessTexture=mi.newInstance(),e.labelOutlineThicknessTexture.setOpenGLRenderWindow(e._openGLRenderWindow);const l=1024,u=1,f=l*u,d=new Uint8Array(f);for(let h=0;h<l;++h){const m=typeof a[h]<"u"?a[h]:a[0];d[h]=m}e.labelOutlineThicknessTexture.resetFormatAndType(),e.labelOutlineThicknessTexture.setMinificationFilter(Kt.NEAREST),e.labelOutlineThicknessTexture.setMagnificationFilter(Kt.NEAREST),e.labelOutlineThicknessTexture.create2DFromRaw(l,u,1,zn.UNSIGNED_CHAR,d),a&&(e._openGLRenderWindow.setGraphicsResourceForObject(a,e.labelOutlineThicknessTexture,s),a!==e._labelOutlineThicknessArray&&(e._openGLRenderWindow.registerGraphicsResourceUser(a,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._labelOutlineThicknessArray,t)),e._labelOutlineThicknessArray=a)}else e.labelOutlineThicknessTexture=o.oglObject},t.isLabelmapOutlineRequired=i=>{const a=i.getProperty(),o=e.renderable;return a.getUseLabelOutline()||o.getBlendMode()===wC.LABELMAP_EDGE_PROJECTION_BLEND}}const Y6t={context:null,VBOBuildTime:null,scalarTexture:null,opacityTexture:null,opacityTextureString:null,colorTexture:null,colorTextureString:null,jitterTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,tris:null,framebuffer:null,copyShader:null,copyVAO:null,lastXYF:1,targetXYF:1,zBufferTexture:null,lastZBufferTexture:null,lightComplexity:0,fullViewportTime:1,idxToView:null,idxNormalMatrix:null,modelToView:null,projectionToView:null,avgWindowArea:0,avgFrameTime:0};function ywe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,Y6t,n),La.extend(t,e,n),sp.implementBuildShadersWithReplacements(t,e,n),e.VBOBuildTime={},yi(e.VBOBuildTime,{mtime:0}),e.tris=Ph.newInstance(),e.jitterTexture=mi.newInstance(),e.jitterTexture.setWrapS(Yw.REPEAT),e.jitterTexture.setWrapT(Yw.REPEAT),e.framebuffer=y3.newInstance(),e.idxToView=sn(new Float64Array(16)),e.idxNormalMatrix=vf(new Float64Array(9)),e.modelToView=sn(new Float64Array(16)),e.projectionToView=sn(new Float64Array(16)),e.projectionToWorld=sn(new Float64Array(16)),Ja(t,e,["context"]),K6t(t,e)}const xwe=ri(ywe,"vtkOpenGLVolumeMapper");var wwe={newInstance:xwe,extend:ywe};jo("vtkVolumeMapper",xwe);const{vtkDebugMacro:X6t}=Rs;function Z6t(t,e){e.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),t.opaquePass=(n,r)=>{e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer"),e._openGLRenderWindow=e._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow");const i=e._openGLRenderer.getAspectRatio(),a=e._openGLRenderer?e._openGLRenderer.getRenderable().getActiveCamera():null,o=e._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(e.renderable.getUseZValues()){const c=r.getZBufferTexture(),l=Math.floor(c.getWidth()),u=Math.floor(c.getHeight()),f=e._openGLRenderWindow.getContext();c.bind();const d=r.getFramebuffer();d?d.saveCurrentBindingsAndBuffers():X6t("No framebuffer to save/restore");const h=f.createFramebuffer();f.bindFramebuffer(f.FRAMEBUFFER,h),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,c.getHandle(),0),f.checkFramebufferStatus(f.FRAMEBUFFER)===f.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(l*u*4),f.viewport(0,0,l,u),f.readPixels(0,0,l,u,f.RGBA,f.UNSIGNED_BYTE,s)),d&&d.restorePreviousBindingsAndBuffers(),f.deleteFramebuffer(h)}e.renderable.invokeCallback(e.renderable.getInputData(),a,i,o,s)},t.queryPass=(n,r)=>{n&&e.renderable.getUseZValues()&&r.requestDepth()}}const Q6t={};function J6t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,Q6t,n),La.extend(t,e,n),Z6t(t,e)}const bwe=ri(J6t,"vtkOpenGLPixelSpaceCallbackMapper");var e8t={newInstance:bwe};jo("vtkPixelSpaceCallbackMapper",bwe);const Swe=Object.create(null);function A2(t,e){Swe[t]=e}function t8t(t,e){e.classHierarchy.push("vtkWebGPUViewNodeFactory")}const n8t={};function r8t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,n8t,n),e.overrides=Swe,pF.extend(t,e,n),t8t(t,e)}se.newInstance(r8t,"vtkWebGPUViewNodeFactory");function i8t(t,e){e.classHierarchy.push("vtkWebGPUCamera"),t.getProjectionMatrix=(n,r,i,a)=>{if(sn(n),e.renderable.getParallelProjection()){const o=e.renderable.getParallelScale(),s=o*r,c=o,l=(a[0]-1)*s,u=(a[0]+1)*s,f=(a[1]-1)*c,d=(a[1]+1)*c,h=1/(u-l),m=1/(d-f);n[0]=2*h,n[5]=2*m,n[10]=1/(i[1]-i[0]),n[12]=(u+l)*h,n[13]=(d+f)*m,n[14]=i[1]/(i[1]-i[0])}else{const o=Math.tan(Math.PI*e.renderable.getViewAngle()/360);let s,c;e.renderable.getUseHorizontalViewAngle()===!0?(s=i[0]*o,c=i[0]*o/r):(s=i[0]*o*r,c=i[0]*o);const l=(a[0]-1)*s,u=(a[0]+1)*s,f=(a[1]-1)*c,d=(a[1]+1)*c;n[0]=2*i[0]/(u-l),n[5]=2*i[0]/(d-f),n[12]=(l+u)/(u-l),n[13]=(f+d)/(d-f),n[10]=0,n[14]=i[0],n[11]=-1,n[15]=0}},t.convertToOpenGLDepth=n=>{if(e.renderable.getParallelProjection())return 1-n;const r=e.renderable.getClippingRangeByReference();let i=-r[0]/n;return i=(r[0]+r[1])/(r[1]-r[0])+2*r[0]*r[1]/(i*(r[1]-r[0])),.5*i+.5},t.getKeyMatrices=n=>{const r=n.getRenderable(),i=n.getParent();if(Math.max(i.getMTime(),t.getMTime(),r.getMTime(),e.renderable.getMTime(),n.getStabilizedTime())>e.keyMatrixTime.getMTime()){const a=e.renderable.getViewMatrix();pa(e.keyMatrices.normalMatrix,a),e.keyMatrices.normalMatrix[3]=0,e.keyMatrices.normalMatrix[7]=0,e.keyMatrices.normalMatrix[11]=0,Na(e.keyMatrices.normalMatrix,e.keyMatrices.normalMatrix),cr(e.keyMatrices.wcvc,a);const o=n.getStabilizedCenterByReference();Ma(e.keyMatrices.scvc,e.keyMatrices.wcvc,o);const s=n.getAspectRatio(),c=e.renderable.getClippingRangeByReference();t.getProjectionMatrix(e.keyMatrices.vcpc,s,c,e.renderable.getWindowCenterByReference()),Xn(e.keyMatrices.scpc,e.keyMatrices.vcpc,e.keyMatrices.scvc),Na(e.keyMatrices.pcsc,e.keyMatrices.scpc),e.keyMatrixTime.modified()}return e.keyMatrices}}const a8t={keyMatrixTime:null,keyMatrices:null};function o8t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,a8t,n),La.extend(t,e,n),e.keyMatrixTime={},se.obj(e.keyMatrixTime),e.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},se.setGet(t,e,["keyMatrixTime"]),i8t(t,e)}const s8t=se.newInstance(o8t);A2("vtkCamera",s8t);function c8t(t,e){e.classHierarchy.push("vtkWebGPUBindGroup"),t.setBindables=n=>{if(e.bindables.length===n.length){let r=!0;for(let i=0;i<e.bindables.length;i++)e.bindables[i]!==n[i]&&(r=!1);if(r)return}e.bindables=n,t.modified()},t.getBindGroupLayout=n=>{const r=[];for(let i=0;i<e.bindables.length;i++){const a=e.bindables[i].getBindGroupLayoutEntry();a.binding=i,r.push(a)}return n.getBindGroupLayout({entries:r})},t.getBindGroup=n=>{let r=t.getMTime();for(let a=0;a<e.bindables.length;a++){const o=e.bindables[a].getBindGroupTime().getMTime();r=o>r?o:r}if(r<e.bindGroupTime.getMTime())return e.bindGroup;const i=[];for(let a=0;a<e.bindables.length;a++){const o=e.bindables[a].getBindGroupEntry();o.binding=a,i.push(o)}return e.bindGroup=n.getHandle().createBindGroup({layout:t.getBindGroupLayout(n),entries:i,label:e.label}),e.bindGroupTime.modified(),e.bindGroup},t.getShaderCode=n=>{const r=[],i=n.getBindGroupLayoutCount(e.label);for(let a=0;a<e.bindables.length;a++)r.push(e.bindables[a].getShaderCode(a,i));return r.join(`
`)}}const l8t={device:null,handle:null,label:null};function Cwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,l8t,n),se.obj(t,e),e.bindables=[],e.bindGroupTime={},se.obj(e.bindGroupTime,{mtime:0}),se.get(t,e,["bindGroupTime","handle","sizeInBytes","usage"]),se.setGet(t,e,["label","device","arrayInformation"]),c8t(t,e)}const u8t=se.newInstance(Cwe);var _we={newInstance:u8t,extend:Cwe};function f8t(t,e){e.classHierarchy.push("vtkWebGPUShaderModule"),t.initialize=(n,r)=>{e.device=n,e.handle=e.device.getHandle().createShaderModule({code:r.getCode()})}}const d8t={device:null,handle:null};function Twe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,d8t,n),se.obj(t,e),se.get(t,e,["lastCameraMTime"]),se.setGet(t,e,["device","handle"]),f8t(t,e)}const h8t=se.newInstance(Twe,"vtkWebGPUShaderModule");var g8t={newInstance:h8t,extend:Twe};function p8t(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;const i=Array.isArray(n)?n.join(`
`):n;let a=!1;t.search(e)!==-1&&(a=!0);let o="";r&&(o="g");const s=new RegExp(e,o),c=t.replace(s,i);return{replace:a,result:c}}function m8t(t,e){e.classHierarchy.push("vtkWebGPUShaderCache"),t.getShaderModule=n=>{const r=n.getType(),i=n.getHash(),a=e._shaderModules.keys();for(let s=0;s<a.length;s++){const c=a[s];if(c.getHash()===i&&c.getType()===r)return e._shaderModules.get(c)}const o=g8t.newInstance();return o.initialize(e.device,n),e._shaderModules.set(n,o),o}}const v8t={shaderModules:null,device:null,window:null};function Ewe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,v8t,n),e._shaderModules=new Map,se.obj(t,e),se.setGet(t,e,["device","window"]),m8t(t,e)}const y8t=se.newInstance(Ewe,"vtkWebGPUShaderCache");var vl={newInstance:y8t,extend:Ewe,substitute:p8t};function x8t(t,e){e.classHierarchy.push("vtkWebGPUPipeline"),t.getShaderDescriptions=()=>e.shaderDescriptions,t.initialize=(n,r)=>{e.pipelineDescription=e.renderEncoder.getPipelineSettings(),e.pipelineDescription.primitive.topology=e.topology,e.pipelineDescription.vertex=e.vertexState,e.pipelineDescription.label=r;const i=[];for(let a=0;a<e.layouts.length;a++)i.push(e.layouts[a].layout);e.pipelineLayout=n.getHandle().createPipelineLayout({bindGroupLayouts:i}),e.pipelineDescription.layout=e.pipelineLayout;for(let a=0;a<e.shaderDescriptions.length;a++){const o=e.shaderDescriptions[a],s=n.getShaderModule(o);o.getType()==="vertex"&&(e.pipelineDescription.vertex.module=s.getHandle(),e.pipelineDescription.vertex.entryPoint="main"),o.getType()==="fragment"&&(e.pipelineDescription.fragment.module=s.getHandle(),e.pipelineDescription.fragment.entryPoint="main")}e.handle=n.getHandle().createRenderPipeline(e.pipelineDescription)},t.getShaderDescription=n=>{for(let r=0;r<e.shaderDescriptions.length;r++)if(e.shaderDescriptions[r].getType()===n)return e.shaderDescriptions[r];return null},t.addBindGroupLayout=n=>{n&&e.layouts.push({layout:n.getBindGroupLayout(e.device),label:n.getLabel()})},t.getBindGroupLayout=n=>e.layouts[n].layout,t.getBindGroupLayoutCount=n=>{for(let r=0;r<e.layouts.length;r++)if(e.layouts[r].label===n)return r;return 0},t.bindVertexInput=(n,r)=>{r.bindBuffers(n)}}const w8t={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function Owe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,w8t,n),yi(t,e),e.layouts=[],e.shaderDescriptions=[],sc(t,e,["handle","pipelineDescription"]),Ja(t,e,["device","renderEncoder","topology","vertexState"]),x8t(t,e)}const b8t=ri(Owe,"vtkWebGPUPipeline");var S8t={newInstance:b8t,extend:Owe};function C8t(t,e){e.classHierarchy.push("vtkWebGPUShaderDescription"),t.hasOutput=n=>e.outputNames.includes(n),t.addOutput=function(n,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;e.outputTypes.push(n),e.outputNames.push(r),e.outputInterpolations.push(i)},t.addBuiltinOutput=(n,r)=>{e.builtinOutputTypes.push(n),e.builtinOutputNames.push(r)},t.addBuiltinInput=(n,r)=>{e.builtinInputTypes.push(n),e.builtinInputNames.push(r)},t.replaceShaderCode=(n,r)=>{const i=[];let a=[];if(r&&i.push(r.getShaderCode()),n||e.builtinInputNames.length){const o=[];if(o.push(`struct ${e.type}Input
{`),n){const s=n.getOutputNamesByReference(),c=n.getOutputTypesByReference(),l=n.getOutputInterpolationsByReference();for(let u=0;u<s.length;u++)l[u]!==void 0?o.push(`  @location(${u}) @interpolate(${l[u]}) ${s[u]} : ${c[u]},`):o.push(`  @location(${u}) ${s[u]} : ${c[u]},`)}for(let s=0;s<e.builtinInputNames.length;s++)o.push(`  ${e.builtinInputNames[s]} : ${e.builtinInputTypes[s]},`);o.length>1&&(o.push("};"),a=o,i[i.length-1]+=",",i.push(`input: ${e.type}Input`))}if(i.length&&(e.code=vl.substitute(e.code,"//VTK::IOStructs::Input",i).result),e.outputNames.length+e.builtinOutputNames.length){const o=[`struct ${e.type}Output
{`];for(let s=0;s<e.outputNames.length;s++)e.outputInterpolations[s]!==void 0?o.push(`  @location(${s}) @interpolate(${e.outputInterpolations[s]}) ${e.outputNames[s]} : ${e.outputTypes[s]},`):o.push(`  @location(${s}) ${e.outputNames[s]} : ${e.outputTypes[s]},`);for(let s=0;s<e.builtinOutputNames.length;s++)o.push(`  ${e.builtinOutputNames[s]} : ${e.builtinOutputTypes[s]},`);o.push("};"),a=a.concat(o),e.code=vl.substitute(e.code,"//VTK::IOStructs::Output",[`-> ${e.type}Output`]).result}e.code=vl.substitute(e.code,"//VTK::IOStructs::Dec",a).result}}const _8t={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function Dwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,_8t,n),e.outputNames=[],e.outputTypes=[],e.outputInterpolations=[],e.builtinOutputNames=[],e.builtinOutputTypes=[],e.builtinInputNames=[],e.builtinInputTypes=[],se.obj(t,e),se.setGet(t,e,["type","hash","code"]),se.getArray(t,e,["outputTypes","outputNames","outputInterpolations"]),C8t(t,e)}const T8t=se.newInstance(Dwe,"vtkWebGPUShaderDescription");var Hee={newInstance:T8t,extend:Dwe};const qee={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};function E8t(t){return!t||t.length<6?0:t in qee?qee[t]:(Yn(`unknown format ${t}`),null)}function O8t(t){if(!t||t.length<5)return 0;let e=1;t[t.length-2]==="x"&&(e=Number(t[t.length-1]));const n=e===1?t.length-1:t.length-3,r=Number(t[n]);if(Number.isNaN(r))return Yn(`unknown format ${t}`),0;const i=5-r/2;return e*i}function D8t(t){if(!t||t.length<5)return 0;let e=1;return t[t.length-2]==="x"&&(e=Number(t[t.length-1])),e}function M8t(t){if(!t||t.length<5)return 0;let e;if(t[0]==="f")e="Float";else if(t[0]==="s")e="Int";else if(t[0]==="u")e="Uint";else{Yn(`unknown format ${t}`);return}const n=t.split("x")[0],r=Number(n[n.length-1]);if(Number.isNaN(r)){Yn(`unknown format ${t}`);return}return e+=8*(5-r/2),e+="Array",e}function R8t(t){let e;if(t[0]==="f"||t[1]==="n")e="f32";else if(t[0]==="s"&&t[1]==="i")e="i32";else if(t[0]==="u"&&t[1]==="i")e="u32";else{Yn(`unknown format ${t}`);return}let n=1;return t[t.length-2]==="x"&&(n=Number(t[t.length-1])),n===4?`vec4<${e}>`:n===3?`vec3<${e}>`:n===2?`vec2<${e}>`:e}function I8t(t){if(!t)return 0;let e=1;return t.substring(0,3)==="vec"?e=Number(t[3]):t.substring(0,3)==="mat"&&(e=t[3]*t[5]),e*4}function N8t(t){if(t){if(t.includes("f32"))return"Float32Array";if(t.includes("i32"))return"Int32Array";if(t.includes("u32"))return"Uint32Array";Yn(`unknown format ${t}`)}}var rd={getDetailsFromTextureFormat:E8t,getByteStrideFromBufferFormat:O8t,getNumberOfComponentsFromBufferFormat:D8t,getNativeTypeFromBufferFormat:M8t,getShaderTypeFromBufferFormat:R8t,getByteStrideFromShaderFormat:I8t,getNativeTypeFromShaderFormat:N8t};function P8t(t,e){if(t===e)return!0;if(t==null||e==null||t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!e.includes(t[n]))return!1;return!0}function k8t(t,e){e.classHierarchy.push("vtkWebGPUVertexInput"),t.addBuffer=function(n,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"vertex",a=r;Array.isArray(a)||(a=[a]);for(let o=0;o<e.inputs.length;o++)if(P8t(e.inputs[o].names,a)){if(e.inputs[o].buffer===n)return;e.inputs[o].buffer=n;return}e.inputs.push({buffer:n,stepMode:i,names:a}),e.inputs=e.inputs.sort((o,s)=>o.names[0]<s.names[0]?-1:o.names[0]>s.names[0]?1:0)},t.removeBufferIfPresent=n=>{for(let r=0;r<e.inputs.length;r++)e.inputs[r].names.includes(n)&&e.inputs.splice(r,1)},t.getBuffer=n=>{for(let r=0;r<e.inputs.length;r++)if(e.inputs[r].names.includes(n))return e.inputs[r].buffer;return null},t.hasAttribute=n=>{for(let r=0;r<e.inputs.length;r++)if(e.inputs[r].names.includes(n))return!0;return!1},t.getAttributeTime=n=>{for(let r=0;r<e.inputs.length;r++)if(e.inputs[r].names.includes(n))return e.inputs[r].buffer.getSourceTime();return 0},t.getShaderCode=()=>{let n="",r=0;for(let i=0;i<e.inputs.length;i++)for(let a=0;a<e.inputs[i].names.length;a++){const o=e.inputs[i].buffer.getArrayInformation()[a],s=rd.getShaderTypeFromBufferFormat(o.format);r>0&&(n+=`,
`),n=`${n}  @location(${r}) ${e.inputs[i].names[a]} : ${s}`,r++}return n},t.getVertexInputInformation=()=>{const n={};if(e.inputs.length){const r=[];let i=0;for(let a=0;a<e.inputs.length;a++){const o=e.inputs[a].buffer,s={arrayStride:o.getStrideInBytes(),stepMode:e.inputs[a].stepMode,attributes:[]},c=o.getArrayInformation();for(let l=0;l<e.inputs[a].names.length;l++)s.attributes.push({shaderLocation:i,offset:c[l].offset,format:c[l].format}),i++;r.push(s)}n.buffers=r}return n},t.bindBuffers=n=>{for(let r=0;r<e.inputs.length;r++)n.setVertexBuffer(r,e.inputs[r].buffer.getHandle());e.indexBuffer&&n.setIndexBuffer(e.indexBuffer.getHandle(),e.indexBuffer.getArrayInformation()[0].format)},t.getReady=()=>{},t.releaseGraphicsResources=()=>{e.created&&(e.inputs=[],e.bindingDescriptions=[],e.attributeDescriptions=[])}}const A8t={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function Mwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,A8t,n),yi(t,e),e.bindingDescriptions=[],e.attributeDescriptions=[],e.inputs=[],Ja(t,e,["created","device","handle","indexBuffer"]),k8t(t,e)}const L8t=ri(Mwe,"vtkWebGPUVertexInput");var V8t={newInstance:L8t,extend:Mwe};const $8t=`
//VTK::Renderer::Dec

//VTK::Color::Dec

//VTK::Normal::Dec

//VTK::TCoord::Dec

//VTK::Select::Dec

//VTK::Mapper::Dec

//VTK::IOStructs::Dec

@vertex
fn main(
//VTK::IOStructs::Input
)
//VTK::IOStructs::Output
{
  var output : vertexOutput;

  // var vertex: vec4<f32> = vertexBC;

  //VTK::Color::Impl

  //VTK::Normal::Impl

  //VTK::TCoord::Impl

  //VTK::Select::Impl

  //VTK::Position::Impl

  return output;
}
`,j8t=`
//VTK::Renderer::Dec

//VTK::Color::Dec

//VTK::Normal::Dec

//VTK::TCoord::Dec

//VTK::Select::Dec

//VTK::RenderEncoder::Dec

//VTK::Mapper::Dec

//VTK::IOStructs::Dec

@fragment
fn main(
//VTK::IOStructs::Input
)
//VTK::IOStructs::Output
{
  var output : fragmentOutput;

  //VTK::Color::Impl

  //VTK::Normal::Impl

  //VTK::Light::Impl

  //VTK::TCoord::Impl

  //VTK::Select::Impl

  // var computedColor:vec4<f32> = vec4<f32>(1.0,0.5,0.5,1.0);

  //VTK::RenderEncoder::Impl
  return output;
}
`;function U8t(t,e){e.classHierarchy.push("vtkWebGPUSimpleMapper"),t.generateShaderDescriptions=(n,r,i)=>{const a=Hee.newInstance({type:"vertex",hash:n,code:e.vertexShaderTemplate}),o=Hee.newInstance({type:"fragment",hash:n,code:e.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(a),s.push(o);const c=e.vertexShaderTemplate+e.fragmentShaderTemplate,l=new RegExp("//VTK::[^:]*::","g"),f=c.match(l).filter((d,h,m)=>m.indexOf(d)===h).map(d=>`replaceShader${d.substring(7,d.length-2)}`);for(let d=0;d<f.length;d++){const h=f[d];h!=="replaceShaderIOStructs"&&e.shaderReplacements.has(h)&&e.shaderReplacements.get(h)(n,r,i)}t.replaceShaderIOStructs(n,r,i)},t.replaceShaderIOStructs=(n,r,i)=>{const a=r.getShaderDescription("vertex");a.replaceShaderCode(null,i),r.getShaderDescription("fragment").replaceShaderCode(a)},t.replaceShaderRenderEncoder=(n,r,i)=>{e.renderEncoder.replaceShaderCode(r)},e.shaderReplacements.set("replaceShaderRenderEncoder",t.replaceShaderRenderEncoder),t.replaceShaderRenderer=(n,r,i)=>{if(!e.WebGPURenderer)return;const a=e.WebGPURenderer.getBindGroup().getShaderCode(r),o=r.getShaderDescription("vertex");let s=o.getCode();s=vl.substitute(s,"//VTK::Renderer::Dec",[a]).result,o.setCode(s);const c=r.getShaderDescription("fragment");s=c.getCode(),s=vl.substitute(s,"//VTK::Renderer::Dec",[a]).result,c.setCode(s)},e.shaderReplacements.set("replaceShaderRenderer",t.replaceShaderRenderer),t.replaceShaderMapper=(n,r,i)=>{const a=e.bindGroup.getShaderCode(r),o=r.getShaderDescription("vertex");let s=o.getCode();s=vl.substitute(s,"//VTK::Mapper::Dec",[a]).result,o.setCode(s);const c=r.getShaderDescription("fragment");c.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),s=c.getCode(),s=vl.substitute(s,"//VTK::Mapper::Dec",[a]).result,c.setCode(s)},e.shaderReplacements.set("replaceShaderMapper",t.replaceShaderMapper),t.replaceShaderPosition=(n,r,i)=>{const a=r.getShaderDescription("vertex");a.addBuiltinOutput("vec4<f32>","@builtin(position) Position");let o=a.getCode();o=vl.substitute(o,"//VTK::Position::Impl",["    output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,a.setCode(o)},e.shaderReplacements.set("replaceShaderPosition",t.replaceShaderPosition),t.replaceShaderTCoord=(n,r,i)=>{r.getShaderDescription("vertex").addOutput("vec2<f32>","tcoordVS")},e.shaderReplacements.set("replaceShaderTCoord",t.replaceShaderTCoord),t.addTextureView=n=>{e.textureViews.includes(n)||e.textureViews.push(n)},t.prepareToDraw=n=>{e.renderEncoder=n,t.updateInput(),t.updateBuffers(),t.updateBindings(),t.updatePipeline()},t.updateInput=()=>{},t.updateBuffers=()=>{},t.updateBindings=()=>{e.bindGroup.setBindables(t.getBindables())},t.computePipelineHash=()=>{},t.registerDrawCallback=n=>{n.registerDrawCallback(e.pipeline,t.draw)},t.prepareAndDraw=n=>{t.prepareToDraw(n),n.setPipeline(e.pipeline),t.draw(n)},t.draw=n=>{const r=n.getBoundPipeline();n.activateBindGroup(e.bindGroup),e.WebGPURenderer&&e.WebGPURenderer.bindUBO(n),r.bindVertexInput(n,e.vertexInput);const i=e.vertexInput.getIndexBuffer();i?n.drawIndexed(i.getIndexCount(),e.numberOfInstances,0,0,0):n.draw(e.numberOfVertices,e.numberOfInstances,0,0)},t.getBindables=()=>{const n=[...e.additionalBindables];e.UBO&&n.push(e.UBO),e.SSBO&&n.push(e.SSBO);for(let r=0;r<e.textureViews.length;r++){n.push(e.textureViews[r]);const i=e.textureViews[r].getSampler();i&&n.push(i)}return n},t.updatePipeline=()=>{t.computePipelineHash(),e.pipeline=e.device.getPipeline(e.pipelineHash),e.pipeline||(e.pipeline=S8t.newInstance(),e.pipeline.setDevice(e.device),e.WebGPURenderer&&e.pipeline.addBindGroupLayout(e.WebGPURenderer.getBindGroup()),e.pipeline.addBindGroupLayout(e.bindGroup),t.generateShaderDescriptions(e.pipelineHash,e.pipeline,e.vertexInput),e.pipeline.setTopology(e.topology),e.pipeline.setRenderEncoder(e.renderEncoder),e.pipeline.setVertexState(e.vertexInput.getVertexInputInformation()),e.device.createPipeline(e.pipelineHash,e.pipeline))}}const F8t={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function Rwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,F8t,n),La.extend(t,e,n),e.textureViews=[],e.vertexInput=V8t.newInstance(),e.bindGroup=_we.newInstance({label:"mapperBG"}),e.additionalBindables=[],e.fragmentShaderTemplate=e.fragmentShaderTemplate||j8t,e.vertexShaderTemplate=e.vertexShaderTemplate||$8t,e.shaderReplacements=new Map,se.get(t,e,["pipeline","vertexInput"]),se.setGet(t,e,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),U8t(t,e)}const B8t=se.newInstance(Rwe,"vtkWebGPUSimpleMapper");var z8t={newInstance:B8t,extend:Rwe};function G8t(t,e){e.classHierarchy.push("vtkWebGPUFullScreenQuad"),t.replaceShaderPosition=(n,r,i)=>{const a=r.getShaderDescription("vertex");a.addBuiltinOutput("vec4<f32>","@builtin(position) Position"),a.addOutput("vec4<f32>","vertexVC");let o=a.getCode();o=vl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2<f32>(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4<f32>(vertexBC, 1.0);","output.vertexVC = vec4<f32>(vertexBC, 1);"]).result,a.setCode(o)},e.shaderReplacements.set("replaceShaderPosition",t.replaceShaderPosition),t.updateBuffers=()=>{const n=e.device.getBufferManager().getFullScreenQuadBuffer();e.vertexInput.addBuffer(n,["vertexBC"]),e.numberOfVertices=6}}const W8t={};function Iwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,W8t,n),z8t.extend(t,e,n),G8t(t,e)}const H8t=se.newInstance(Iwe,"vtkWebGPUFullScreenQuad");var pk={newInstance:H8t,extend:Iwe};const q8t={Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},K8t={Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6};var x3={BufferUsage:q8t,PrimitiveTypes:K8t};const AR=["getMappedRange","mapAsync","unmap"];function Y8t(t,e,n,r){const i=r.byteLength,a=t.createBuffer({size:i,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),o=a.getMappedRange(0,i);new Uint8Array(o).set(new Uint8Array(r)),a.unmap();const s=t.createCommandEncoder();s.copyBufferToBuffer(a,0,e,n,i);const c=s.finish();t.queue.submit([c]),a.destroy()}function X8t(t,e){e.classHierarchy.push("vtkWebGPUBuffer"),t.create=(n,r)=>{e.handle=e.device.getHandle().createBuffer({size:n,usage:r,label:e.label}),e.sizeInBytes=n,e.usage=r},t.write=n=>{Y8t(e.device.getHandle(),e.handle,0,n.buffer)},t.createAndWrite=(n,r)=>{e.handle=e.device.getHandle().createBuffer({size:n.byteLength,usage:r,mappedAtCreation:!0,label:e.label}),e.sizeInBytes=n.byteLength,e.usage=r,new Uint8Array(e.handle.getMappedRange()).set(new Uint8Array(n.buffer)),e.handle.unmap()};for(let n=0;n<AR.length;n++)t[AR[n]]=function(){return e.handle[AR[n]](...arguments)}}const Z8t={device:null,handle:null,sizeInBytes:0,strideInBytes:0,arrayInformation:null,usage:null,label:null,sourceTime:null};function Nwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,Z8t,n),se.obj(t,e),se.get(t,e,["handle","sizeInBytes","usage"]),se.setGet(t,e,["strideInBytes","device","arrayInformation","label","sourceTime"]),X8t(t,e)}const Q8t=se.newInstance(Nwe);var mk={newInstance:Q8t,extend:Nwe,...x3};const{Representation:O5,Interpolation:D5}=Q5e;function Kee(t){return()=>se.vtkErrorMacro(`vtkProperty::${t} - NOT IMPLEMENTED`)}function J8t(t,e){e.classHierarchy.push("vtkProperty"),t.setColor=(n,r,i)=>{Array.isArray(n)?(e.color[0]!==n[0]||e.color[1]!==n[1]||e.color[2]!==n[2])&&(e.color[0]=n[0],e.color[1]=n[1],e.color[2]=n[2],t.modified()):(e.color[0]!==n||e.color[1]!==r||e.color[2]!==i)&&(e.color[0]=n,e.color[1]=r,e.color[2]=i,t.modified()),t.setDiffuseColor(e.color),t.setAmbientColor(e.color),t.setSpecularColor(e.color)},t.computeCompositeColor=Kee("ComputeCompositeColor"),t.getColor=()=>{let n=0;e.ambient+e.diffuse+e.specular>0&&(n=1/(e.ambient+e.diffuse+e.specular));for(let r=0;r<3;r++)e.color[r]=n*(e.ambient*e.ambientColor[r]+e.diffuse*e.diffuseColor[r]+e.specular*e.specularColor[r]);return[].concat(e.color)},t.setSpecularPower=n=>{const r=1/Math.max(1,n);(e.roughness!==r||e.specularPower!==n)&&(e.specularPower=n,e.roughness=r,t.modified())},t.addShaderVariable=Kee("AddShaderVariable"),t.setInterpolationToFlat=()=>t.setInterpolation(D5.FLAT),t.setInterpolationToGouraud=()=>t.setInterpolation(D5.GOURAUD),t.setInterpolationToPhong=()=>t.setInterpolation(D5.PHONG),t.getInterpolationAsString=()=>se.enumToString(D5,e.interpolation),t.setRepresentationToWireframe=()=>t.setRepresentation(O5.WIREFRAME),t.setRepresentationToSurface=()=>t.setRepresentation(O5.SURFACE),t.setRepresentationToPoints=()=>t.setRepresentation(O5.POINTS),t.getRepresentationAsString=()=>se.enumToString(O5,e.representation)}const eEt={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:D5.GOURAUD,representation:O5.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function tEt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,eEt,n),se.obj(t,e),se.setGet(t,e,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),se.setGetArray(t,e,["ambientColor","specularColor","diffuseColor","edgeColor"],3),J8t(t,e)}const nEt=se.newInstance(tEt,"vtkProperty");var w3={newInstance:nEt,...Q5e};const{Representation:Yee}=w3,{PrimitiveTypes:wg}=x3;class rEt{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let n=0;n<this.count;n++)if(this.keys[n]===e)return!0}get(e){for(let n=0;n<this.count;n++)if(this.keys[n]===e)return this.values[n]}set(e,n){this.count<9&&(this.keys[this.count]=e,this.values[this.count++]=n)}}function iEt(t){switch(t){case wg.Points:return"points";case wg.Lines:return"lines";case wg.Triangles:case wg.TriangleEdges:return"polys";case wg.TriangleStripEdges:case wg.TriangleStrips:return"strips";default:return""}}function ES(t,e,n){let r=t.pointIdToFlatId[e];return r<0&&(r=t.flatId,t.pointIdToFlatId[e]=r,t.flatIdToPointId[t.flatId]=e,t.flatIdToCellId[t.flatId]=n,t.flatId++),r}function aEt(t,e,n){const r=t.length;for(let o=0;o<r;o++){let s=t[o];if(n.cellProvokedMap.has(s)){n.ibo[n.iboId++]=n.cellProvokedMap.get(s);for(let c=o+1;c<o+r;c++){s=t[c%r];const l=ES(n,s,e);n.ibo[n.iboId++]=l}return}}for(let o=0;o<r;o++){let s=t[o];if(!n.provokedPointIds[s]){let c=ES(n,s,e);n.provokedPointIds[s]=1,n.cellProvokedMap.set(s,c),n.flatIdToCellId[c]=e,n.ibo[n.iboId++]=c;for(let l=o+1;l<o+r;l++)s=t[l%r],c=ES(n,s,e),n.ibo[n.iboId++]=c;return}}let i=t[0],a=n.flatId;n.cellProvokedMap.set(i,a),n.flatIdToPointId[n.flatId]=i,n.flatIdToCellId[n.flatId]=e,n.flatId++,n.ibo[n.iboId++]=a;for(let o=1;o<r;o++)i=t[o],a=ES(n,i,e),n.ibo[n.iboId++]=a}function oEt(t,e,n){const r=t.length;n.iboSize+=r;for(let i=0;i<r;i++){const a=t[i];if(n.cellProvokedMap.has(a))return}for(let i=0;i<r;i++){const a=t[i];if(!n.provokedPointIds[a]){n.provokedPointIds[a]=1,n.cellProvokedMap.set(a,1);return}}n.cellProvokedMap.set(t[0],1),n.extraPoints++}let w0;const Xee=new Uint32Array(1),nu=new Uint32Array(2),sg=new Uint32Array(3),LR={anythingToPoints(t,e,n,r,i){for(let a=0;a<t;++a)Xee[0]=e[n+a],w0(Xee,r,i)},linesToWireframe(t,e,n,r,i){for(let a=0;a<t-1;++a)nu[0]=e[n+a],nu[1]=e[n+a+1],w0(nu,r,i)},polysToWireframe(t,e,n,r,i){if(t>2)for(let a=0;a<t;++a)nu[0]=e[n+a],nu[1]=e[n+(a+1)%t],w0(nu,r,i)},stripsToWireframe(t,e,n,r,i){if(t>2){for(let a=0;a<t-1;++a)nu[0]=e[n+a],nu[1]=e[n+a+1],w0(nu,r,i);for(let a=0;a<t-2;a++)nu[0]=e[n+a],nu[1]=e[n+a+2],w0(nu,r,i)}},polysToSurface(t,e,n,r,i){for(let a=0;a<t-2;a++)sg[0]=e[n],sg[1]=e[n+a+1],sg[2]=e[n+a+2],w0(sg,r,i)},stripsToSurface(t,e,n,r,i){for(let a=0;a<t-2;a++)sg[0]=e[n+a],sg[1]=e[n+a+1+a%2],sg[2]=e[n+a+1+(a+1)%2],w0(sg,r,i)}};function sEt(t,e){e.classHierarchy.push("vtkWebGPUIndexBuffer"),t.buildIndexBuffer=n=>{const r=n.cells,i=n.primitiveType,a=n.representation,o=n.cellOffset,s=r.getData(),c=s.length,l=iEt(i),u=n.numberOfPoints,f={provokedPointIds:new Uint8Array(u),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new rEt};let d=null;a===Yee.POINTS||i===wg.Points?d=LR.anythingToPoints:a===Yee.WIREFRAME||i===wg.Lines?d=LR[`${l}ToWireframe`]:d=LR[`${l}ToSurface`],w0=oEt;let h=o||0;for(let m=0;m<c;)f.cellProvokedMap.clear(),d(s[m],s,m+1,h,f),m+=s[m]+1,h++;u<=65535?f.flatIdToPointId=new Uint16Array(u+f.extraPoints):f.flatIdToPointId=new Uint32Array(u+f.extraPoints),u+f.extraPoints<36863?f.pointIdToFlatId=new Int16Array(u):f.pointIdToFlatId=new Int32Array(u),u+f.extraPoints<=65535?(f.ibo=new Uint16Array(f.iboSize),n.format="uint16"):(f.ibo=new Uint32Array(f.iboSize),n.format="uint32"),h<=65535?f.flatIdToCellId=new Uint16Array(u+f.extraPoints):f.flatIdToCellId=new Uint32Array(u+f.extraPoints),f.pointIdToFlatId.fill(-1),f.provokedPointIds.fill(0),w0=aEt,h=o||0;for(let m=0;m<c;)f.cellProvokedMap.clear(),d(s[m],s,m+1,h,f),m+=s[m]+1,h++;delete f.provokedPointIds,delete f.pointIdToFlatId,n.nativeArray=f.ibo,e.flatIdToPointId=f.flatIdToPointId,e.flatIdToCellId=f.flatIdToCellId,e.flatSize=f.flatId,e.indexCount=f.iboId}}const cEt={flatIdToPointId:null,flatIdToCellId:null,flatSize:0,indexCount:0};function Pwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,cEt,n),mk.extend(t,e,n),se.setGet(t,e,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),sEt(t,e)}const lEt=se.newInstance(Pwe);var uEt={newInstance:lEt,extend:Pwe,...x3};const{BufferUsage:cg}=x3,{vtkErrorMacro:fEt}=Rs,{VtkDataTypes:Wp}=On,dEt={};function hEt(t){let e;switch(t.getDataType()){case Wp.UNSIGNED_CHAR:e="uint8";break;case Wp.FLOAT:e="float32";break;case Wp.UNSIGNED_INT:e="uint32";break;case Wp.INT:e="sint32";break;case Wp.DOUBLE:e="float32";break;case Wp.UNSIGNED_SHORT:e="uint16";break;case Wp.SHORT:e="sin16";break;default:e="float32";break}switch(t.getNumberOfComponents()){case 2:e+="x2";break;case 3:e.includes("32")||fEt(`unsupported x3 type for ${e}`),e+="x3";break;case 4:e+="x4";break}return e}function Zee(t,e,n,r,i){const a={},o=t.getFlatSize();if(!o)return a;let s=[0,0,0,0];i.shift&&(i.shift.length?s=i.shift:s.fill(i.shift));let c=[1,1,1,1];i.scale&&(i.scale.length?c=i.scale:c.fill(i.scale));const l=Object.prototype.hasOwnProperty.call(i,"packExtra")?i.packExtra:!1;let u,f=0;const d=n+(l?1:0),h=I2(r,o*d);let m=t.getFlatIdToPointId();i.cellData&&(m=t.getFlatIdToCellId()),n===1?u=function(y){h[f++]=c[0]*e[y]+s[0]}:n===2?u=function(y){h[f++]=c[0]*e[y]+s[0],h[f++]=c[1]*e[y+1]+s[1]}:n===3&&!l?u=function(y){h[f++]=c[0]*e[y]+s[0],h[f++]=c[1]*e[y+1]+s[1],h[f++]=c[2]*e[y+2]+s[2]}:n===3&&l?u=function(y){h[f++]=c[0]*e[y]+s[0],h[f++]=c[1]*e[y+1]+s[1],h[f++]=c[2]*e[y+2]+s[2],h[f++]=c[3]*1+s[3]}:n===4&&(u=function(y){h[f++]=c[0]*e[y]+s[0],h[f++]=c[1]*e[y+1]+s[1],h[f++]=c[2]*e[y+2]+s[2],h[f++]=c[3]*e[y+3]+s[3]});for(let p=0;p<o;p++){const y=n*m[p];u(y)}return a.nativeArray=h,a}function gEt(t,e,n,r){const i=[t[r*3]-t[n*3],t[r*3+1]-t[n*3+1],t[r*3+2]-t[n*3+2]],a=[t[e*3]-t[n*3],t[e*3+1]-t[n*3+1],t[e*3+2]-t[n*3+2]],o=[];return _d(i,a,o),c1(o),o}function pEt(t,e){const n=e.getData(),r=t.getData();if(!r||!n)return null;const i=new Int8Array(t.getNumberOfCells()*4),a=r.length;let o=0;for(let s=0;s<a;){const c=gEt(n,r[s+1],r[s+2],r[s+3]);i[o++]=127*c[0],i[o++]=127*c[1],i[o++]=127*c[2],i[o++]=127,s+=r[s]+1}return i}function mEt(t,e){e.classHierarchy.push("vtkWebGPUBufferManager");function n(r){r.dataArray&&!r.nativeArray&&(r.nativeArray=r.dataArray.getData());let i,a;if(r.usage===cg.Index&&(i=uEt.newInstance({label:r.label}),i.setDevice(e.device),a=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_DST,i.buildIndexBuffer(r),i.createAndWrite(r.nativeArray,a),i.setArrayInformation([{format:r.format}])),i||(i=mk.newInstance({label:r.label}),i.setDevice(e.device)),r.usage===cg.UniformArray&&(a=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,i.createAndWrite(r.nativeArray,a)),r.usage===cg.Storage&&(a=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,i.createAndWrite(r.nativeArray,a)),r.usage===cg.Texture&&(a=GPUBufferUsage.COPY_SRC,i.createAndWrite(r.nativeArray,a)),r.usage===cg.PointArray){a=GPUBufferUsage.VERTEX;const o=rd.getNativeTypeFromBufferFormat(r.format),s=Zee(r.indexBuffer,r.dataArray.getData(),r.dataArray.getNumberOfComponents(),o,{packExtra:r.packExtra,shift:r.shift,scale:r.scale,cellData:r.cellData,cellOffset:r.cellOffset});i.createAndWrite(s.nativeArray,a),i.setStrideInBytes(rd.getByteStrideFromBufferFormat(r.format)),i.setArrayInformation([{offset:0,format:r.format,interpolation:r.cellData?"flat":"perspective"}])}if(r.usage===cg.NormalsFromPoints){a=GPUBufferUsage.VERTEX;const o=rd.getNativeTypeFromBufferFormat(r.format),s=pEt(r.cells,r.dataArray),c=Zee(r.indexBuffer,s,4,o,{cellData:!0});i.createAndWrite(c.nativeArray,a),i.setStrideInBytes(rd.getByteStrideFromBufferFormat(r.format)),i.setArrayInformation([{offset:0,format:r.format,interpolation:"flat"}])}return r.usage===cg.RawVertex&&(a=GPUBufferUsage.VERTEX,i.createAndWrite(r.nativeArray,a),i.setStrideInBytes(rd.getByteStrideFromBufferFormat(r.format)),i.setArrayInformation([{offset:0,format:r.format}])),i.setSourceTime(r.time),i}t.hasBuffer=r=>e.device.hasCachedObject(r),t.getBuffer=r=>r.hash?e.device.getCachedObject(r.hash,n,r):n(r),t.getBufferForPointArray=(r,i)=>{const a=hEt(r),o={hash:`${r.getMTime()}I${i.getMTime()}${a}`,usage:cg.PointArray,format:a,dataArray:r,indexBuffer:i};return t.getBuffer(o)},t.getFullScreenQuadBuffer=()=>{if(e.fullScreenQuadBuffer)return e.fullScreenQuadBuffer;e.fullScreenQuadBuffer=mk.newInstance(),e.fullScreenQuadBuffer.setDevice(e.device);const r=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return e.fullScreenQuadBuffer.createAndWrite(r,GPUBufferUsage.VERTEX),e.fullScreenQuadBuffer.setStrideInBytes(12),e.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),e.fullScreenQuadBuffer}}const vEt={device:null,fullScreenQuadBuffer:null};function yEt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,vEt,n),yi(t,e),Ja(t,e,["device"]),mEt(t,e)}ri(yEt);var kwe={...dEt,...x3};const{BufferUsage:xEt}=kwe,{vtkErrorMacro:xv}=se;function wEt(t,e){e.classHierarchy.push("vtkWebGPUStorageBuffer"),t.addEntry=(n,r)=>{if(e._bufferEntryNames.has(n)){xv(`entry named ${n} already exists`);return}e._bufferEntryNames.set(n,e.bufferEntries.length);const i=rd.getByteStrideFromShaderFormat(r);e.bufferEntries.push({name:n,type:r,sizeInBytes:i,offset:e.sizeInBytes,nativeType:rd.getNativeTypeFromShaderFormat(r)}),e.sizeInBytes+=i},t.send=n=>{if(!e._buffer){const r={nativeArray:e.Float32Array,usage:xEt.Storage,label:e.label};e._buffer=n.getBufferManager().getBuffer(r),e.bindGroupTime.modified(),e._sendTime.modified();return}n.getHandle().queue.writeBuffer(e._buffer.getHandle(),0,e.arrayBuffer,0,e.sizeInBytes*e.numberOfInstances),e._sendTime.modified()},t.createView=n=>{n in e||(e.arrayBuffer||(e.arrayBuffer=new ArrayBuffer(e.sizeInBytes*e.numberOfInstances)),e[n]=se.newTypedArray(n,e.arrayBuffer))},t.setValue=(n,r,i)=>{const a=e._bufferEntryNames.get(n);if(a===void 0){xv(`entry named ${n} not found in UBO`);return}const o=e.bufferEntries[a];t.createView(o.nativeType);const s=e[o.nativeType];s[(o.offset+r*e.sizeInBytes)/s.BYTES_PER_ELEMENT]=i},t.setArray=(n,r,i)=>{const a=e._bufferEntryNames.get(n);if(a===void 0){xv(`entry named ${n} not found in UBO`);return}const o=e.bufferEntries[a];t.createView(o.nativeType);const s=e[o.nativeType],c=(o.offset+r*e.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let l=0;l<i.length;l++)s[c+l]=i[l]},t.setAllInstancesFromArray=(n,r)=>{const i=e._bufferEntryNames.get(n);if(i===void 0){xv(`entry named ${n} not found in UBO`);return}const a=e.bufferEntries[i];t.createView(a.nativeType);const o=e[a.nativeType],s=r.length/e.numberOfInstances;for(let c=0;c<e.numberOfInstances;c++){const l=(a.offset+c*e.sizeInBytes)/o.BYTES_PER_ELEMENT;for(let u=0;u<s;u++)o[l+u]=r[c*s+u]}},t.setAllInstancesFromArrayColorToFloat=(n,r)=>{const i=e._bufferEntryNames.get(n);if(i===void 0){xv(`entry named ${n} not found in UBO`);return}const a=e.bufferEntries[i];t.createView(a.nativeType);const o=e[a.nativeType],s=r.length/e.numberOfInstances;for(let c=0;c<e.numberOfInstances;c++){const l=(a.offset+c*e.sizeInBytes)/o.BYTES_PER_ELEMENT;for(let u=0;u<s;u++)o[l+u]=r[c*s+u]/255}},t.setAllInstancesFromArray3x3To4x4=(n,r)=>{const i=e._bufferEntryNames.get(n);if(i===void 0){xv(`entry named ${n} not found in UBO`);return}const a=e.bufferEntries[i];t.createView(a.nativeType);const o=e[a.nativeType],s=9;for(let c=0;c<e.numberOfInstances;c++){const l=(a.offset+c*e.sizeInBytes)/o.BYTES_PER_ELEMENT;for(let u=0;u<3;u++)for(let f=0;f<3;f++)o[l+u*4+f]=r[c*s+u*3+f]}},t.getSendTime=()=>e._sendTime.getMTime(),t.getShaderCode=(n,r)=>{const i=[`struct ${e.label}StructEntry
{`];for(let a=0;a<e.bufferEntries.length;a++){const o=e.bufferEntries[a];i.push(`  ${o.name}: ${o.type},`)}return i.push(`
};
struct ${e.label}Struct
{
  values: array<${e.label}StructEntry>,
};
@binding(${n}) @group(${r}) var<storage, read> ${e.label}: ${e.label}Struct;
`),i.join(`
`)},t.getBindGroupEntry=()=>({resource:{buffer:e._buffer.getHandle()}}),t.clearData=()=>{e.numberOfInstances=0,e.sizeInBytes=0,e.bufferEntries=[],e._bufferEntryNames=new Map,e._buffer=null,delete e.arrayBuffer,delete e.Float32Array}}const bEt={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function Awe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,bEt,n),se.obj(t,e),e._bufferEntryNames=new Map,e.bufferEntries=[],e._sendTime={},se.obj(e._sendTime,{mtime:0}),e.bindGroupTime={},se.obj(e.bindGroupTime,{mtime:0}),e.bindGroupLayoutEntry=e.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},se.get(t,e,["bindGroupTime"]),se.setGet(t,e,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),wEt(t,e)}const SEt=se.newInstance(Awe,"vtkWebGPUStorageBuffer");var CEt={newInstance:SEt,extend:Awe};const{BufferUsage:_Et}=kwe,{vtkErrorMacro:VR}=se;function TEt(t,e){e.classHierarchy.push("vtkWebGPUUniformBuffer"),t.addEntry=(n,r)=>{if(e._bufferEntryNames.has(n)){VR(`entry named ${n} already exists`);return}e.sortDirty=!0,e._bufferEntryNames.set(n,e.bufferEntries.length),e.bufferEntries.push({name:n,type:r,sizeInBytes:rd.getByteStrideFromShaderFormat(r),offset:-1,nativeType:rd.getNativeTypeFromShaderFormat(r),packed:!1})},t.sortBufferEntries=()=>{if(!e.sortDirty)return;let n=0;const r=[];let i=4;for(let a=0;a<e.bufferEntries.length;a++){const o=e.bufferEntries[a];o.sizeInBytes%16===0&&(i=Math.max(16,i)),o.sizeInBytes%8===0&&(i=Math.max(8,i))}for(let a=0;a<e.bufferEntries.length;a++){const o=e.bufferEntries[a];o.packed===!1&&o.sizeInBytes%16===0&&(o.packed=!0,o.offset=n,r.push(o),n+=o.sizeInBytes)}for(let a=0;a<e.bufferEntries.length;a++){const o=e.bufferEntries[a];if(o.packed===!1&&o.sizeInBytes===12)for(let s=0;s<e.bufferEntries.length;s++){const c=e.bufferEntries[s];if(c.packed===!1&&c.sizeInBytes===4){o.packed=!0,o.offset=n,r.push(o),n+=o.sizeInBytes,c.packed=!0,c.offset=n,r.push(c),n+=c.sizeInBytes;break}}}for(let a=0;a<e.bufferEntries.length;a++){const o=e.bufferEntries[a];if(!o.packed&&o.sizeInBytes%8===0)for(let s=a+1;s<e.bufferEntries.length;s++){const c=e.bufferEntries[s];if(!c.packed&&c.sizeInBytes%8===0){o.packed=!0,o.offset=n,r.push(o),n+=o.sizeInBytes,c.packed=!0,c.offset=n,r.push(c),n+=c.sizeInBytes;break}}}for(let a=0;a<e.bufferEntries.length;a++){const o=e.bufferEntries[a];if(!o.packed&&o.sizeInBytes%8===0){let s=!1;for(let c=0;!s&&c<e.bufferEntries.length;c++){const l=e.bufferEntries[c];if(!l.packed&&l.sizeInBytes===4)for(let u=c+1;u<e.bufferEntries.length;u++){const f=e.bufferEntries[u];if(!f.packed&&f.sizeInBytes===4){o.packed=!0,o.offset=n,r.push(o),n+=o.sizeInBytes,l.packed=!0,l.offset=n,r.push(l),n+=l.sizeInBytes,f.packed=!0,f.offset=n,r.push(f),n+=f.sizeInBytes,s=!0;break}}}}}for(let a=0;a<e.bufferEntries.length;a++){const o=e.bufferEntries[a];!o.packed&&o.sizeInBytes>4&&(o.packed=!0,o.offset=n,r.push(o),n+=o.sizeInBytes)}for(let a=0;a<e.bufferEntries.length;a++){const o=e.bufferEntries[a];o.packed||(o.packed=!0,o.offset=n,r.push(o),n+=o.sizeInBytes)}e.bufferEntries=r,e._bufferEntryNames.clear();for(let a=0;a<e.bufferEntries.length;a++)e._bufferEntryNames.set(e.bufferEntries[a].name,a);e.sizeInBytes=n,e.sizeInBytes=i*Math.ceil(e.sizeInBytes/i),e.sortDirty=!1},t.sendIfNeeded=n=>{if(!e.UBO){const r={nativeArray:e.Float32Array,usage:_Et.UniformArray,label:e.label};e.UBO=n.getBufferManager().getBuffer(r),e.bindGroupTime.modified(),e.sendDirty=!1}e.sendDirty&&(n.getHandle().queue.writeBuffer(e.UBO.getHandle(),0,e.arrayBuffer,0,e.sizeInBytes),e.sendDirty=!1),e.sendTime.modified()},t.createView=n=>{n in e||(e.arrayBuffer||(e.arrayBuffer=new ArrayBuffer(e.sizeInBytes)),e[n]=se.newTypedArray(n,e.arrayBuffer))},t.setValue=(n,r)=>{t.sortBufferEntries();const i=e._bufferEntryNames.get(n);if(i===void 0){VR(`entry named ${n} not found in UBO`);return}const a=e.bufferEntries[i];t.createView(a.nativeType);const o=e[a.nativeType];a.lastValue!==r&&(o[a.offset/o.BYTES_PER_ELEMENT]=r,e.sendDirty=!0),a.lastValue=r},t.setArray=(n,r)=>{t.sortBufferEntries();const i=e._bufferEntryNames.get(n);if(i===void 0){VR(`entry named ${n} not found in UBO`);return}const a=e.bufferEntries[i];t.createView(a.nativeType);const o=e[a.nativeType];let s=!1;for(let c=0;c<r.length;c++)(!a.lastValue||a.lastValue[c]!==r[c])&&(o[a.offset/o.BYTES_PER_ELEMENT+c]=r[c],s=!0);s&&(e.sendDirty=!0,a.lastValue=[...r])},t.getBindGroupEntry=()=>({resource:{buffer:e.UBO.getHandle()}}),t.getSendTime=()=>e.sendTime.getMTime(),t.getShaderCode=(n,r)=>{t.sortBufferEntries();const i=[`struct ${e.label}Struct
{`];for(let a=0;a<e.bufferEntries.length;a++){const o=e.bufferEntries[a];i.push(`  ${o.name}: ${o.type},`)}return i.push(`};
@binding(${n}) @group(${r}) var<uniform> ${e.label}: ${e.label}Struct;`),i.join(`
`)}}const EEt={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function Lwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,EEt,n),se.obj(t,e),e._bufferEntryNames=new Map,e.bufferEntries=[],e.bindGroupLayoutEntry=e.bindGroupLayoutEntry||{buffer:{type:"uniform"}},e.sendTime={},se.obj(e.sendTime,{mtime:0}),e.bindGroupTime={},se.obj(e.bindGroupTime,{mtime:0}),e.sendDirty=!0,e.sortDirty=!0,se.get(t,e,["binding","bindGroupTime"]),se.setGet(t,e,["bindGroupLayoutEntry","device","label","sizeInBytes"]),TEt(t,e)}const OEt=se.newInstance(Lwe,"vtkWebGPUUniformBuffer");var Z5={newInstance:OEt,extend:Lwe};const{vtkDebugMacro:DEt}=Rs,Qee=`
//VTK::Renderer::Dec

//VTK::Mapper::Dec

//VTK::TCoord::Dec

//VTK::RenderEncoder::Dec

//VTK::IOStructs::Dec

@fragment
fn main(
//VTK::IOStructs::Input
)
//VTK::IOStructs::Output
{
  var output: fragmentOutput;

  var computedColor: vec4<f32> = mapperUBO.BackgroundColor;

  //VTK::RenderEncoder::Impl
  return output;
}
`,MEt=`
fn vecToRectCoord(dir: vec3<f32>) -> vec2<f32> {
  var tau: f32 = 6.28318530718;
  var pi: f32 = 3.14159265359;
  var out: vec2<f32> = vec2<f32>(0.0);

  out.x = atan2(dir.z, dir.x) / tau;
  out.x += 0.5;

  var phix: f32 = length(vec2(dir.x, dir.z));
  out.y = atan2(dir.y, phix) / pi + 0.5;

  return out;
}

//VTK::Renderer::Dec

//VTK::Mapper::Dec

//VTK::TCoord::Dec

//VTK::RenderEncoder::Dec

//VTK::IOStructs::Dec

@fragment
fn main(
//VTK::IOStructs::Input
)
//VTK::IOStructs::Output
{
  var output: fragmentOutput;

  var tcoord: vec4<f32> = vec4<f32>(input.vertexVC.xy, -1, 1);
  var V: vec4<f32> = normalize(mapperUBO.FSQMatrix * tcoord); // vec2<f32>((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);
  // textureSampleLevel gets rid of some ugly artifacts
  var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0.0);
  var computedColor: vec4<f32> = vec4<f32>(background.rgb, 1);

  //VTK::RenderEncoder::Impl
  return output;
}
`,OS=new Float64Array(16),Jee=new Float64Array(16);function REt(t){return t.getPositional()?t.getConeAngle()>=90?0:2:1}function IEt(t,e){e.classHierarchy.push("vtkWebGPURenderer"),t.buildPass=n=>{if(n){if(!e.renderable)return;e.camera=e.renderable.getActiveCamera(),t.updateLights(),t.prepareNodes(),t.addMissingNode(e.camera),t.addMissingNodes(e.renderable.getViewPropsWithNestedProps()),t.removeUnusedNodes(),e.webgpuCamera=t.getViewNodeFor(e.camera),t.updateStabilizedMatrix()}},t.updateStabilizedMatrix=()=>{const n=e.camera.getClippingRange(),r=e.camera.getPositionByReference(),i=e.camera.getDirectionOfProjectionByReference(),a=[],o=[];gd(o,i,.5*(n[0]+n[1])),eh(a,r,o),yr(o,a,e.stabilizedCenter),zT(o)/(n[1]-n[0])>e.recenterThreshold&&(e.stabilizedCenter=a,e.stabilizedTime.modified())},t.updateLights=()=>{let n=0;const r=e.renderable.getLightsByReference();for(let i=0;i<r.length;++i)r[i].getSwitch()>0&&n++;return n||(DEt("No lights are on, creating one."),e.renderable.createLight()),n},t.updateUBO=()=>{const n=e.UBO.getSendTime();if(e._parent.getMTime()>n||t.getMTime()>n||e.camera.getMTime()>n||e.renderable.getMTime()>n){const r=e.webgpuCamera.getKeyMatrices(t);e.UBO.setArray("WCVCMatrix",r.wcvc),e.UBO.setArray("SCPCMatrix",r.scpc),e.UBO.setArray("PCSCMatrix",r.pcsc),e.UBO.setArray("SCVCMatrix",r.scvc),e.UBO.setArray("VCPCMatrix",r.vcpc),e.UBO.setArray("WCVCNormals",r.normalMatrix),e.UBO.setValue("LightCount",e.renderable.getLights().length),e.UBO.setValue("MaxEnvironmentMipLevel",e.renderable.getEnvironmentTexture()?.getMipLevel()),e.UBO.setValue("BackgroundDiffuseStrength",e.renderable.getEnvironmentTextureDiffuseStrength()),e.UBO.setValue("BackgroundSpecularStrength",e.renderable.getEnvironmentTextureSpecularStrength());const i=t.getYInvertedTiledSizeAndOrigin();e.UBO.setArray("viewportSize",[i.usize,i.vsize]),e.UBO.setValue("cameraParallel",e.camera.getParallelProjection());const a=e._parent.getDevice();e.UBO.sendIfNeeded(a)}},t.updateSSBO=()=>{const n=e.renderable.getLights(),r=e.webgpuCamera.getKeyMatrices(t);let i=`${e.renderable.getMTime()}`;for(let a=0;a<n.length;a++)i+=n[a].getMTime();if(i!==e.lightTimeString){const a=new Float32Array(n.length*4),o=new Float32Array(n.length*4),s=new Float32Array(n.length*4),c=new Float32Array(n.length*4);for(let u=0;u<n.length;u++){const f=u*4,d=n[u].getPosition();gr(d,d,r.wcvc),a[f]=d[0],a[f+1]=d[1],a[f+2]=d[2],a[f+3]=0,o[f]=-n[u].getDirection()[0],o[f+1]=-n[u].getDirection()[1],o[f+2]=-n[u].getDirection()[2],o[f+3]=0,s[f]=n[u].getColor()[0],s[f+1]=n[u].getColor()[1],s[f+2]=n[u].getColor()[2],s[f+3]=n[u].getIntensity()*5,c[f]=REt(n[u]),c[f+1]=Math.cos(Hi(n[u].getConeAngle())),c[f+2]=Math.cos(Hi(n[u].getConeAngle()+n[u].getConeFalloff())),c[f+3]=0}e.SSBO.clearData(),e.SSBO.setNumberOfInstances(n.length),e.SSBO.addEntry("LightPos","vec4<f32>"),e.SSBO.addEntry("LightDir","vec4<f32>"),e.SSBO.addEntry("LightColor","vec4<f32>"),e.SSBO.addEntry("LightData","vec4<f32>"),e.SSBO.setAllInstancesFromArray("LightPos",a),e.SSBO.setAllInstancesFromArray("LightDir",o),e.SSBO.setAllInstancesFromArray("LightColor",s),e.SSBO.setAllInstancesFromArray("LightData",c);const l=e._parent.getDevice();e.SSBO.send(l)}e.lightTimeString=i},t.scissorAndViewport=n=>{const r=t.getYInvertedTiledSizeAndOrigin();n.getHandle().setViewport(r.lowerLeftU,r.lowerLeftV,r.usize,r.vsize,0,1),n.getHandle().setScissorRect(r.lowerLeftU,r.lowerLeftV,r.usize,r.vsize)},t.bindUBO=n=>{n.activateBindGroup(e.bindGroup)},t.opaquePass=n=>{n?(e.renderEncoder.begin(e._parent.getCommandEncoder()),t.updateUBO(),t.updateSSBO()):(t.scissorAndViewport(e.renderEncoder),t.clear(),e.renderEncoder.end())},t.clear=()=>{if(e.renderable.getTransparent()||e.suppressClear)return;const n=e._parent.getDevice();if(!e.clearFSQ){e.clearFSQ=pk.newInstance(),e.clearFSQ.setDevice(n),e.clearFSQ.setPipelineHash("clearfsq"),e.clearFSQ.setFragmentShaderTemplate(Qee);const a=Z5.newInstance({label:"mapperUBO"});a.addEntry("FSQMatrix","mat4x4<f32>"),a.addEntry("BackgroundColor","vec4<f32>"),e.clearFSQ.setUBO(a),e.backgroundTex=e.renderable.getEnvironmentTexture()}if(e.clearFSQ.getPipelineHash()!=="clearfsqwithtexture"&&e.renderable.getUseEnvironmentTextureAsBackground()&&e.backgroundTex?.getImageLoaded()){e.clearFSQ.setFragmentShaderTemplate(MEt);const a=Z5.newInstance({label:"mapperUBO"});a.addEntry("FSQMatrix","mat4x4<f32>"),a.addEntry("BackgroundColor","vec4<f32>"),e.clearFSQ.setUBO(a);const o=n.getTextureManager().getTextureForVTKTexture(e.backgroundTex);if(o.getReady()){const s=o.createView("EnvironmentTexture");e.clearFSQ.setTextureViews([s]),e.backgroundTexLoaded=!0;const c=e.backgroundTex.getInterpolate()?"linear":"nearest";s.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:c,magFilter:c,mipmapFilter:"linear"})}e.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if(e.clearFSQ.getPipelineHash()==="clearfsqwithtexture"&&!e.renderable.getUseEnvironmentTextureAsBackground()){e.clearFSQ=pk.newInstance(),e.clearFSQ.setDevice(n),e.clearFSQ.setPipelineHash("clearfsq"),e.clearFSQ.setFragmentShaderTemplate(Qee);const a=Z5.newInstance({label:"mapperUBO"});a.addEntry("FSQMatrix","mat4x4<f32>"),a.addEntry("BackgroundColor","vec4<f32>"),e.clearFSQ.setUBO(a)}const r=e.webgpuCamera.getKeyMatrices(t),i=e.renderable.getBackgroundByReference();e.clearFSQ.getUBO().setArray("BackgroundColor",i),cr(Jee,r.normalMatrix),FT(OS,r.scvc,r.pcsc),FT(OS,Jee,OS),e.clearFSQ.getUBO().setArray("FSQMatrix",OS),e.clearFSQ.getUBO().sendIfNeeded(n),e.clearFSQ.prepareAndDraw(e.renderEncoder)},t.translucentPass=n=>{n?e.renderEncoder.begin(e._parent.getCommandEncoder()):(t.scissorAndViewport(e.renderEncoder),e.renderEncoder.end())},t.volumeDepthRangePass=n=>{n?e.renderEncoder.begin(e._parent.getCommandEncoder()):(t.scissorAndViewport(e.renderEncoder),e.renderEncoder.end())},t.getAspectRatio=()=>{const n=e._parent.getSizeByReference(),r=e.renderable.getViewportByReference();return n[0]*(r[2]-r[0])/((r[3]-r[1])*n[1])},t.convertToOpenGLDepth=n=>e.webgpuCamera.convertToOpenGLDepth(n),t.getYInvertedTiledSizeAndOrigin=()=>{const n=t.getTiledSizeAndOrigin(),r=e._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},t.getTiledSizeAndOrigin=()=>{const n=e.renderable.getViewportByReference(),r=[0,0,1,1],i=n[0]-r[0],a=n[1]-r[1],o=e._parent.normalizedDisplayToDisplay(i,a),s=Math.round(o[0]),c=Math.round(o[1]),l=n[2]-r[0],u=n[3]-r[1],f=e._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(f[0])-s,h=Math.round(f[1])-c;return d<0&&(d=0),h<0&&(h=0),{usize:d,vsize:h,lowerLeftU:s,lowerLeftV:c}},t.getPropFromID=n=>{for(let r=0;r<e.children.length;r++)if((e.children[r].getPropID?e.children[r].getPropID():-1)===n)return e.children[r];return null},t.getStabilizedTime=()=>e.stabilizedTime.getMTime(),t.releaseGraphicsResources=()=>{e.selector!==null&&e.selector.releaseGraphicsResources()}}const NEt={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};function PEt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,NEt,n),La.extend(t,e,n),e.UBO=Z5.newInstance({label:"rendererUBO"}),e.UBO.addEntry("WCVCMatrix","mat4x4<f32>"),e.UBO.addEntry("SCPCMatrix","mat4x4<f32>"),e.UBO.addEntry("PCSCMatrix","mat4x4<f32>"),e.UBO.addEntry("SCVCMatrix","mat4x4<f32>"),e.UBO.addEntry("VCPCMatrix","mat4x4<f32>"),e.UBO.addEntry("WCVCNormals","mat4x4<f32>"),e.UBO.addEntry("viewportSize","vec2<f32>"),e.UBO.addEntry("LightCount","i32"),e.UBO.addEntry("MaxEnvironmentMipLevel","f32"),e.UBO.addEntry("BackgroundDiffuseStrength","f32"),e.UBO.addEntry("BackgroundSpecularStrength","f32"),e.UBO.addEntry("cameraParallel","u32"),e.SSBO=CEt.newInstance({label:"rendererLightSSBO"}),e.lightTimeString="",e.bindGroup=_we.newInstance({label:"rendererBG"}),e.bindGroup.setBindables([e.UBO,e.SSBO]),e.tmpMat4=sn(new Float64Array(16)),e.stabilizedTime={},yi(e.stabilizedTime,{mtime:0}),sc(t,e,["bindGroup","stabilizedTime"]),N2(t,e,["stabilizedCenter"]),Ja(t,e,["renderEncoder","selector","suppressClear","UBO"]),IEt(t,e)}const kEt=ri(PEt,"vtkWebGPURenderer");A2("vtkRenderer",kEt);function AEt(t,e){e.classHierarchy.push("vtkWebGPUSampler"),t.create=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};e.device=n,e.options.addressModeU=r.addressModeU?r.addressModeU:"clamp-to-edge",e.options.addressModeV=r.addressModeV?r.addressModeV:"clamp-to-edge",e.options.addressModeW=r.addressModeW?r.addressModeW:"clamp-to-edge",e.options.magFilter=r.magFilter?r.magFilter:"nearest",e.options.minFilter=r.minFilter?r.minFilter:"nearest",e.options.mipmapFilter=r.mipmapFilter?r.mipmapFilter:"nearest",e.options.label=e.label,e.handle=e.device.getHandle().createSampler(e.options),e.bindGroupTime.modified()},t.getShaderCode=(n,r)=>`@binding(${n}) @group(${r}) var ${e.label}: sampler;`,t.getBindGroupEntry=()=>({resource:e.handle})}const LEt={device:null,handle:null,label:null,options:null};function Vwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,LEt,n),se.obj(t,e),e.options={},e.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},e.bindGroupTime={},se.obj(e.bindGroupTime,{mtime:0}),se.get(t,e,["bindGroupTime","handle","options"]),se.setGet(t,e,["bindGroupLayoutEntry","device","label"]),AEt(t,e)}const VEt=se.newInstance(Vwe);var $Et={newInstance:VEt,extend:Vwe};const{SlicingMode:ete}=KE,jEt=`
//VTK::Renderer::Dec

//VTK::Mapper::Dec

//VTK::TCoord::Dec

//VTK::Image::Dec

//VTK::RenderEncoder::Dec

//VTK::IOStructs::Dec

@fragment
fn main(
//VTK::IOStructs::Input
)
//VTK::IOStructs::Output
{
  var output: fragmentOutput;

  //VTK::Image::Sample

  // var computedColor: vec4<f32> = vec4<f32>(1.0,0.7, 0.5, 1.0);

//VTK::RenderEncoder::Impl

  return output;
}
`;function UEt(t,e,n){if(e.apply(t)){const i=t.getIndependentComponents();return`${t.getMTime()}-${i}-${n}`}return"0"}const il=new Float64Array(16),qf=new Float64Array(16),DS=new Float64Array(16),h0=new Float64Array(4),Ga=new Float64Array(4);function FEt(t,e){e.classHierarchy.push("vtkWebGPUImageMapper"),t.buildPass=i=>{if(i){e.WebGPUImageSlice=t.getFirstAncestorOfType("vtkWebGPUImageSlice"),e.WebGPURenderer=e.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),e.WebGPURenderWindow=e.WebGPURenderer.getParent(),e.device=e.WebGPURenderWindow.getDevice();const a=e.WebGPURenderer.getRenderable();e.renderable.getSliceAtFocalPoint()&&e.renderable.setSliceFromCamera(a.getActiveCamera())}},t.translucentPass=i=>{i&&t.render()},t.opaquePass=i=>{i&&t.render()},t.render=()=>{e.renderable.update(),e.currentInput=e.renderable.getInputData(),t.prepareToDraw(e.WebGPURenderer.getRenderEncoder()),e.renderEncoder.registerDrawCallback(e.pipeline,t.draw)},t.computePipelineHash=()=>{const i=e.currentInput.getExtent();i[0]===i[1]||i[2]===i[3]||i[4]===i[5]?(e.dimensions=2,e.pipelineHash="img2"):(e.dimensions=3,e.pipelineHash="img3")},t.updateUBO=()=>{const i=e.UBO.getSendTime(),a=e.WebGPUImageSlice.getRenderable(),o=a.getMapper();if(t.getMTime()>i||e.renderable.getMTime()>i||a.getProperty().getMTime()>i){const s=o.getInputData(),c=e.WebGPURenderer.getStabilizedCenterByReference();sn(il),Ma(il,il,c);const l=a.getMatrix();cr(qf,l),Na(qf,qf),Xn(il,qf,il);const u=s.getWorldToIndex();Xn(il,u,il),Na(DS,il),p3(qf,[.5,.5,.5]),Xn(il,qf,il);const f=s.getDimensions();sn(qf),Ed(qf,qf,[1/f[0],1/f[1],1/f[2]]),Xn(il,qf,il),e.UBO.setArray("SCTCMatrix",il);const d=e.currentInput.getExtent(),{ijkMode:h}=e.renderable.getClosestIJKAxis();let m=e.renderable.getSlice();h!==e.renderable.getSlicingMode()&&(m=e.renderable.getSliceAtPosition(m));let p=2,y=0,x=1;h===ete.I?(p=0,y=1,x=2):h===ete.J&&(p=1,y=2,x=0),h0[p]=m,h0[y]=d[y*2]-.5,h0[x]=d[x*2]-.5,h0[3]=1,Tm(h0,h0,DS),e.UBO.setArray("Origin",h0),Ga[p]=m,Ga[y]=d[y*2+1]+.5,Ga[x]=d[x*2]-.5,Ga[3]=1,Tm(Ga,Ga,DS),Dee(Ga,Ga,h0),Ga[3]=1,e.UBO.setArray("Axis1",Ga),Ga[p]=m,Ga[y]=d[y*2]-.5,Ga[x]=d[x*2+1]+.5,Ga[3]=1,Tm(Ga,Ga,DS),Dee(Ga,Ga,h0),Ga[3]=1,e.UBO.setArray("Axis2",Ga);const S=[1,1,1,1],C=[0,0,0,0],_=e.textureViews[0],T=_.getTexture().getScale(),O=_.getTexture().getNumberOfComponents();for(let M=0;M<O;M++){let I=a.getProperty().getColorWindow(),V=a.getProperty().getColorLevel();const L=a.getProperty().getRGBTransferFunction(0);if(L){const $=L.getRange();I=$[1]-$[0],V=.5*($[1]+$[0])}S[M]=T/I,C[M]=-V/I+.5}e.UBO.setArray("cScale",S),e.UBO.setArray("cShift",C),e.UBO.sendIfNeeded(e.device)}},t.updateLUTImage=()=>{const i=e.WebGPUImageSlice.getRenderable().getProperty();t.getTextureViews()[0].getTexture().getNumberOfComponents();const o=1,s=UEt(i,i.getRGBTransferFunction,o);if(e.colorTextureString!==s){e.numRows=o;const c=new Uint8ClampedArray(e.numRows*2*e.rowLength*4);let l=i.getRGBTransferFunction();if(l){const u=new Float32Array(e.rowLength*3);for(let f=0;f<o;f++){l=i.getRGBTransferFunction(f);const d=l.getRange();l.getTable(d[0],d[1],e.rowLength,u,1);for(let h=0;h<e.rowLength;h++){const m=f*e.rowLength*8+h*4;c[m]=255*u[h*3],c[m+1]=255*u[h*3+1],c[m+2]=255*u[h*3+2],c[m+3]=255;for(let p=0;p<4;p++)c[m+e.rowLength*4+p]=c[m+p]}}}else for(let u=0;u<e.rowLength;++u){const f=255*u/(e.rowLength-1);c[u*4]=f,c[u*4+1]=f,c[u*4+2]=f,c[u*4+3]=255;for(let d=0;d<4;d++)c[u*4+e.rowLength*4+d]=c[u*4+d]}{const u={nativeArray:c,width:e.rowLength,height:e.numRows*2,depth:1,format:"rgba8unorm"},d=e.device.getTextureManager().getTexture(u).createView("tfunTexture");e.textureViews[1]=d}e.colorTextureString=s}};const n=t.updateBuffers;t.updateBuffers=()=>{n();const i=e.device.getTextureManager().getTextureForImageData(e.currentInput),a=e.textureViews;if(!a[0]||a[0].getTexture()!==i){const c=i.createView("imgTexture");a[0]=c}t.updateLUTImage(),t.updateUBO();const s=e.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===Lm.NEAREST?"nearest":"linear";(!e.clampSampler||s!==e.clampSampler.getOptions().minFilter)&&(e.clampSampler=$Et.newInstance({label:"clampSampler"}),e.clampSampler.create(e.device,{minFilter:s,magFilter:s}),e.additionalBindables=[e.clampSampler])};const r=t.getShaderReplacements();t.replaceShaderPosition=(i,a,o)=>{const s=a.getShaderDescription("vertex");s.addBuiltinOutput("vec4<f32>","@builtin(position) Position");let c=s.getCode();const l=["var pos: vec4<f32> = mapperUBO.Origin +","   (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];e.dimensions===2?l.push("var tcoord : vec2<f32> = (mapperUBO.SCTCMatrix * pos).xy;"):l.push("var tcoord : vec3<f32> = (mapperUBO.SCTCMatrix * pos).xyz;"),l.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),c=vl.substitute(c,"//VTK::Position::Impl",l).result,s.setCode(c)},r.set("replaceShaderPosition",t.replaceShaderPosition),t.replaceShaderTCoord=(i,a,o)=>{const s=a.getShaderDescription("vertex");e.dimensions===2?s.addOutput("vec2<f32>","tcoordVS"):s.addOutput("vec3<f32>","tcoordVS")},r.set("replaceShaderTCoord",t.replaceShaderTCoord),t.replaceShaderImage=(i,a,o)=>{const s=a.getShaderDescription("fragment");let c=s.getCode();e.dimensions===3?c=vl.substitute(c,"//VTK::Image::Sample",["    var computedColor: vec4<f32> =","      textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result:c=vl.substitute(c,"//VTK::Image::Sample",["    var computedColor: vec4<f32> =","      textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,c=vl.substitute(c,"//VTK::Image::Sample",["    var coord: vec2<f32> =","      vec2<f32>(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);","    computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,s.setCode(c)},r.set("replaceShaderImage",t.replaceShaderImage)}const BEt={rowLength:1024};function zEt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,BEt,n),pk.extend(t,e,n),t.setFragmentShaderTemplate(jEt),e.UBO=Z5.newInstance({label:"mapperUBO"}),e.UBO.addEntry("SCTCMatrix","mat4x4<f32>"),e.UBO.addEntry("Origin","vec4<f32>"),e.UBO.addEntry("Axis2","vec4<f32>"),e.UBO.addEntry("Axis1","vec4<f32>"),e.UBO.addEntry("cScale","vec4<f32>"),e.UBO.addEntry("cShift","vec4<f32>"),e.lutBuildTime={},yi(e.lutBuildTime,{mtime:0}),e.imagemat=sn(new Float64Array(16)),e.imagematinv=sn(new Float64Array(16)),e.VBOBuildTime={},yi(e.VBOBuildTime),FEt(t,e)}const GEt=ri(zEt,"vtkWebGPUImageMapper");A2("vtkImageMapper",GEt);function WEt(t,e){e.classHierarchy.push("vtkWebGPUImageSlice"),t.buildPass=n=>{if(!(!e.renderable||!e.renderable.getVisibility())&&n){if(!e.renderable)return;e.WebGPURenderer=t.getFirstAncestorOfType("vtkWebGPURenderer"),e.WebGPURenderWindow=e.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),e.propID===void 0&&(e.propID=e.WebGPURenderWindow.getUniquePropID()),t.prepareNodes(),t.addMissingNode(e.renderable.getMapper()),t.removeUnusedNodes()}},t.traverseOpaquePass=n=>{!e.renderable||!e.renderable.getNestedVisibility()||!e.renderable.getIsOpaque()||e.WebGPURenderer.getSelector()&&!e.renderable.getNestedPickable()||(t.apply(n,!0),e.children.forEach(r=>{r.traverse(n)}),t.apply(n,!1))},t.traverseTranslucentPass=n=>{!e.renderable||!e.renderable.getNestedVisibility()||e.renderable.getIsOpaque()||e.WebGPURenderer.getSelector()&&!e.renderable.getNestedPickable()||(t.apply(n,!0),e.children.forEach(r=>{r.traverse(n)}),t.apply(n,!1))},t.queryPass=(n,r)=>{if(n){if(!e.renderable||!e.renderable.getVisibility())return;e.renderable.getIsOpaque()?r.incrementOpaqueActorCount():r.incrementTranslucentActorCount()}},t.getBufferShift=n=>(t.getKeyMatrices(n),e.bufferShift),t.getKeyMatrices=n=>{if(Math.max(e.renderable.getMTime(),n.getStabilizedTime())>e.keyMatricesTime.getMTime()){e.renderable.computeMatrix();const r=e.renderable.getMatrix(),i=n.getStabilizedCenterByReference();e.bufferShift[0]=r[3]-i[0],e.bufferShift[1]=r[7]-i[1],e.bufferShift[2]=r[11]-i[2],cr(e.keyMatrices.bcwc,r),e.renderable.getIsIdentity()?sn(e.keyMatrices.normalMatrix):(pa(e.keyMatrices.normalMatrix,e.keyMatrices.bcwc),e.keyMatrices.normalMatrix[3]=0,e.keyMatrices.normalMatrix[7]=0,e.keyMatrices.normalMatrix[11]=0,Na(e.keyMatrices.normalMatrix,e.keyMatrices.normalMatrix),cr(e.keyMatrices.normalMatrix,e.keyMatrices.normalMatrix)),Ma(e.keyMatrices.bcwc,e.keyMatrices.bcwc,[-e.bufferShift[0],-e.bufferShift[1],-e.bufferShift[2]]),Ma(e.keyMatrices.bcsc,e.keyMatrices.bcwc,[-i[0],-i[1],-i[2]]),e.keyMatricesTime.modified()}return e.keyMatrices}}const HEt={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};function qEt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,HEt,n),La.extend(t,e,n),e.keyMatricesTime={},yi(e.keyMatricesTime,{mtime:0}),e.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},e.keyMatrixTime={},yi(e.keyMatrixTime,{mtime:0}),e.keyMatrices={mcwc:sn(new Float64Array(16))},e.bufferShift=[0,0,0,0],sc(t,e,["propID","keyMatricesTime"]),WEt(t,e)}const KEt=ri(qEt,"vtkWebGPUImageSlice");A2("vtkImageSlice",KEt);function YEt(t,e){e.classHierarchy.push("vtkWebGPUVolume"),t.buildPass=i=>{!e.renderable||!e.renderable.getVisibility()||i&&(e.WebGPURenderer=t.getFirstAncestorOfType("vtkWebGPURenderer"),e.WebGPURenderWindow=e.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),e.propID===void 0&&(e.propID=e.WebGPURenderWindow.getUniquePropID()),e.renderable.getMapper().update())},t.queryPass=(i,a)=>{if(i){if(!e.renderable||!e.renderable.getVisibility())return;const o=e.renderable.getMapper().getBounds();if(!o||o.length!==6||o[0]>o[1])return;a.addVolume(t)}};const n=new Float64Array(3),r=new Float64Array(3);t.getBoundingCubePoints=(i,a)=>{const o=e.renderable.getMapper().getInputData();if(!o)return;const s=o.getExtent(),c=e.renderable.getMatrix();let l=0;for(let u=4;u<6;u++){n[2]=s[u];for(let f=2;f<4;f++){n[1]=s[f];for(let d=0;d<2;d++){n[0]=s[d],o.indexToWorld(n,r);let h=a+l*3;i[h++]=c[0]*r[0]+c[1]*r[1]+c[2]*r[2]+c[3],i[h++]=c[4]*r[0]+c[5]*r[1]+c[6]*r[2]+c[7],i[h++]=c[8]*r[0]+c[9]*r[1]+c[10]*r[2]+c[11],l++}}}},t.getKeyMatrices=i=>{if(Math.max(e.renderable.getMTime(),i.getStabilizedTime())>e.keyMatricesTime.getMTime()){e.renderable.computeMatrix();const a=e.renderable.getMatrix(),o=i.getStabilizedCenterByReference();cr(e.keyMatrices.bcwc,a),Ma(e.keyMatrices.bcsc,e.keyMatrices.bcwc,[-o[0],-o[1],-o[2]]),e.keyMatricesTime.modified()}return e.keyMatrices}}const XEt={propID:void 0,keyMatricesTime:null};function ZEt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,XEt,n),La.extend(t,e,n),e.keyMatricesTime={},se.obj(e.keyMatricesTime,{mtime:0}),e.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},se.get(t,e,["propID","keyMatricesTime"]),YEt(t,e)}const QEt=se.newInstance(ZEt,"vtkWebGPUVolume");A2("vtkVolume",QEt);function JEt(t,e){e.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),t.opaquePass=(n,r)=>{e.WebGPURenderer=t.getFirstAncestorOfType("vtkWebGPURenderer"),e.WebGPURenderWindow=e.WebGPURenderer.getParent();const i=e.WebGPURenderer.getAspectRatio(),a=e.WebGPURenderer?e.WebGPURenderer.getRenderable().getActiveCamera():null,o=e.WebGPURenderer.getTiledSizeAndOrigin(),s=null;e.renderable.getUseZValues(),e.renderable.invokeCallback(e.renderable.getInputData(),a,i,o,s)}}const e9t={};function t9t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,e9t,n),La.extend(t,e,n),JEt(t,e)}const n9t=se.newInstance(t9t,"vtkWebGPUPixelSpaceCallbackMapper");A2("vtkPixelSpaceCallbackMapper",n9t);const qu={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var $we={StructuredType:qu};const{StructuredType:g0}=$we;function r9t(t){let e=0;for(let n=0;n<3;++n)t[n*2]<t[n*2+1]&&e++;return t[0]>t[1]||t[2]>t[3]||t[4]>t[5]?g0.EMPTY:e===3?g0.XYZ_GRID:e===2?t[0]===t[1]?g0.YZ_PLANE:t[2]===t[3]?g0.XZ_PLANE:g0.XY_PLANE:e===1?t[0]<t[1]?g0.X_LINE:t[2]<t[3]?g0.Y_LINE:g0.Z_LINE:g0.SINGLE_POINT}var i9t={getDataDescriptionFromExtent:r9t,...$we};const{vtkErrorMacro:Hp}=se;function a9t(t,e){e.classHierarchy.push("vtkImageData"),t.setExtent=function(){if(e.deleted)return Hp("instance deleted - cannot call any method"),!1;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];const a=r.length===1?r[0]:r;if(a.length!==6)return!1;const o=e.extent.some((s,c)=>s!==a[c]);return o&&(e.extent=a.slice(),e.dataDescription=i9t.getDataDescriptionFromExtent(e.extent),t.modified()),o},t.setDimensions=function(){let n,r,i;if(e.deleted){Hp("instance deleted - cannot call any method");return}if(arguments.length===1){const a=arguments.length<=0?void 0:arguments[0];n=a[0],r=a[1],i=a[2]}else if(arguments.length===3)n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],i=arguments.length<=2?void 0:arguments[2];else{Hp("Bad dimension specification");return}t.setExtent(0,n-1,0,r-1,0,i-1)},t.getDimensions=()=>[e.extent[1]-e.extent[0]+1,e.extent[3]-e.extent[2]+1,e.extent[5]-e.extent[4]+1],t.getNumberOfCells=()=>{const n=t.getDimensions();let r=1;for(let i=0;i<3;i++){if(n[i]===0)return 0;n[i]>1&&(r*=n[i]-1)}return r},t.getNumberOfPoints=()=>{const n=t.getDimensions();return n[0]*n[1]*n[2]},t.getPoint=n=>{const r=t.getDimensions();if(r[0]===0||r[1]===0||r[2]===0)return Hp("Requesting a point from an empty image."),null;const i=new Float64Array(3);switch(e.dataDescription){case qu.EMPTY:return null;case qu.SINGLE_POINT:break;case qu.X_LINE:i[0]=n;break;case qu.Y_LINE:i[1]=n;break;case qu.Z_LINE:i[2]=n;break;case qu.XY_PLANE:i[0]=n%r[0],i[1]=n/r[0];break;case qu.YZ_PLANE:i[1]=n%r[1],i[2]=n/r[1];break;case qu.XZ_PLANE:i[0]=n%r[0],i[2]=n/r[0];break;case qu.XYZ_GRID:i[0]=n%r[0],i[1]=n/r[0]%r[1],i[2]=n/(r[0]*r[1]);break;default:Hp("Invalid dataDescription");break}const a=[0,0,0];return t.indexToWorld(i,a),a},t.getBounds=()=>t.extentToBounds(t.getSpatialExtent()),t.extentToBounds=n=>ci.transformBounds(n,e.indexToWorld),t.getSpatialExtent=()=>ci.inflate([...e.extent],.5),t.computeTransforms=()=>{p3(e.indexToWorld,e.origin),e.indexToWorld[0]=e.direction[0],e.indexToWorld[1]=e.direction[1],e.indexToWorld[2]=e.direction[2],e.indexToWorld[4]=e.direction[3],e.indexToWorld[5]=e.direction[4],e.indexToWorld[6]=e.direction[5],e.indexToWorld[8]=e.direction[6],e.indexToWorld[9]=e.direction[7],e.indexToWorld[10]=e.direction[8],Ed(e.indexToWorld,e.indexToWorld,e.spacing),Na(e.worldToIndex,e.indexToWorld)},t.indexToWorld=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return gr(r,n,e.indexToWorld),r},t.indexToWorldVec3=t.indexToWorld,t.worldToIndex=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return gr(r,n,e.worldToIndex),r},t.worldToIndexVec3=t.worldToIndex,t.indexToWorldBounds=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return ci.transformBounds(n,e.indexToWorld,r)},t.worldToIndexBounds=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return ci.transformBounds(n,e.worldToIndex,r)},t.onModified(t.computeTransforms),t.computeTransforms(),t.getCenter=()=>ci.getCenter(t.getBounds()),t.computeHistogram=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const i=[0,0,0,0,0,0];t.worldToIndexBounds(n,i);const a=[0,0,0],o=[0,0,0];ci.computeCornerPoints(i,a,o),QP(a,a),QP(o,o);const s=t.getDimensions();ek(a,[0,0,0],[s[0]-1,s[1]-1,s[2]-1],a),ek(o,[0,0,0],[s[0]-1,s[1]-1,s[2]-1],o);const c=s[0],l=s[0]*s[1],u=t.getPointData().getScalars().getData();let f=-1/0,d=1/0,h=0,m=0,p=0;for(let C=a[2];C<=o[2];C++)for(let _=a[1];_<=o[1];_++){let T=a[0]+_*c+C*l;for(let O=a[0];O<=o[0];O++){if(!r||r([O,_,C],i)){const M=u[T];M>f&&(f=M),M<d&&(d=M),h+=M*M,m+=M,p+=1}++T}}const y=p>0?m/p:0,x=p?Math.abs(h/p-y*y):0,S=Math.sqrt(x);return{minimum:d,maximum:f,average:y,variance:x,sigma:S,count:p}},t.computeIncrements=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const i=[];let a=r;for(let o=0;o<3;++o)i[o]=a,a*=n[o*2+1]-n[o*2]+1;return i},t.computeOffsetIndex=n=>{let[r,i,a]=n;const o=t.getExtent(),s=t.getPointData().getScalars().getNumberOfComponents(),c=t.computeIncrements(o,s);return Math.floor((Math.round(r)-o[0])*c[0]+(Math.round(i)-o[2])*c[1]+(Math.round(a)-o[4])*c[2])},t.getOffsetIndexFromWorld=n=>{const r=t.getExtent(),i=t.worldToIndex(n);for(let a=0;a<3;++a)if(i[a]<r[a*2]||i[a]>r[a*2+1])return Hp(`GetScalarPointer: Pixel ${i} is not in memory. Current extent = ${r}`),NaN;return t.computeOffsetIndex(i)},t.getScalarValueFromWorld=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const i=t.getPointData().getScalars().getNumberOfComponents();if(r<0||r>=i)return Hp(`GetScalarPointer: Scalar Component ${r} is not within bounds. Current Scalar numberOfComponents: ${i}`),NaN;const a=t.getOffsetIndexFromWorld(n);return Number.isNaN(a)?a:t.getPointData().getScalars().getComponent(a,r)}}const o9t={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:qu.EMPTY};function jwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,o9t,n),k2.extend(t,e,n),e.direction?Array.isArray(e.direction)&&(e.direction=new Float64Array(e.direction.slice(0,9))):e.direction=vf(new Float64Array(9)),e.indexToWorld=new Float64Array(16),e.worldToIndex=new Float64Array(16),se.get(t,e,["indexToWorld","worldToIndex"]),se.setGetArray(t,e,["origin","spacing"],3),se.setGetArray(t,e,["direction"],9),se.getArray(t,e,["extent"],6),a9t(t,e)}const s9t=se.newInstance(jwe,"vtkImageData");var YE={newInstance:s9t,extend:jwe};const tte=[[0,-1,0],[0,1,0],[0,0,-1],[0,0,1]],nte=[[0,-1,0],[0,1,0]],c9t=[[0,-1,0],[0,1,0],[0,0,-1]],l9t=[[0,-1,0],[0,1,0],[0,0,1]],TB=class TB{static copyMap(e,n){for(const[r,i]of n.rows)e.rows.set(r,structuredClone(i))}constructor(e,n,r=1){this.rows=new Map,this.height=1,this.width=1,this.depth=1,this.jMultiple=1,this.kMultiple=1,this.numComps=1,this.pixelDataConstructor=Uint8Array,this.updateScalarData=function(i){i.fill(0);const a=(o,s,c)=>{const{start:l,end:u,value:f}=s;for(let d=l;d<u;d++)i[o+d]=f};this.forEach(a)},this.get=i=>{const a=i%this.jMultiple,o=(i-a)/this.jMultiple;return this.getRLE(a,o)?.value??this.defaultValue},this.getRun=(i,a)=>{const o=i+a*this.height;return this.rows.get(o)},this.set=(i,a)=>{if(a===void 0)return;const o=i%this.width,s=(i-o)/this.width,c=this.rows.get(s);if(!c){this.rows.set(s,[{start:o,end:o+1,value:a}]);return}const l=this.findIndex(c,o),u=c[l],f=c[l-1];if(!u){if(!f||f.value!==a||f.end!==o){c[l]={start:o,end:o+1,value:a};return}f.end++;return}const{start:d,end:h,value:m}=u;if(a===m&&o>=d)return;const p={start:o,end:o+1,value:a},y=o>d,x=y?l+1:l,S=y?u:f;let C=y?c[l+1]:u;if(S?.value===a&&S?.end===o){S.end++,C?.value===a&&C.start===o+1?(S.end=C.end,c.splice(l,1)):C?.start===o&&(C.start++,C.start===C.end&&(c.splice(l,1),C=c[l],C?.start===o+1&&C.value===a&&(S.end=C.end,c.splice(l,1))));return}if(C?.value===a&&C.start===o+1){C.start--,S?.end>o&&(S.end=o,S.end===S.start&&c.splice(l,1));return}if(C?.start===o&&C.end===o+1){C.value=a;const _=c[l+1];_?.start==o+1&&_.value===a&&(c.splice(l+1,1),C.end=_.end);return}o===C?.start&&C.start++,y&&h>o+1?c.splice(x,0,p,{start:o+1,end:S.end,value:S.value}):c.splice(x,0,p),S?.end>o&&(S.end=o)},this.width=e,this.height=n,this.depth=r,this.jMultiple=e,this.kMultiple=this.jMultiple*n}toIJK(e){const n=e%this.jMultiple,r=(e-n)/this.jMultiple%this.height,i=Math.floor(e/this.kMultiple);return[n,r,i]}toIndex([e,n,r]){return e+r*this.kMultiple+n*this.jMultiple}getRLE(e,n,r=0){const i=this.rows.get(n+r*this.height);if(!i)return;const a=this.findIndex(i,e),o=i[a];return e>=o?.start?o:void 0}has(e){const n=e%this.jMultiple,r=(e-n)/this.jMultiple;return this.getRLE(n,r)?.value!==void 0}delete(e){const n=e%this.width,r=(e-n)/this.width,i=this.rows.get(r);if(!i)return;const a=this.findIndex(i,n),o=i[a];if(!o||o.start>n)return;if(o.end===n+1){o.end--,o.start>=o.end&&(i.splice(a,1),i.length||this.rows.delete(r));return}if(o.start===n){o.start++;return}const s={value:o.value,start:n+1,end:o.end};o.end=n,i.splice(a+1,0,s)}findIndex(e,n){for(let r=0;r<e.length;r++){const{end:i}=e[r];if(n<i)return r}return e.length}forEach(e,n){const r=n?.rowModified;for(const[i,a]of this.rows){const o=r?[...a]:a;for(const s of o)e(i*this.width,s,a)}}forEachRow(e){for(const[n,r]of this.rows)e(n*this.width,r)}clear(){this.rows.clear()}keys(){return[...this.rows.keys()]}getPixelData(e=0,n){n?n.fill(0):n=new this.pixelDataConstructor(this.width*this.height*this.numComps);const{width:r,height:i,numComps:a}=this;for(let o=0;o<i;o++){const s=this.getRun(o,e);if(s)if(a===1)for(const c of s){const l=o*r,{start:u,end:f,value:d}=c;for(let h=u;h<f;h++)n[l+h]=d}else for(const c of s){const l=o*r*a,{start:u,end:f,value:d}=c;for(let h=u;h<f;h+=a)for(let m=0;m<a;m++)n[l+h+m]=d[m]}}return n}floodFill(e,n,r,i,a){const o=this.getRLE(e,n,r);if(!o)throw new Error(`Initial point ${e},${n},${r} isn't in the RLE`);const s=[[o,n,r]],c=o.value;if(c===i)throw new Error(`source (${c}) and destination (${i}) are identical`);return this.flood(s,c,i,a)}flood(e,n,r,i){let a=0;const{planar:o=!0,diagonals:s=!0,singlePlane:c=!1}=i||{},l={planar:o,diagonals:s,singlePlane:c};for(;e.length;){const u=e.pop(),[f]=u;if(f.value!==n)continue;f.value=r,a+=f.end-f.start;const d=this.findAdjacents(u,l).filter(h=>h&&h[0].value===n);e.push(...d)}return a}fillFrom(e,n){for(let r=n[2][0];r<=n[2][1];r++)for(let i=n[1][0];i<=n[1][1];i++){let a,o;for(let s=n[0][0];s<=n[0][1];s++){const c=e(s,i,r);if(c===void 0){a=void 0;continue}o||(o=[],this.rows.set(i+r*this.height,o)),a&&a.value!==c&&(a=void 0),a||(a={start:s,end:s,value:c},o.push(a)),a.end++}}}findAdjacents(e,{diagonals:n=!0,planar:r=!0,singlePlane:i=!1}){const[a,o,s,c]=e,{start:l,end:u}=a,f=l>0&&this.getRLE(l-1,o,s),d=u<this.width&&this.getRLE(u,o,s),h=n?[l>0?l-1:l,u<this.width?u+1:u]:[l,u],m=[];f&&m.push([f,o,s]),d&&m.push([d,o,s]);for(const p of c||(i?nte:tte)){const[,y,x]=p,S=y+o,C=x+s;if(S<0||S>=this.height||C<0||C>=this.depth)continue;const _=this.getRun(S,C);if(_)for(const T of _){const O=c||i&&nte||r&&x>0&&l9t||r&&x<0&&c9t||tte;T.end<=h[0]||T.start>=h[1]||m.push([T,S,C,O])}}return m}};TB.getScalarData=function(e=Uint8ClampedArray){const n=new e(this.frameSize);return this.map.updateScalarData(n),n};let Cg=TB,UC=class M5{constructor(e={}){this._dimensions=3,this._length=0,this._byteSize=4,this.growSize=128;const{initialSize:n=1024,dimensions:r=3,growSize:i=128}=e,a=n*r;this.growSize=i,this.array=new ArrayBuffer(a*this._byteSize),this.data=new Float32Array(this.array),this._dimensions=r}forEach(e){for(let n=0;n<this._length;n++)e(this.getPoint(n),n)}get length(){return this._length}get dimensions(){return this._dimensions}get dimensionLength(){return this._length*this._dimensions}getPoint(e){if(e<0&&(e+=this._length),e<0||e>=this._length)return;const n=this._dimensions*e;return this.data.subarray(n,n+this._dimensions)}getPointArray(e){const n=[];if(e<0&&(e+=this._length),e<0||e>=this._length)return;const r=this._dimensions*e;for(let i=0;i<this._dimensions;i++)n.push(this.data[i+r]);return n}grow(e=1,n=this.growSize){if(this.dimensionLength+e*this._dimensions<=this.data.length)return;const r=this.data.length+n,i=new ArrayBuffer(r*this._dimensions*this._byteSize),a=new Float32Array(i);a.set(this.data),this.data=a,this.array=i}reverse(){const e=Math.floor(this._length/2);for(let n=0;n<e;n++){const r=n*this._dimensions,i=(this._length-1-n)*this._dimensions;for(let a=0;a<this._dimensions;a++){const o=this.data[r+a];this.data[r+a]=this.data[i+a],this.data[i+a]=o}}}getTypedArray(){return this.data}push(e){this.grow(1);const n=this.length*this._dimensions;for(let r=0;r<this._dimensions;r++)this.data[r+n]=e[r];this._length++}map(e){const n=[];for(let r=0;r<this._length;r++)n.push(e(this.getPoint(r),r));return n}get points(){return this.map(e=>e)}toXYZ(){const e={x:[],y:[]};this._dimensions>=3&&(e.z=[]);const{x:n,y:r,z:i}=e;return this.forEach(a=>{n.push(a[0]),r.push(a[1]),i&&i.push(a[2])}),e}static fromXYZ({x:e,y:n,z:r}){const i=M5.create3(e.length);let a=0;for(let o=0;o<e.length;o++)i.data[a++]=e[o],i.data[a++]=n[o],i.data[a++]=r?r[o]:0;return i._length=e.length,i}subselect(e=10,n=0){const r=new M5({initialSize:e,dimensions:this._dimensions});for(let i=0;i<e;i++){const a=(n+Math.floor(this.length*i/e))%this.length;r.push(this.getPoint(a))}return r}static create3(e=128,n){e=Math.max(e,n?.length||0);const r=new M5({initialSize:e,dimensions:3});return n&&n.forEach(i=>r.push(i)),r}static create2(e=128){return new M5({initialSize:e,dimensions:2})}};function Uwe(t){const e=ut(),n=t.getDimensions(),r=UC.create3(n[0]),i=UC.create3(n[1]),a=UC.create3(n[2]),o=t.getDirection(),s=o.slice(0,3),c=o.slice(3,6),l=o.slice(6,9),u=t.getSpacing(),[f,d,h]=u,m=t.indexToWorld([0,0,0]),p=Zn(s[0]*f,s[1]*f,s[2]*f),y=Zn(c[0]*d,c[1]*d,c[2]*d),x=Zn(l[0]*h,l[1]*h,l[2]*h),S=ut();for(let O=0;O<n[0];O++)r.push(eh(S,m,gd(S,p,O)));for(let O=0;O<n[1];O++)i.push(gd(S,y,O));for(let O=0;O<n[2];O++)a.push(gd(S,x,O));const C=r.getTypedArray(),_=i.getTypedArray(),T=a.getTypedArray();return(O,M=e)=>{const[I,V,k]=O,L=I*3,$=V*3,W=k*3;return M[0]=C[L]+_[$]+T[W],M[1]=C[L+1]+_[$+1]+T[W+1],M[2]=C[L+2]+_[$+2]+T[W+2],M}}function Fwe(t,e){const{pointInShapeFn:n,callback:r,boundsIJK:i,returnPoints:a=!1}=e;let o;if(t.getScalarData)o=t.getScalarData();else{const f=t.getPointData().getScalars();if(f)o=f.getData();else{const{voxelManager:d}=t.get("voxelManager")||{};d&&(o=d.getCompleteScalarDataArray())}}const s=t.getDimensions(),c=[[0,s[0]],[0,s[1]],[0,s[2]]],u=u9t({imageData:t,bounds:i||c,scalarData:o,pointInShapeFn:n,callback:r});return a?u:void 0}function u9t({imageData:t,bounds:e,scalarData:n,pointInShapeFn:r,callback:i}){const[[a,o],[s,c],[l,u]]=e,{numComps:f}=t,d=t.getDimensions(),h=Uwe(t),m=[0,0,0],p=f||n.length/d[2]/d[1]/d[0],y=d[0]*p,x=d[1]*y,S=[];for(let C=l;C<=u;C++){m[2]=C;const _=C*x;for(let T=s;T<=c;T++){m[1]=T;const O=_+T*y;for(let M=a;M<=o;M++){m[0]=M;const I=h(m);if(r(I,m)){const V=O+M*p;let k;p>2?k=[n[V],n[V+1],n[V+2]]:k=n[V],S.push({value:k,index:V,pointIJK:m,pointLPS:I.slice()}),i({value:k,index:V,pointIJK:m,pointLPS:I})}}}}return S}function f9t({voxelManager:t,bounds:e,imageData:n,pointInShapeFn:r,callback:i,returnPoints:a}){const[[o,s],[c,l],[u,f]]=e,d=Uwe(n),h=[0,0,0],m=[];for(let p=u;p<=f;p++){h[2]=p;for(let y=c;y<=l;y++){h[1]=y;for(let x=o;x<=s;x++){h[0]=x;const S=d(h);if(r(S,h)){const C=t.toIndex(h),_=t.getAtIndex(C);a&&m.push({value:_,index:C,pointIJK:[...h],pointLPS:S.slice()}),i?.({value:_,index:C,pointIJK:h,pointLPS:S})}}}}return m}const d9t=5*1024;class oi{get id(){return this._id}constructor(e,n){this.modifiedSlices=new Set,this.boundsIJK=[[1/0,-1/0],[1/0,-1/0],[1/0,-1/0]],this.scalarData=null,this._sliceDataCache=null,this.getAtIJK=(r,i,a)=>{const o=this.toIndex([r,i,a]);return this._get(o)},this.setAtIJK=(r,i,a,o)=>{const s=this.toIndex([r,i,a]),c=this._set(s,o);return c!==!1&&(this.modifiedSlices.add(a),oi.addBounds(this.boundsIJK,[r,i,a])),c},this.getAtIJKPoint=([r,i,a])=>this.getAtIJK(r,i,a),this.setAtIJKPoint=([r,i,a],o)=>{this.setAtIJK(r,i,a,o)},this.getAtIndex=r=>this._get(r),this.setAtIndex=(r,i)=>{const a=this._set(r,i);if(a!==!1){const o=this.toIJK(r);this.modifiedSlices.add(o[2]),oi.addBounds(this.boundsIJK,o)}return a},this.getMiddleSliceData=()=>{const r=Math.floor(this.dimensions[2]/2);return this.getSliceData({sliceIndex:r,slicePlane:2})},this.forEach=(r,i={})=>{const a=i.boundsIJK||this.getBoundsIJK(),o=i.isInObject||this.isInObject||(()=>!0),s=i.returnPoints||!1,c=i.imageData,l=Math.min(a[0][0],a[0][1]),u=Math.max(a[0][0],a[0][1]),f=Math.min(a[1][0],a[1][1]),d=Math.max(a[1][0],a[1][1]),h=Math.min(a[2][0],a[2][1]),m=Math.max(a[2][0],a[2][1]),p=[];if(c)return f9t({voxelManager:this,imageData:i.imageData,bounds:[[l,u],[f,d],[h,m]],pointInShapeFn:o,callback:r,returnPoints:s});if(this.map){if(this.map instanceof Cg)return this.rleForEach(r,i);for(const y of this.map.keys()){const x=this.toIJK(y);if(!o(null,x))continue;const S=this._get(y);s&&p.push({value:S,index:y,pointIJK:x,pointLPS:null}),r({value:S,index:y,pointIJK:x,pointLPS:null})}return p}else{for(let y=h;y<=m;y++){const x=y*this.frameSize;for(let S=f;S<=d;S++){const C=x+S*this.width;for(let _=l,T=C+_;_<=u;_++,T++){const O=this.getAtIndex(T),M=[_,S,y];o(null,M)&&(s&&p.push({value:O,index:T,pointIJK:M,pointLPS:null}),r({value:O,index:T,pointIJK:[_,S,y],pointLPS:null}))}}}return p}},this.getSliceData=({sliceIndex:r,slicePlane:i})=>{const[a,o,s]=this.dimensions,c=a*o,l=r*c;let u;const f=this.getConstructor();function d(m){return typeof m=="function"}if(!d(f))return new Uint8Array(0);let h;switch(i){case 0:u=o*s,h=new f(u);for(let m=0;m<o;m++)for(let p=0;p<s;p++){const y=r+m*a+p*c;this.setSliceDataValue(h,m*s+p,this._get(y))}break;case 1:u=a*s,h=new f(u);for(let m=0;m<a;m++)for(let p=0;p<s;p++){const y=m+r*a+p*c;this.setSliceDataValue(h,m+p*a,this._get(y))}break;case 2:u=a*o,h=new f(u);for(let m=0;m<u;m++)this.setSliceDataValue(h,m,this._get(l+m));break;default:throw new Error("Oblique plane - todo - implement as ortho normal vector")}return h},this.dimensions=e,this.width=e[0],this.frameSize=this.width*e[1],this._get=n._get,this._set=n._set,this._id=n._id||"",this._getConstructor=n._getConstructor,this.numberOfComponents=this.numberOfComponents||1,this.scalarData=n.scalarData,this._getScalarData=n._getScalarData,this._updateScalarData=n._updateScalarData}getMinMax(){let e,n;const r=({value:i})=>{const a=Array.isArray(i);if(e===void 0&&(e=a?[...i]:i,n=a?[...i]:i),a)for(let o=0;o<i.length;o++)e[o]=Math.min(e[o],i[o]),n[o]=Math.max(n[o],i[o]);else e=Math.min(e,i),n=Math.max(n,i)};return this.forEach(r,{boundsIJK:this.getDefaultBounds()}),{min:e,max:n}}toIJK(e){return[e%this.width,Math.floor(e%this.frameSize/this.width),Math.floor(e/this.frameSize)]}toIndex(e){return e[0]+e[1]*this.width+e[2]*this.frameSize}getDefaultBounds(){return this.dimensions.map(e=>[0,e-1])}getBoundsIJK(){return this.boundsIJK[0][0]<this.dimensions[0]?this.boundsIJK:this.getDefaultBounds()}rleForEach(e,n){const r=n?.boundsIJK||this.getBoundsIJK(),{isWithinObject:i}=n||{},a=this.map;if(!a){console.warn("No map found, you need to use a map voxel manager to use rleForEach");return}a.defaultValue=void 0;for(let o=r[2][0];o<=r[2][1];o++)for(let s=r[1][0];s<=r[1][1];s++){const c=a.getRun(s,o);if(c)for(const l of c){const{start:u,end:f,value:d}=l,h=this.toIndex([0,s,o]);for(let m=u;m<f;m++){const p={value:d,index:h+m,pointIJK:[m,s,o]};i?.(p)!==!1&&e(p)}}}}getScalarData(e=!1){if(this.scalarData)return this._updateScalarData?.(this.scalarData),this.scalarData;if(this._getScalarData){const n=this._getScalarData();return e&&console.log("Not transient, should store value",n),n}throw new Error("No scalar data available")}setScalarData(e){this.scalarData=e}getScalarDataLength(){if(this.scalarData)return this.scalarData.length;if(this._getScalarDataLength)return this._getScalarDataLength();throw new Error("No scalar data available")}get sizeInBytes(){return this.getScalarDataLength()*this.bytePerVoxel}get bytePerVoxel(){return this.scalarData?this.scalarData.BYTES_PER_ELEMENT:this._get(0).BYTES_PER_ELEMENT}clearBounds(){this.boundsIJK.map(e=>{e[0]=1/0,e[1]=-1/0})}clear(){this.map?.clear(),this.clearBounds(),this.modifiedSlices.clear(),this.points?.clear()}getConstructor(){return this.scalarData?this.scalarData.constructor:this._getConstructor?this._getConstructor():(console.warn("No scalar data available or can be used to get the constructor"),Float32Array)}getArrayOfModifiedSlices(){return Array.from(this.modifiedSlices)}resetModifiedSlices(){this.modifiedSlices.clear()}setBounds(e){this.boundsIJK=e}static addBounds(e,n){e||(e=[[1/0,-1/0],[1/0,-1/0],[1/0,-1/0]]),e[0][0]=Math.min(n[0],e[0][0]),e[0][1]=Math.max(n[0],e[0][1]),e[1][0]=Math.min(n[1],e[1][0]),e[1][1]=Math.max(n[1],e[1][1]),e[2][0]=Math.min(n[2],e[2][0]),e[2][1]=Math.max(n[2],e[2][1])}addPoint(e){const n=Array.isArray(e)?e[0]+this.width*e[1]+this.frameSize*e[2]:e;this.points||(this.points=new Set),this.points.add(n)}getPoints(){return this.points?[...this.points].map(e=>this.toIJK(e)):[]}setSliceDataValue(e,n,r){if(Array.isArray(r))for(let i=0;i<r.length;i++)e[n*r.length+i]=this.toNumber(r[i]);else e[n]=this.toNumber(r)}toNumber(e){return typeof e=="number"?e:Array.isArray(e)&&e[0]||0}static _createRGBScalarVolumeVoxelManager({dimensions:e,scalarData:n,numberOfComponents:r=3,id:i}){const a=new oi(e,{_get:o=>(o*=r,[n[o++],n[o++],n[o++]]),_id:i||"_createRGBScalarVolumeVoxelManager",_set:(o,s)=>{o*=3;const c=!Lr(n[o],s);return n[o++]=s[0],n[o++]=s[1],n[o++]=s[2],c},numberOfComponents:r,scalarData:n});return a.clear=()=>{n.fill(0)},a}static createImageVolumeVoxelManager({dimensions:e,imageIds:n,numberOfComponents:r=1,id:i}){const a=e[0]*e[1];function o(f){const d=Math.floor(f/a);if(d<0||d>=e[2])return{};const h=n[d];if(!h)return console.warn(`ImageId not found for sliceIndex: ${d}`),{pixelData:null,pixelIndex:null};const m=Ct.getImage(h);if(!m)return console.warn(`Image not found for imageId: ${h}`),{pixelData:null,pixelIndex:null};const p=m.voxelManager,y=f%a;return{voxelManager:p,pixelIndex:y}}function s(f){const{voxelManager:d,pixelIndex:h}=o(f);return!d||h===null?null:d.getAtIndex(h)}function c(f,d){const{voxelManager:h,pixelIndex:m}=o(f);if(!h||m===null)return!1;const p=h.getAtIndex(m),y=!Lr(d,p);return y&&(h.setAtIndex(m,d),!0)}const l=()=>{const{voxelManager:f,pixelIndex:d}=o(0);return!f||d===null?null:f.getConstructor()},u=new oi(e,{_get:s,_set:c,numberOfComponents:r,_getConstructor:l,_id:i||"createImageVolumeVoxelManager"});return u.getMiddleSliceData=()=>{const f=Math.floor(e[2]/2);return u.getSliceData({sliceIndex:f,slicePlane:2})},u.clear=()=>{for(const f of n)Ct.getImage(f).voxelManager.clear()},u.getRange=()=>{let f=1/0,d=-1/0;for(const h of n){const m=Ct.getImage(h);m&&(m.minPixelValue<f&&(f=m.minPixelValue),m.maxPixelValue>d&&(d=m.maxPixelValue))}return f===1/0&&d===-1/0?[0,0]:[f,d]},u._getScalarDataLength=()=>{const{voxelManager:f,pixelIndex:d}=o(0);return!f||d===null?0:f.getScalarDataLength()*e[2]},u.getCompleteScalarDataArray=()=>{const f=u._getConstructor();if(!f)return new Uint8Array(0);const d=u.getScalarDataLength(),h=new f(d),m=e[0]*e[1]*r;for(let p=0;p<e[2];p++){const{voxelManager:y,pixelIndex:x}=o(p*m/r);if(y&&x!==null){const S=p*m,C=y.getScalarData();if(r===1)h.set(C,S);else for(let _=0;_<C.length;_+=r)for(let T=0;T<r;T++)h[S+_+T]=C[_+T]}}return h},u.setCompleteScalarDataArray=f=>{const d=e[0]*e[1]*r,h=u._getConstructor();let m=1/0,p=-1/0;for(let y=0;y<e[2];y++){const{voxelManager:x}=o(y*d/r);if(x&&h){const S=y*d,C=S+d,_=new h(d);if(_.set(f.subarray(S,C)),x.scalarData)x.scalarData.set(_),x.modifiedSlices.add(y);else for(let M=0;M<d;M++)x.setAtIndex(M,_[M]);for(let M=0;M<_.length;M++){const I=_[M];m=Math.min(m,I),p=Math.max(p,I)}const T=n[y],O=Ct.getImage(T);O&&(O.minPixelValue=m,O.maxPixelValue=p)}}for(let y=0;y<e[2];y++)u.modifiedSlices.add(y);u.boundsIJK=[[0,e[0]-1],[0,e[1]-1],[0,e[2]-1]]},u}static createScalarVolumeVoxelManager({dimensions:e,scalarData:n,numberOfComponents:r,id:i}){if(e.length!==3)throw new Error("Dimensions must be provided as [number, number, number] for [width, height, depth]");if(!r&&(r=n.length/e[0]/e[1]/e[2],r>4||r<1||r===2))throw new Error(`Number of components ${r} must be 1, 3 or 4`);return r>1?oi._createRGBScalarVolumeVoxelManager({dimensions:e,scalarData:n,numberOfComponents:r,id:i}):oi._createNumberVolumeVoxelManager({dimensions:e,scalarData:n,id:i})}static createScalarDynamicVolumeVoxelManager({imageIdGroups:e,dimensions:n,dimensionGroupNumber:r=1,timePoint:i=0,numberOfComponents:a=1,id:o}){let s=0;if(r!==void 0?s=r-1:i!==void 0&&(console.warn("Warning: timePoint parameter is deprecated. Please use dimensionGroupNumber instead. timePoint is zero-based while dimensionGroupNumber starts at 1."),s=i),!a){const u=Ct.getImage(e[0][0]);if(!u)throw new Error("Unable to determine number of components: No image found");if(a=u.getPixelData().length/(n[0]*n[1]),a>4||a<1||a===2)throw new Error(`Number of components ${a} must be 1, 3 or 4`)}const c=e.map(u=>oi.createImageVolumeVoxelManager({dimensions:n,imageIds:u,numberOfComponents:a,id:o})),l=new oi(n,{_get:u=>c[s]._get(u),_set:(u,f)=>c[s]._set(u,f),numberOfComponents:a,_id:o||"createScalarDynamicVolumeVoxelManager"});return l.getScalarDataLength=()=>c[s].getScalarDataLength(),l.getConstructor=()=>c[s].getConstructor(),l.getRange=()=>c[s].getRange(),l.getMiddleSliceData=()=>c[s].getMiddleSliceData(),l.setTimePoint=u=>{console.warn("Warning: setTimePoint is deprecated. Please use setDimensionGroupNumber instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1."),l.setDimensionGroupNumber(u+1)},l.setDimensionGroupNumber=u=>{s=u-1,l._get=f=>c[s]._get(f),l._set=(f,d)=>c[s]._set(f,d)},l.getAtIndexAndTimePoint=(u,f)=>(console.warn("Warning: getAtIndexAndTimePoint is deprecated. Please use getAtIndexAndDimensionGroup instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1."),l.getAtIndexAndDimensionGroup(u,f+1)),l.getAtIndexAndDimensionGroup=(u,f)=>c[f-1]._get(u),l.getTimePointScalarData=u=>(console.warn("Warning: getTimePointScalarData is deprecated. Please use getDimensionGroupScalarData instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1."),l.getDimensionGroupScalarData(u+1)),l.getDimensionGroupScalarData=u=>c[u-1].getCompleteScalarDataArray(),l.getCurrentTimePointScalarData=()=>(console.warn("Warning: getCurrentTimePointScalarData is deprecated. Please use getCurrentDimensionGroupScalarData instead."),l.getCurrentDimensionGroupScalarData()),l.getCurrentDimensionGroupScalarData=()=>c[s].getCompleteScalarDataArray(),l.getCurrentTimePoint=()=>(console.warn("Warning: getCurrentTimePoint is deprecated. Please use getCurrentDimensionGroupNumber instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1."),s),l.getCurrentDimensionGroupNumber=()=>s+1,l}static createImageVoxelManager({width:e,height:n,scalarData:r,numberOfComponents:i=1,id:a}){const o=[e,n,1];if(!i&&(i=r.length/e/n,i>4||i<1||i===2))throw new Error(`Number of components ${i} must be 1, 3 or 4`);return i>1?oi._createRGBScalarVolumeVoxelManager({dimensions:o,scalarData:r,numberOfComponents:i,id:a}):oi._createNumberVolumeVoxelManager({dimensions:o,scalarData:r,id:a})}static _createNumberVolumeVoxelManager({dimensions:e,scalarData:n,id:r}){const i=new oi(e,{_get:a=>n[a],_set:(a,o)=>{const s=n[a]!==o;return n[a]=o,s},_getConstructor:()=>n.constructor,_id:r||"_createNumberVolumeVoxelManager"});return i.scalarData=n,i.clear=()=>{i.scalarData.fill(0)},i.getMiddleSliceData=()=>{const a=Math.floor(e[2]/2);return i.getSliceData({sliceIndex:a,slicePlane:2})},i}static createMapVoxelManager({dimension:e,id:n}){const r=new Map,i=new oi(e,{_get:r.get.bind(r),_set:(a,o)=>r.set(a,o)&&!0,_id:n||"createMapVoxelManager"});return i.map=r,i}static createHistoryVoxelManager(e,n){const r=new Map,{dimensions:i}=e,a=new oi(i,{_get:o=>r.get(o),_set:function(o,s){if(r.has(o))s===r.get(o)&&r.delete(o);else{const c=this.sourceVoxelManager.getAtIndex(o);if(c===s)return!1;r.set(o,c)}this.sourceVoxelManager.setAtIndex(o,s)},_id:n||"createHistoryVoxelManager"});return a.map=r,a.scalarData=e.scalarData,a.sourceVoxelManager=e,a}static createRLEHistoryVoxelManager(e,n){const{dimensions:r}=e,i=new Cg(r[0],r[1],r[2]),a=new oi(r,{_get:o=>i.get(o),_set:function(o,s){const c=i.get(o);if(c===void 0){const l=this.sourceVoxelManager.getAtIndex(o);if(l===s||l===void 0&&s===0||s===null)return!1;i.set(o,l??0)}else(s===c||s===null)&&(i.delete(o),s=c);this.sourceVoxelManager.setAtIndex(o,s)},_getScalarData:Cg.getScalarData,_updateScalarData:o=>(i.updateScalarData(o),o),_id:n||"createRLEHistoryVoxelManager"});return a.map=i,a.sourceVoxelManager=e,a}static createLazyVoxelManager({dimensions:e,planeFactory:n,id:r}){const i=new Map,[a,o]=e,s=a*o,c=new oi(e,{_get:l=>i.get(Math.floor(l/s))[l%s],_set:(l,u)=>{const f=Math.floor(l/s);let d=i.get(f);return d||(d=n(a,o),i.set(f,d)),d[l%s]=u,!0},_id:r||"createLazyVoxelManager"});return c.map=i,c}static createRLEVolumeVoxelManager({dimensions:e,id:n}){const[r,i,a]=e,o=new Cg(r,i,a),s=new oi(e,{_get:c=>o.get(c),_set:(c,l)=>(o.set(c,l),!0),_getScalarData:Cg.getScalarData,_updateScalarData:c=>(o.updateScalarData(c),c),_id:n||"createRLEVolumeVoxelManager"});return s.map=o,s.getPixelData=o.getPixelData.bind(o),s}static createRLEImageVoxelManager({dimensions:e,id:n}){const[r,i]=e;return oi.createRLEVolumeVoxelManager({dimensions:[r,i,1],id:n})}static addInstanceToImage(e){const{width:n,height:r}=e,i=e.voxelManager.getScalarData();if(i.length>=n*r){e.voxelManager=oi.createScalarVolumeVoxelManager({dimensions:[n,r,1],scalarData:i});return}e.voxelManager=oi.createRLEVolumeVoxelManager({dimensions:[n,r,1]}),e.getPixelData=e.voxelManager.getPixelData,e.sizeInBytes=d9t}}const h9t="WebGL",ZT=Object.create(null);function Bwe(t,e){ZT[t]=e}function g9t(){return Object.keys(ZT)}function zwe(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ZT[t]&&ZT[t](e)}function p9t(t,e){e.classHierarchy.push("vtkRenderWindow"),t.addRenderer=n=>{t.hasRenderer(n)||(n.setRenderWindow(t),e.renderers.push(n),t.modified())},t.removeRenderer=n=>{e.renderers=e.renderers.filter(r=>r!==n),t.modified()},t.hasRenderer=n=>e.renderers.indexOf(n)!==-1,t.newAPISpecificView=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return zwe(n||e.defaultViewAPI,r)},t.addView=n=>{t.hasView(n)||(n.setRenderable(t),e._views.push(n),t.modified())},t.removeView=n=>{e._views=e._views.filter(r=>r!==n),t.modified()},t.hasView=n=>e._views.indexOf(n)!==-1,t.preRender=()=>{e.renderers.forEach(n=>{n.isActiveCameraCreated()||n.resetCamera()})},t.render=()=>{t.preRender(),e.interactor?e.interactor.render():e._views.forEach(n=>n.traverseAllPasses())},t.getStatistics=()=>{const n={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return e._views.forEach(r=>{r.getGraphicsMemoryInfo&&(n.gpuMemoryMB+=r.getGraphicsMemoryInfo()/1e6)}),e.renderers.forEach(r=>{const i=r.getViewProps(),a=e._views[0].getViewNodeFor(r);i.forEach(o=>{if(o.getVisibility()){n.propCount+=1;const s=o.getMapper&&o.getMapper();if(s&&s.getPrimitiveCount){const c=a.getViewNodeFor(s);if(c){c.getAllocatedGPUMemoryInBytes&&(n.gpuMemoryMB+=c.getAllocatedGPUMemoryInBytes()/1e6);const l=s.getPrimitiveCount();Object.keys(l).forEach(u=>{n[u]||(n[u]=0),n[u]+=l[u]})}}}else n.invisiblePropCount+=1})}),n.str=Object.keys(n).map(r=>`${r}: ${n[r]}`).join(`
`),n},t.captureImages=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"image/png",r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return se.setImmediate(t.render),e._views.map(i=>i.captureNextImage?i.captureNextImage(n,r):void 0).filter(i=>!!i)},t.addRenderWindow=n=>e.childRenderWindows.includes(n)?!1:(e.childRenderWindows.push(n),t.modified(),!0),t.removeRenderWindow=n=>{const r=e.childRenderWindows.findIndex(i=>i===n);return r<0?!1:(e.childRenderWindows.splice(r,1),t.modified(),!0)}}const m9t={defaultViewAPI:h9t,renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1,childRenderWindows:[]};function Gwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,m9t,n),se.obj(t,e),se.setGet(t,e,["interactor","numberOfLayers","_views","defaultViewAPI"]),se.get(t,e,["neverRendered"]),se.getArray(t,e,["renderers","childRenderWindows"]),se.moveToProtected(t,e,["views"]),se.event(t,e,"completion"),p9t(t,e)}const v9t=se.newInstance(Gwe,"vtkRenderWindow");var y9t={newInstance:v9t,extend:Gwe,registerViewConstructor:Bwe,listViewAPIs:g9t,newAPISpecificView:zwe};function x9t(t,e){e.classHierarchy.push("vtkRenderPass"),t.getOperation=()=>e.currentOperation,t.setCurrentOperation=n=>{e.currentOperation=n,e.currentTraverseOperation=`traverse${se.capitalize(e.currentOperation)}`},t.getTraverseOperation=()=>e.currentTraverseOperation,t.traverse=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;e.deleted||(e._currentParent=r,e.preDelegateOperations.forEach(i=>{t.setCurrentOperation(i),n.traverse(t)}),e.delegates.forEach(i=>{i.traverse(n,t)}),e.postDelegateOperations.forEach(i=>{t.setCurrentOperation(i),n.traverse(t)}))}}const w9t={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function Wwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,w9t,n),se.obj(t,e),se.get(t,e,["currentOperation"]),se.setGet(t,e,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),se.moveToProtected(t,e,["currentParent"]),x9t(t,e)}const b9t=se.newInstance(Wwe,"vtkRenderPass");var XE={newInstance:b9t,extend:Wwe};const{Representation:S9t}=w3,{vtkErrorMacro:rte}=se;function C9t(t){const e=Ie.substitute(t.Fragment,"//VTK::RenderPassFragmentShader::Impl",`
      float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);
      gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);
      gl_FragData[1].r = weight;
    `,!1);t.Fragment=e.result}const _9t=`//VTK::System::Dec

in vec2 tcoord;

uniform sampler2D translucentRTexture;
uniform sampler2D translucentRGBATexture;

// the output of this shader
//VTK::Output::Dec

void main()
{
  vec4 t1Color = texture(translucentRGBATexture, tcoord);
  float t2Color = texture(translucentRTexture, tcoord).r;
  gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);
}
`;function T9t(t,e){e.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),t.createVertexBuffer=()=>{const n=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),r=new Float32Array([0,0,1,0,0,1,1,1]),i=new Uint16Array([4,0,1,3,2]),a=On.newInstance({numberOfComponents:3,values:n});a.setName("points");const o=On.newInstance({numberOfComponents:2,values:r});o.setName("tcoords");const s=On.newInstance({numberOfComponents:1,values:i});e.tris.getCABO().createVBO(s,"polys",S9t.SURFACE,{points:a,tcoords:o,cellOffset:0}),e.VBOBuildTime.modified()},t.createFramebuffer=n=>{const r=n.getSize(),i=n.getContext();e.framebuffer=y3.newInstance(),e.framebuffer.setOpenGLRenderWindow(n),e.framebuffer.create(...r),e.framebuffer.saveCurrentBindingsAndBuffers(),e.framebuffer.bind(),e.translucentRGBATexture=mi.newInstance(),e.translucentRGBATexture.setInternalFormat(i.RGBA16F),e.translucentRGBATexture.setFormat(i.RGBA),e.translucentRGBATexture.setOpenGLDataType(i.HALF_FLOAT),e.translucentRGBATexture.setOpenGLRenderWindow(n),e.translucentRGBATexture.create2DFromRaw(r[0],r[1],4,"Float32Array",null),e.translucentRTexture=mi.newInstance(),e.translucentRTexture.setInternalFormat(i.R16F),e.translucentRTexture.setFormat(i.RED),e.translucentRTexture.setOpenGLDataType(i.HALF_FLOAT),e.translucentRTexture.setOpenGLRenderWindow(n),e.translucentRTexture.create2DFromRaw(r[0],r[1],1,"Float32Array",null),e.translucentZTexture=mi.newInstance(),e.translucentZTexture.setOpenGLRenderWindow(n),e.translucentZTexture.createDepthFromRaw(r[0],r[1],"Float32Array",null),e.framebuffer.setColorBuffer(e.translucentRGBATexture,0),e.framebuffer.setColorBuffer(e.translucentRTexture,1),e.framebuffer.setDepthBuffer(e.translucentZTexture)},t.createCopyShader=n=>{e.copyShader=n.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join(`
`),_9t,"")},t.createVBO=n=>{const r=n.getContext();e.tris.setOpenGLRenderWindow(n),t.createVertexBuffer();const i=e.copyShader;e.tris.getCABO().bind(),e.copyVAO.addAttributeArray(i,e.tris.getCABO(),"vertexDC",e.tris.getCABO().getVertexOffset(),e.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||rte("Error setting vertexDC in copy shader VAO."),e.copyVAO.addAttributeArray(i,e.tris.getCABO(),"tcoordTC",e.tris.getCABO().getTCoordOffset(),e.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||rte("Error setting vertexDC in copy shader VAO.")},t.traverse=(n,r,i)=>{if(e.deleted)return;const a=n.getSize(),o=n.getContext();if(e._supported=!1,r.getSelector()||!o||!n.getWebgl2()||!o.getExtension("EXT_color_buffer_half_float")&&!o.getExtension("EXT_color_buffer_float")){t.setCurrentOperation("translucentPass"),r.traverse(t);return}if(e._supported=!0,e.framebuffer===null)t.createFramebuffer(n);else{const c=e.framebuffer.getSize();c===null||c[0]!==a[0]||c[1]!==a[1]?(e.framebuffer.releaseGraphicsResources(),e.translucentRGBATexture.releaseGraphicsResources(n),e.translucentRTexture.releaseGraphicsResources(n),e.translucentZTexture.releaseGraphicsResources(n),t.createFramebuffer(n)):(e.framebuffer.saveCurrentBindingsAndBuffers(),e.framebuffer.bind())}o.drawBuffers([o.COLOR_ATTACHMENT0]),o.clearBufferfv(o.COLOR,0,[0,0,0,0]),o.clearBufferfv(o.DEPTH,0,[1]),o.colorMask(!1,!1,!1,!1),i.getOpaqueActorCount()>0&&(i.setCurrentOperation("opaqueZBufferPass"),r.traverse(i)),o.colorMask(!0,!0,!0,!0),o.drawBuffers([o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]),o.viewport(0,0,a[0],a[1]),o.scissor(0,0,a[0],a[1]),o.clearBufferfv(o.COLOR,0,[0,0,0,1]),o.clearBufferfv(o.COLOR,1,[0,0,0,0]),o.enable(o.DEPTH_TEST),o.enable(o.BLEND),o.blendFuncSeparate(o.ONE,o.ONE,o.ZERO,o.ONE_MINUS_SRC_ALPHA),t.setCurrentOperation("translucentPass"),r.traverse(t),o.drawBuffers([o.NONE]),e.framebuffer.restorePreviousBindingsAndBuffers(),e.copyShader===null?t.createCopyShader(n):n.getShaderCache().readyShaderProgram(e.copyShader),e.copyVAO||(e.copyVAO=WE.newInstance(),e.copyVAO.setOpenGLRenderWindow(n)),e.copyVAO.bind(),e.VBOBuildTime.getMTime()<t.getMTime()&&t.createVBO(n),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA),o.depthMask(!1),o.depthFunc(o.ALWAYS),o.viewport(0,0,a[0],a[1]),o.scissor(0,0,a[0],a[1]),e.translucentRGBATexture.activate(),e.copyShader.setUniformi("translucentRGBATexture",e.translucentRGBATexture.getTextureUnit()),e.translucentRTexture.activate(),e.copyShader.setUniformi("translucentRTexture",e.translucentRTexture.getTextureUnit()),o.drawArrays(o.TRIANGLES,0,e.tris.getCABO().getElementCount()),o.depthMask(!0),o.depthFunc(o.LEQUAL),e.translucentRGBATexture.deactivate(),e.translucentRTexture.deactivate();const s=r.getTiledSizeAndOrigin();o.scissor(s.lowerLeftU,s.lowerLeftV,s.usize,s.vsize),o.viewport(s.lowerLeftU,s.lowerLeftV,s.usize,s.vsize)},t.getShaderReplacement=()=>e._supported?C9t:null,t.releaseGraphicsResources=n=>{e.framebuffer&&(e.framebuffer.releaseGraphicsResources(n),e.framebuffer=null),e.translucentRGBATexture&&(e.translucentRGBATexture.releaseGraphicsResources(n),e.translucentRGBATexture=null),e.translucentRTexture&&(e.translucentRTexture.releaseGraphicsResources(n),e.translucentRTexture=null),e.translucentZTexture&&(e.translucentZTexture.releaseGraphicsResources(n),e.translucentZTexture=null),e.copyVAO&&(e.copyVAO.releaseGraphicsResources(n),e.copyVAO=null),e.copyShader&&(e.copyShader.releaseGraphicsResources(n),e.copyShader=null),e.tris&&(e.tris.releaseGraphicsResources(n),e.tris=null),t.modified()}}const E9t={framebuffer:null,copyShader:null,tris:null};function Hwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,E9t,n),XE.extend(t,e,n),e.VBOBuildTime={},se.obj(e.VBOBuildTime,{mtime:0}),e.tris=Ph.newInstance(),se.get(t,e,["framebuffer"]),T9t(t,e)}const O9t=se.newInstance(Hwe,"vtkOpenGLOrderIndependentTranslucentPass");var D9t={newInstance:O9t,extend:Hwe};function M9t(t,e){e.classHierarchy.push("vtkForwardPass"),t.traverse=function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(e.deleted)return;e._currentParent=r,t.setCurrentOperation("buildPass"),n.traverse(t);const i=n.getRenderable().getNumberOfLayers(),a=n.getRenderable().getRenderersByReference();for(let o=0;o<i;o++)for(let s=0;s<a.length;s++){const c=a[s],l=n.getViewNodeFor(c);if(c.getDraw()&&c.getLayer()===o){if(e.opaqueActorCount=0,e.translucentActorCount=0,e.volumeCount=0,e.overlayActorCount=0,t.setCurrentOperation("queryPass"),l.traverse(t),(e.opaqueActorCount>0||e.translucentActorCount>0)&&e.volumeCount>0||e.depthRequested){const u=n.getFramebufferSize();e.framebuffer===null&&(e.framebuffer=y3.newInstance()),e.framebuffer.setOpenGLRenderWindow(n),e.framebuffer.saveCurrentBindingsAndBuffers();const f=e.framebuffer.getSize();(f===null||f[0]!==u[0]||f[1]!==u[1])&&(e.framebuffer.create(u[0],u[1]),e.framebuffer.populateFramebuffer()),e.framebuffer.bind(),t.setCurrentOperation("zBufferPass"),l.traverse(t),e.framebuffer.restorePreviousBindingsAndBuffers(),e.depthRequested=!1}t.setCurrentOperation("cameraPass"),l.traverse(t),e.opaqueActorCount>0&&(t.setCurrentOperation("opaquePass"),l.traverse(t)),e.translucentActorCount>0&&(e.translucentPass||(e.translucentPass=D9t.newInstance()),e.translucentPass.traverse(n,l,t)),e.volumeCount>0&&(t.setCurrentOperation("volumePass"),l.traverse(t)),e.overlayActorCount>0&&(t.setCurrentOperation("overlayPass"),l.traverse(t))}}},t.getZBufferTexture=()=>e.framebuffer?e.framebuffer.getColorTexture():null,t.requestDepth=()=>{e.depthRequested=!0},t.incrementOpaqueActorCount=()=>e.opaqueActorCount++,t.incrementTranslucentActorCount=()=>e.translucentActorCount++,t.incrementVolumeCount=()=>e.volumeCount++,t.incrementOverlayActorCount=()=>e.overlayActorCount++}const R9t={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function qwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,R9t,n),XE.extend(t,e,n),se.get(t,e,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),M9t(t,e)}const I9t=se.newInstance(qwe,"vtkForwardPass");var Kwe={newInstance:I9t,extend:qwe};const qs={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var Ywe={PassTypes:qs};const{FieldAssociations:N9t}=k2;function P9t(t,e){e.classHierarchy.push("vtkHardwareSelector"),t.getSourceDataAsync=async(n,r,i,a,o)=>{},t.selectAsync=async(n,r,i,a,o)=>{const s=await t.getSourceDataAsync(n,r,i,a,o);return s?s.generateSelection(r,i,a,o):[]}}const k9t={fieldAssociation:N9t.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Xwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,k9t,n),se.obj(t,e),se.setGet(t,e,["fieldAssociation","captureZValues"]),P9t(t,e)}const A9t=se.newInstance(Xwe,"vtkHardwareSelector");var L9t={newInstance:A9t,extend:Xwe};const V9t={GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},$9t={CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5};var j9t={SelectionContent:V9t,SelectionField:$9t};function U9t(t,e){e.classHierarchy.push("vtkSelectionNode"),t.getBounds=()=>e.points.getBounds()}const F9t={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Zwe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,F9t,n),se.obj(t,e),e.properties={},se.setGet(t,e,["contentType","fieldType","properties","selectionList"]),U9t(t,e)}const B9t=se.newInstance(Zwe,"vtkSelectionNode");var Qwe={newInstance:B9t,extend:Zwe,...j9t};const{PassTypes:Oa}=Ywe,{SelectionContent:z9t,SelectionField:ite}=Qwe,{FieldAssociations:Q5}=k2,{vtkErrorMacro:Jwe}=se,_g=1;function ebe(t){return`${t.propID} ${t.compositeID}`}function tbe(t,e,n,r){if(!n)return 0;const i=(e*(r[2]-r[0]+1)+t)*4;return n[i+3]}function D0(t,e,n,r){if(!n)return 0;const i=(e*(r[2]-r[0]+1)+t)*4,a=n[i],o=n[i+1];return(n[i+2]*256+o)*256+a}function nbe(t,e){let n=e;return n<<=24,n|=t,n}function G9t(t,e,n,r){{if(r[0]=e[0],r[1]=e[1],e[0]<t.area[0]||e[0]>t.area[2]||e[1]<t.area[1]||e[1]>t.area[3])return null;const i=[e[0]-t.area[0],e[1]-t.area[1]],a=D0(i[0],i[1],t.pixBuffer[Oa.ACTOR_PASS],t.area);if(a<=0||a-_g>=t.props.length)return null;const o={};o.valid=!0,o.propID=a-_g,o.prop=t.props[o.propID];let s=D0(i[0],i[1],t.pixBuffer[Oa.COMPOSITE_INDEX_PASS],t.area);if((s<0||s>16777215)&&(s=0),o.compositeID=s-_g,t.captureZValues){const u=(i[1]*(t.area[2]-t.area[0]+1)+i[0])*4;o.zValue=(256*t.zBuffer[u]+t.zBuffer[u+1])/65535,o.displayPosition=e}if(t.pixBuffer[Oa.ID_LOW24]&&tbe(i[0],i[1],t.pixBuffer[Oa.ID_LOW24],t.area)===0)return o;const c=D0(i[0],i[1],t.pixBuffer[Oa.ID_LOW24],t.area),l=D0(i[0],i[1],t.pixBuffer[Oa.ID_HIGH24],t.area);return o.attributeID=nbe(c,l),o}}function rbe(t,e,n,r,i){const a=[];let o=0;return e.forEach((s,c)=>{const l=Qwe.newInstance();switch(l.setContentType(z9t.INDICES),t){case Q5.FIELD_ASSOCIATION_CELLS:l.setFieldType(ite.CELL);break;case Q5.FIELD_ASSOCIATION_POINTS:l.setFieldType(ite.POINT);break;default:Jwe("Unknown field association")}l.getProperties().propID=s.info.propID,l.getProperties().prop=s.info.prop,l.getProperties().compositeID=s.info.compositeID,l.getProperties().attributeID=s.info.attributeID,l.getProperties().pixelCount=s.pixelCount,n&&(l.getProperties().displayPosition=[s.info.displayPosition[0],s.info.displayPosition[1],s.info.zValue],l.getProperties().worldPosition=i.displayToWorld(s.info.displayPosition[0],s.info.displayPosition[1],s.info.zValue,r)),l.setSelectionList(s.attributeIDs),a[o]=l,o++}),a}function W9t(t,e,n,r,i){const a=Math.floor(e),o=Math.floor(n),s=Math.floor(r),c=Math.floor(i),l=new Map,u=[0,0];for(let f=o;f<=c;f++)for(let d=a;d<=s;d++){const m=G9t(t,[d,f],0,u);if(m&&m.valid){const p=ebe(m);if(!l.has(p))l.set(p,{info:m,pixelCount:1,attributeIDs:[m.attributeID]});else{const y=l.get(p);y.pixelCount++,t.captureZValues&&m.zValue<y.info.zValue&&(y.info=m),y.attributeIDs.indexOf(m.attributeID)===-1&&y.attributeIDs.push(m.attributeID)}}}return rbe(t.fieldAssociation,l,t.captureZValues,t.renderer,t.openGLRenderWindow)}function H9t(t,e){e.classHierarchy.push("vtkOpenGLHardwareSelector"),t.releasePixBuffers=()=>{e.rawPixBuffer=[],e.pixBuffer=[],e.zBuffer=null},t.beginSelection=()=>{e._openGLRenderer=e._openGLRenderWindow.getViewNodeFor(e._renderer),e.maxAttributeId=0;const r=e._openGLRenderWindow.getSize();if(!e.framebuffer)e.framebuffer=y3.newInstance(),e.framebuffer.setOpenGLRenderWindow(e._openGLRenderWindow),e.framebuffer.saveCurrentBindingsAndBuffers(),e.framebuffer.create(r[0],r[1]),e.framebuffer.populateFramebuffer();else{e.framebuffer.setOpenGLRenderWindow(e._openGLRenderWindow),e.framebuffer.saveCurrentBindingsAndBuffers();const i=e.framebuffer.getSize();!i||i[0]!==r[0]||i[1]!==r[1]?(e.framebuffer.create(r[0],r[1]),e.framebuffer.populateFramebuffer()):e.framebuffer.bind()}if(e._openGLRenderer.clear(),e._openGLRenderer.setSelector(t),e.hitProps={},e.propPixels={},e.props=[],t.releasePixBuffers(),e.fieldAssociation===Q5.FIELD_ASSOCIATION_POINTS){const i=e._openGLRenderWindow.getContext(),a=i.isEnabled(i.BLEND);i.disable(i.BLEND),e._openGLRenderWindow.traverseAllPasses(),a&&i.enable(i.BLEND)}},t.endSelection=()=>{e.hitProps={},e._openGLRenderer.setSelector(null),e.framebuffer.restorePreviousBindingsAndBuffers()},t.preCapturePass=()=>{const r=e._openGLRenderWindow.getContext();e.originalBlending=r.isEnabled(r.BLEND),r.disable(r.BLEND)},t.postCapturePass=()=>{const r=e._openGLRenderWindow.getContext();e.originalBlending&&r.enable(r.BLEND)},t.select=()=>{let r=null;return t.captureBuffers()&&(r=t.generateSelection(e.area[0],e.area[1],e.area[2],e.area[3]),t.releasePixBuffers()),r},t.getSourceDataAsync=async(r,i,a,o,s)=>{if(e._renderer=r,i===void 0){const l=e._openGLRenderWindow.getSize();t.setArea(0,0,l[0]-1,l[1]-1)}else t.setArea(i,a,o,s);if(!t.captureBuffers())return!1;const c={area:[...e.area],pixBuffer:[...e.pixBuffer],captureZValues:e.captureZValues,zBuffer:e.zBuffer,props:[...e.props],fieldAssociation:e.fieldAssociation,renderer:r,openGLRenderWindow:e._openGLRenderWindow};return c.generateSelection=function(){for(var l=arguments.length,u=new Array(l),f=0;f<l;f++)u[f]=arguments[f];return W9t(c,...u)},c},t.captureBuffers=()=>{if(!e._renderer||!e._openGLRenderWindow)return Jwe("Renderer and view must be set before calling Select."),!1;e._openGLRenderer=e._openGLRenderWindow.getViewNodeFor(e._renderer),e._openGLRenderWindow.getRenderable().preRender(),t.invokeEvent({type:"StartEvent"}),e.originalBackground=e._renderer.getBackgroundByReference(),e._renderer.setBackground(0,0,0,0);const r=e._openGLRenderWindow.getRenderPasses();t.beginSelection();const i=[];for(e.currentPass=Oa.MIN_KNOWN_PASS;e.currentPass<=Oa.MAX_KNOWN_PASS;e.currentPass++)t.passRequired(e.currentPass)&&(t.preCapturePass(e.currentPass),e.captureZValues&&e.currentPass===Oa.ACTOR_PASS&&typeof r[0].requestDepth=="function"&&typeof r[0].getFramebuffer=="function"&&r[0].requestDepth(),e._openGLRenderWindow.traverseAllPasses(),t.postCapturePass(e.currentPass),t.savePixelBuffer(e.currentPass),i.push(e.currentPass));return i.forEach(a=>{e.currentPass=a,t.processPixelBuffers()}),e.currentPass=Oa.MAX_KNOWN_PASS,t.endSelection(),e._renderer.setBackground(e.originalBackground),t.invokeEvent({type:"EndEvent"}),!0},t.processPixelBuffers=()=>{e.props.forEach((r,i)=>{t.isPropHit(i)&&r.processSelectorPixelBuffers(t,e.propPixels[i])})},t.passRequired=r=>{if(r===Oa.ID_HIGH24){if(e.fieldAssociation===Q5.FIELD_ASSOCIATION_POINTS)return e.maximumPointId>16777215;if(e.fieldAssociation===Q5.FIELD_ASSOCIATION_CELLS)return e.maximumCellId>16777215}return!0},t.savePixelBuffer=r=>{if(e.pixBuffer[r]=e._openGLRenderWindow.getPixelData(e.area[0],e.area[1],e.area[2],e.area[3]),!e.rawPixBuffer[r]){const i=(e.area[2]-e.area[0]+1)*(e.area[3]-e.area[1]+1)*4;e.rawPixBuffer[r]=new Uint8Array(i),e.rawPixBuffer[r].set(e.pixBuffer[r])}if(r===Oa.ACTOR_PASS){if(e.captureZValues){const i=e._openGLRenderWindow.getRenderPasses();if(typeof i[0].requestDepth=="function"&&typeof i[0].getFramebuffer=="function"){const a=i[0].getFramebuffer();a.saveCurrentBindingsAndBuffers(),a.bind(),e.zBuffer=e._openGLRenderWindow.getPixelData(e.area[0],e.area[1],e.area[2],e.area[3]),a.restorePreviousBindingsAndBuffers()}}t.buildPropHitList(e.rawPixBuffer[r])}},t.buildPropHitList=r=>{let i=0;for(let a=0;a<=e.area[3]-e.area[1];a++)for(let o=0;o<=e.area[2]-e.area[0];o++){let s=D0(o,a,r,e.area);s>0&&(s--,s in e.hitProps||(e.hitProps[s]=!0,e.propPixels[s]=[]),e.propPixels[s].push(i*4)),++i}},t.renderProp=r=>{e.currentPass===Oa.ACTOR_PASS&&(t.setPropColorValueFromInt(e.props.length+_g),e.props.push(r))},t.renderCompositeIndex=r=>{e.currentPass===Oa.COMPOSITE_INDEX_PASS&&t.setPropColorValueFromInt(r+_g)},t.renderAttributeId=r=>{r<0||(e.maxAttributeId=r>e.maxAttributeId?r:e.maxAttributeId)},t.passTypeToString=r=>se.enumToString(Oa,r),t.isPropHit=r=>!!e.hitProps[r],t.setPropColorValueFromInt=r=>{e.propColorValue[0]=r%256/255,e.propColorValue[1]=Math.floor(r/256)%256/255,e.propColorValue[2]=Math.floor(r/65536)%256/255},t.getPixelInformation=(r,i,a)=>{const o=i<0?0:i;if(o===0){if(a[0]=r[0],a[1]=r[1],r[0]<e.area[0]||r[0]>e.area[2]||r[1]<e.area[1]||r[1]>e.area[3])return null;const u=[r[0]-e.area[0],r[1]-e.area[1]],f=D0(u[0],u[1],e.pixBuffer[Oa.ACTOR_PASS],e.area);if(f<=0||f-_g>=e.props.length)return null;const d={};d.valid=!0,d.propID=f-_g,d.prop=e.props[d.propID];let h=D0(u[0],u[1],e.pixBuffer[Oa.COMPOSITE_INDEX_PASS],e.area);if((h<0||h>16777215)&&(h=0),d.compositeID=h-_g,e.captureZValues){const y=(u[1]*(e.area[2]-e.area[0]+1)+u[0])*4;d.zValue=(256*e.zBuffer[y]+e.zBuffer[y+1])/65535,d.displayPosition=r}if(e.pixBuffer[Oa.ID_LOW24]&&tbe(u[0],u[1],e.pixBuffer[Oa.ID_LOW24],e.area)===0)return d;const m=D0(u[0],u[1],e.pixBuffer[Oa.ID_LOW24],e.area),p=D0(u[0],u[1],e.pixBuffer[Oa.ID_HIGH24],e.area);return d.attributeID=nbe(m,p),d}const s=[r[0],r[1]],c=[0,0];let l=t.getPixelInformation(r,0,a);if(l&&l.valid)return l;for(let u=1;u<o;++u){for(let f=s[1]>u?s[1]-u:0;f<=s[1]+u;++f)if(c[1]=f,s[0]>=u&&(c[0]=s[0]-u,l=t.getPixelInformation(c,0,a),l&&l.valid)||(c[0]=s[0]+u,l=t.getPixelInformation(c,0,a),l&&l.valid))return l;for(let f=s[0]>=u?s[0]-(u-1):0;f<=s[0]+(u-1);++f)if(c[0]=f,s[1]>=u&&(c[1]=s[1]-u,l=t.getPixelInformation(c,0,a),l&&l.valid)||(c[1]=s[1]+u,l=t.getPixelInformation(c,0,a),l&&l.valid))return l}return a[0]=r[0],a[1]=r[1],null},t.generateSelection=(r,i,a,o)=>{const s=Math.floor(r),c=Math.floor(i),l=Math.floor(a),u=Math.floor(o),f=new Map,d=[0,0];for(let h=c;h<=u;h++)for(let m=s;m<=l;m++){const p=[m,h],y=t.getPixelInformation(p,0,d);if(y&&y.valid){const x=ebe(y);if(!f.has(x))f.set(x,{info:y,pixelCount:1,attributeIDs:[y.attributeID]});else{const S=f.get(x);S.pixelCount++,e.captureZValues&&y.zValue<S.info.zValue&&(S.info=y),S.attributeIDs.indexOf(y.attributeID)===-1&&S.attributeIDs.push(y.attributeID)}}}return rbe(e.fieldAssociation,f,e.captureZValues,e._renderer,e._openGLRenderWindow)},t.getRawPixelBuffer=r=>e.rawPixBuffer[r],t.getPixelBuffer=r=>e.pixBuffer[r],t.attach=(r,i)=>{e._openGLRenderWindow=r,e._renderer=i};const n=t.setArea;t.setArea=function(){return n(...arguments)?(e.area[0]=Math.floor(e.area[0]),e.area[1]=Math.floor(e.area[1]),e.area[2]=Math.floor(e.area[2]),e.area[3]=Math.floor(e.area[3]),!0):!1}}const q9t={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function ibe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,q9t,n),L9t.extend(t,e,n),e.propColorValue=[0,0,0],e.props=[],e.area||(e.area=[0,0,0,0]),se.setGetArray(t,e,["area"],4),se.setGet(t,e,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),se.setGetArray(t,e,["propColorValue"],3),se.moveToProtected(t,e,["renderer","openGLRenderWindow"]),se.event(t,e,"event"),H9t(t,e)}const K9t=se.newInstance(ibe,"vtkOpenGLHardwareSelector");var bF={newInstance:K9t,extend:ibe,...Ywe},$R={exports:{}},ate;function Y9t(){return ate||(ate=1,(function(t,e){(function(n){t.exports=n()})(function(n){var r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function i(x,S){var C=x[0],_=x[1],T=x[2],O=x[3];C+=(_&T|~_&O)+S[0]-680876936|0,C=(C<<7|C>>>25)+_|0,O+=(C&_|~C&T)+S[1]-389564586|0,O=(O<<12|O>>>20)+C|0,T+=(O&C|~O&_)+S[2]+606105819|0,T=(T<<17|T>>>15)+O|0,_+=(T&O|~T&C)+S[3]-1044525330|0,_=(_<<22|_>>>10)+T|0,C+=(_&T|~_&O)+S[4]-176418897|0,C=(C<<7|C>>>25)+_|0,O+=(C&_|~C&T)+S[5]+1200080426|0,O=(O<<12|O>>>20)+C|0,T+=(O&C|~O&_)+S[6]-1473231341|0,T=(T<<17|T>>>15)+O|0,_+=(T&O|~T&C)+S[7]-45705983|0,_=(_<<22|_>>>10)+T|0,C+=(_&T|~_&O)+S[8]+1770035416|0,C=(C<<7|C>>>25)+_|0,O+=(C&_|~C&T)+S[9]-1958414417|0,O=(O<<12|O>>>20)+C|0,T+=(O&C|~O&_)+S[10]-42063|0,T=(T<<17|T>>>15)+O|0,_+=(T&O|~T&C)+S[11]-1990404162|0,_=(_<<22|_>>>10)+T|0,C+=(_&T|~_&O)+S[12]+1804603682|0,C=(C<<7|C>>>25)+_|0,O+=(C&_|~C&T)+S[13]-40341101|0,O=(O<<12|O>>>20)+C|0,T+=(O&C|~O&_)+S[14]-1502002290|0,T=(T<<17|T>>>15)+O|0,_+=(T&O|~T&C)+S[15]+1236535329|0,_=(_<<22|_>>>10)+T|0,C+=(_&O|T&~O)+S[1]-165796510|0,C=(C<<5|C>>>27)+_|0,O+=(C&T|_&~T)+S[6]-1069501632|0,O=(O<<9|O>>>23)+C|0,T+=(O&_|C&~_)+S[11]+643717713|0,T=(T<<14|T>>>18)+O|0,_+=(T&C|O&~C)+S[0]-373897302|0,_=(_<<20|_>>>12)+T|0,C+=(_&O|T&~O)+S[5]-701558691|0,C=(C<<5|C>>>27)+_|0,O+=(C&T|_&~T)+S[10]+38016083|0,O=(O<<9|O>>>23)+C|0,T+=(O&_|C&~_)+S[15]-660478335|0,T=(T<<14|T>>>18)+O|0,_+=(T&C|O&~C)+S[4]-405537848|0,_=(_<<20|_>>>12)+T|0,C+=(_&O|T&~O)+S[9]+568446438|0,C=(C<<5|C>>>27)+_|0,O+=(C&T|_&~T)+S[14]-1019803690|0,O=(O<<9|O>>>23)+C|0,T+=(O&_|C&~_)+S[3]-187363961|0,T=(T<<14|T>>>18)+O|0,_+=(T&C|O&~C)+S[8]+1163531501|0,_=(_<<20|_>>>12)+T|0,C+=(_&O|T&~O)+S[13]-1444681467|0,C=(C<<5|C>>>27)+_|0,O+=(C&T|_&~T)+S[2]-51403784|0,O=(O<<9|O>>>23)+C|0,T+=(O&_|C&~_)+S[7]+1735328473|0,T=(T<<14|T>>>18)+O|0,_+=(T&C|O&~C)+S[12]-1926607734|0,_=(_<<20|_>>>12)+T|0,C+=(_^T^O)+S[5]-378558|0,C=(C<<4|C>>>28)+_|0,O+=(C^_^T)+S[8]-2022574463|0,O=(O<<11|O>>>21)+C|0,T+=(O^C^_)+S[11]+1839030562|0,T=(T<<16|T>>>16)+O|0,_+=(T^O^C)+S[14]-35309556|0,_=(_<<23|_>>>9)+T|0,C+=(_^T^O)+S[1]-1530992060|0,C=(C<<4|C>>>28)+_|0,O+=(C^_^T)+S[4]+1272893353|0,O=(O<<11|O>>>21)+C|0,T+=(O^C^_)+S[7]-155497632|0,T=(T<<16|T>>>16)+O|0,_+=(T^O^C)+S[10]-1094730640|0,_=(_<<23|_>>>9)+T|0,C+=(_^T^O)+S[13]+681279174|0,C=(C<<4|C>>>28)+_|0,O+=(C^_^T)+S[0]-358537222|0,O=(O<<11|O>>>21)+C|0,T+=(O^C^_)+S[3]-722521979|0,T=(T<<16|T>>>16)+O|0,_+=(T^O^C)+S[6]+76029189|0,_=(_<<23|_>>>9)+T|0,C+=(_^T^O)+S[9]-640364487|0,C=(C<<4|C>>>28)+_|0,O+=(C^_^T)+S[12]-421815835|0,O=(O<<11|O>>>21)+C|0,T+=(O^C^_)+S[15]+530742520|0,T=(T<<16|T>>>16)+O|0,_+=(T^O^C)+S[2]-995338651|0,_=(_<<23|_>>>9)+T|0,C+=(T^(_|~O))+S[0]-198630844|0,C=(C<<6|C>>>26)+_|0,O+=(_^(C|~T))+S[7]+1126891415|0,O=(O<<10|O>>>22)+C|0,T+=(C^(O|~_))+S[14]-1416354905|0,T=(T<<15|T>>>17)+O|0,_+=(O^(T|~C))+S[5]-57434055|0,_=(_<<21|_>>>11)+T|0,C+=(T^(_|~O))+S[12]+1700485571|0,C=(C<<6|C>>>26)+_|0,O+=(_^(C|~T))+S[3]-1894986606|0,O=(O<<10|O>>>22)+C|0,T+=(C^(O|~_))+S[10]-1051523|0,T=(T<<15|T>>>17)+O|0,_+=(O^(T|~C))+S[1]-2054922799|0,_=(_<<21|_>>>11)+T|0,C+=(T^(_|~O))+S[8]+1873313359|0,C=(C<<6|C>>>26)+_|0,O+=(_^(C|~T))+S[15]-30611744|0,O=(O<<10|O>>>22)+C|0,T+=(C^(O|~_))+S[6]-1560198380|0,T=(T<<15|T>>>17)+O|0,_+=(O^(T|~C))+S[13]+1309151649|0,_=(_<<21|_>>>11)+T|0,C+=(T^(_|~O))+S[4]-145523070|0,C=(C<<6|C>>>26)+_|0,O+=(_^(C|~T))+S[11]-1120210379|0,O=(O<<10|O>>>22)+C|0,T+=(C^(O|~_))+S[2]+718787259|0,T=(T<<15|T>>>17)+O|0,_+=(O^(T|~C))+S[9]-343485551|0,_=(_<<21|_>>>11)+T|0,x[0]=C+x[0]|0,x[1]=_+x[1]|0,x[2]=T+x[2]|0,x[3]=O+x[3]|0}function a(x){var S=[],C;for(C=0;C<64;C+=4)S[C>>2]=x.charCodeAt(C)+(x.charCodeAt(C+1)<<8)+(x.charCodeAt(C+2)<<16)+(x.charCodeAt(C+3)<<24);return S}function o(x){var S=[],C;for(C=0;C<64;C+=4)S[C>>2]=x[C]+(x[C+1]<<8)+(x[C+2]<<16)+(x[C+3]<<24);return S}function s(x){var S=x.length,C=[1732584193,-271733879,-1732584194,271733878],_,T,O,M,I,V;for(_=64;_<=S;_+=64)i(C,a(x.substring(_-64,_)));for(x=x.substring(_-64),T=x.length,O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],_=0;_<T;_+=1)O[_>>2]|=x.charCodeAt(_)<<(_%4<<3);if(O[_>>2]|=128<<(_%4<<3),_>55)for(i(C,O),_=0;_<16;_+=1)O[_]=0;return M=S*8,M=M.toString(16).match(/(.*?)(.{0,8})$/),I=parseInt(M[2],16),V=parseInt(M[1],16)||0,O[14]=I,O[15]=V,i(C,O),C}function c(x){var S=x.length,C=[1732584193,-271733879,-1732584194,271733878],_,T,O,M,I,V;for(_=64;_<=S;_+=64)i(C,o(x.subarray(_-64,_)));for(x=_-64<S?x.subarray(_-64):new Uint8Array(0),T=x.length,O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],_=0;_<T;_+=1)O[_>>2]|=x[_]<<(_%4<<3);if(O[_>>2]|=128<<(_%4<<3),_>55)for(i(C,O),_=0;_<16;_+=1)O[_]=0;return M=S*8,M=M.toString(16).match(/(.*?)(.{0,8})$/),I=parseInt(M[2],16),V=parseInt(M[1],16)||0,O[14]=I,O[15]=V,i(C,O),C}function l(x){var S="",C;for(C=0;C<4;C+=1)S+=r[x>>C*8+4&15]+r[x>>C*8&15];return S}function u(x){var S;for(S=0;S<x.length;S+=1)x[S]=l(x[S]);return x.join("")}u(s("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function x(S,C){return S=S|0||0,S<0?Math.max(S+C,0):Math.min(S,C)}ArrayBuffer.prototype.slice=function(S,C){var _=this.byteLength,T=x(S,_),O=_,M,I,V,k;return C!==n&&(O=x(C,_)),T>O?new ArrayBuffer(0):(M=O-T,I=new ArrayBuffer(M),V=new Uint8Array(I),k=new Uint8Array(this,T,M),V.set(k),I)}})();function f(x){return/[\u0080-\uFFFF]/.test(x)&&(x=unescape(encodeURIComponent(x))),x}function d(x,S){var C=x.length,_=new ArrayBuffer(C),T=new Uint8Array(_),O;for(O=0;O<C;O+=1)T[O]=x.charCodeAt(O);return S?T:_}function h(x){return String.fromCharCode.apply(null,new Uint8Array(x))}function m(x,S,C){var _=new Uint8Array(x.byteLength+S.byteLength);return _.set(new Uint8Array(x)),_.set(new Uint8Array(S),x.byteLength),_}function p(x){var S=[],C=x.length,_;for(_=0;_<C-1;_+=2)S.push(parseInt(x.substr(_,2),16));return String.fromCharCode.apply(String,S)}function y(){this.reset()}return y.prototype.append=function(x){return this.appendBinary(f(x)),this},y.prototype.appendBinary=function(x){this._buff+=x,this._length+=x.length;var S=this._buff.length,C;for(C=64;C<=S;C+=64)i(this._hash,a(this._buff.substring(C-64,C)));return this._buff=this._buff.substring(C-64),this},y.prototype.end=function(x){var S=this._buff,C=S.length,_,T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O;for(_=0;_<C;_+=1)T[_>>2]|=S.charCodeAt(_)<<(_%4<<3);return this._finish(T,C),O=u(this._hash),x&&(O=p(O)),this.reset(),O},y.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},y.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},y.prototype.setState=function(x){return this._buff=x.buff,this._length=x.length,this._hash=x.hash,this},y.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},y.prototype._finish=function(x,S){var C=S,_,T,O;if(x[C>>2]|=128<<(C%4<<3),C>55)for(i(this._hash,x),C=0;C<16;C+=1)x[C]=0;_=this._length*8,_=_.toString(16).match(/(.*?)(.{0,8})$/),T=parseInt(_[2],16),O=parseInt(_[1],16)||0,x[14]=T,x[15]=O,i(this._hash,x)},y.hash=function(x,S){return y.hashBinary(f(x),S)},y.hashBinary=function(x,S){var C=s(x),_=u(C);return S?p(_):_},y.ArrayBuffer=function(){this.reset()},y.ArrayBuffer.prototype.append=function(x){var S=m(this._buff.buffer,x),C=S.length,_;for(this._length+=x.byteLength,_=64;_<=C;_+=64)i(this._hash,o(S.subarray(_-64,_)));return this._buff=_-64<C?new Uint8Array(S.buffer.slice(_-64)):new Uint8Array(0),this},y.ArrayBuffer.prototype.end=function(x){var S=this._buff,C=S.length,_=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],T,O;for(T=0;T<C;T+=1)_[T>>2]|=S[T]<<(T%4<<3);return this._finish(_,C),O=u(this._hash),x&&(O=p(O)),this.reset(),O},y.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},y.ArrayBuffer.prototype.getState=function(){var x=y.prototype.getState.call(this);return x.buff=h(x.buff),x},y.ArrayBuffer.prototype.setState=function(x){return x.buff=d(x.buff,!0),y.prototype.setState.call(this,x)},y.ArrayBuffer.prototype.destroy=y.prototype.destroy,y.ArrayBuffer.prototype._finish=y.prototype._finish,y.ArrayBuffer.hash=function(x,S){var C=c(new Uint8Array(x)),_=u(C);return S?p(_):_},y})})($R)),$R.exports}var X9t=Y9t();const Z9t=ka(X9t),Q9t=["lastShaderProgramBound","context","_openGLRenderWindow"];function J9t(t,e){e.classHierarchy.push("vtkShaderCache"),t.replaceShaderValues=(n,r,i)=>{let a=r;i.length>0&&(a=Ie.substitute(a,"VSOut","GSOut").result);const o=e._openGLRenderWindow.getWebgl2();let s=`
`,c=`#version 100
`;o?c=`#version 300 es
#define attribute in
#define textureCube texture
#define texture2D texture
#define textureCubeLod textureLod
#define texture2DLod textureLod
`:(e.context.getExtension("OES_standard_derivatives"),e.context.getExtension("EXT_frag_depth")&&(s=`#extension GL_EXT_frag_depth : enable
`),e.context.getExtension("EXT_shader_texture_lod")&&(s+=`#extension GL_EXT_shader_texture_lod : enable
#define textureCubeLod textureCubeLodEXT
#define texture2DLod texture2DLodEXT`)),a=Ie.substitute(a,"//VTK::System::Dec",[`${c}
`,o?"":`#extension GL_OES_standard_derivatives : enable
`,s,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=Ie.substitute(n,"//VTK::System::Dec",[`${c}
`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(o){l=Ie.substitute(l,"varying","out").result,a=Ie.substitute(a,"varying","in").result;let f="",d=0;for(;a.includes(`gl_FragData[${d}]`);)a=Ie.substitute(a,`gl_FragData\\[${d}\\]`,`fragOutput${d}`).result,f+=`layout(location = ${d}) out vec4 fragOutput${d};
`,d++;a=Ie.substitute(a,"//VTK::Output::Dec",f).result}const u=Ie.substitute(i,"//VTK::System::Dec",c).result;return{VSSource:l,FSSource:a,GSSource:u}},t.readyShaderProgramArray=(n,r,i)=>{const a=t.replaceShaderValues(n,r,i),o=t.getShaderProgram(a.VSSource,a.FSSource,a.GSSource);return t.readyShaderProgram(o)},t.readyShaderProgram=n=>!n||!n.getCompiled()&&!n.compileShader()||!t.bindShaderProgram(n)?null:n,t.getShaderProgram=(n,r,i)=>{const a=`${n}${r}${i}`,o=Z9t.hash(a);if(!(o in e.shaderPrograms)){const s=Ie.newInstance();return s.setContext(e.context),s.getVertexShader().setSource(n),s.getFragmentShader().setSource(r),i&&s.getGeometryShader().setSource(i),s.setMd5Hash(o),e.shaderPrograms[o]=s,s}return e.shaderPrograms[o]},t.releaseGraphicsResources=n=>{t.releaseCurrentShaderProgram(),Object.keys(e.shaderPrograms).map(r=>e.shaderPrograms[r]).forEach(r=>r.cleanup()),e.shaderPrograms={}},t.releaseCurrentShaderProgram=()=>{e.lastShaderProgramBound&&(e.lastShaderProgramBound.cleanup(),e.lastShaderProgramBound=null)},t.bindShaderProgram=n=>(e.lastShaderProgramBound===n||(e.lastShaderProgramBound&&e.lastShaderProgramBound.release(),n.bind(),e.lastShaderProgramBound=n),1)}const e7t={lastShaderProgramBound:null,shaderPrograms:null,context:null};function abe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,e7t,n),e.shaderPrograms={},se.obj(t,e),se.setGet(t,e,Q9t),se.moveToProtected(t,e,["openGLRenderWindow"]),J9t(t,e)}const t7t=se.newInstance(abe,"vtkShaderCache");var n7t={newInstance:t7t,extend:abe};const{vtkErrorMacro:r7t}=se;function i7t(t,e){e.classHierarchy.push("vtkOpenGLTextureUnitManager"),t.deleteTable=()=>{for(let n=0;n<e.numberOfTextureUnits;++n)e.textureUnits[n]===!0&&r7t("some texture units  were not properly released");e.textureUnits=[],e.numberOfTextureUnits=0},t.setContext=n=>{if(e.context!==n){if(e.context!==0&&t.deleteTable(),e.context=n,e.context){e.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let r=0;r<e.numberOfTextureUnits;++r)e.textureUnits[r]=!1}t.modified()}},t.allocate=()=>{for(let n=0;n<e.numberOfTextureUnits;n++)if(!t.isAllocated(n))return e.textureUnits[n]=!0,n;return-1},t.allocateUnit=n=>t.isAllocated(n)?-1:(e.textureUnits[n]=!0,n),t.isAllocated=n=>e.textureUnits[n],t.free=n=>{e.textureUnits[n]=!1},t.freeAll=()=>{for(let n=0;n<e.numberOfTextureUnits;++n)e.textureUnits[n]=!1}}const a7t={context:null,numberOfTextureUnits:0,textureUnits:0};function obe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,a7t,n),se.obj(t,e),e.textureUnits=[],se.get(t,e,["numberOfTextureUnits"]),se.setGet(t,e,["context"]),i7t(t,e)}const o7t=se.newInstance(obe,"vtkOpenGLTextureUnitManager");var s7t={newInstance:o7t,extend:obe};function c7t(t,e){e.classHierarchy.push("vtkRenderWindowViewNode"),t.getViewNodeFactory=()=>null,t.getAspectRatio=()=>e.size[0]/e.size[1],t.getAspectRatioForRenderer=n=>{const r=n.getViewportByReference();return e.size[0]*(r[2]-r[0])/((r[3]-r[1])*e.size[1])},t.isInViewport=(n,r,i)=>{const a=i.getViewportByReference(),o=t.getFramebufferSize();return a[0]*o[0]<=n&&a[2]*o[0]>=n&&a[1]*o[1]<=r&&a[3]*o[1]>=r},t.getViewportSize=n=>{const r=n.getViewportByReference(),i=t.getFramebufferSize();return[(r[2]-r[0])*i[0],(r[3]-r[1])*i[1]]},t.getViewportCenter=n=>{const r=t.getViewportSize(n);return[r[0]*.5,r[1]*.5]},t.displayToNormalizedDisplay=(n,r,i)=>{const a=t.getFramebufferSize();return[n/a[0],r/a[1],i]},t.normalizedDisplayToDisplay=(n,r,i)=>{const a=t.getFramebufferSize();return[n*a[0],r*a[1],i]},t.worldToView=(n,r,i,a)=>a.worldToView(n,r,i),t.viewToWorld=(n,r,i,a)=>a.viewToWorld(n,r,i),t.worldToDisplay=(n,r,i,a)=>{const o=a.worldToView(n,r,i),s=t.getViewportSize(a),c=a.viewToProjection(o[0],o[1],o[2],s[0]/s[1]),l=a.projectionToNormalizedDisplay(c[0],c[1],c[2]);return t.normalizedDisplayToDisplay(l[0],l[1],l[2])},t.displayToWorld=(n,r,i,a)=>{const o=t.displayToNormalizedDisplay(n,r,i),s=a.normalizedDisplayToProjection(o[0],o[1],o[2]),c=t.getViewportSize(a),l=a.projectionToView(s[0],s[1],s[2],c[0]/c[1]);return a.viewToWorld(l[0],l[1],l[2])},t.normalizedDisplayToViewport=(n,r,i,a)=>{let o=a.getViewportByReference();o=t.normalizedDisplayToDisplay(o[0],o[1],0);const s=t.normalizedDisplayToDisplay(n,r,i);return[s[0]-o[0]-.5,s[1]-o[1]-.5,i]},t.viewportToNormalizedViewport=(n,r,i,a)=>{const o=t.getViewportSize(a);return o&&o[0]!==0&&o[1]!==0?[n/(o[0]-1),r/(o[1]-1),i]:[n,r,i]},t.normalizedViewportToViewport=(n,r,i,a)=>{const o=t.getViewportSize(a);return[n*(o[0]-1),r*(o[1]-1),i]},t.displayToLocalDisplay=(n,r,i)=>{const a=t.getFramebufferSize();return[n,a[1]-r-1,i]},t.viewportToNormalizedDisplay=(n,r,i,a)=>{let o=a.getViewportByReference();o=t.normalizedDisplayToDisplay(o[0],o[1],0);const s=n+o[0]+.5,c=r+o[1]+.5;return t.displayToNormalizedDisplay(s,c,i)},t.getComputedDevicePixelRatio=()=>e.size[0]/t.getContainerSize()[0],t.getContainerSize=()=>{se.vtkErrorMacro("not implemented")},t.getPixelData=(n,r,i,a)=>{se.vtkErrorMacro("not implemented")},t.createSelector=()=>{se.vtkErrorMacro("not implemented")}}const l7t={size:void 0,selector:void 0};function sbe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,l7t,n),e.size||(e.size=[300,300]),se.getArray(t,e,["size"],2),se.get(t,e,["selector"]),La.extend(t,e,n),c7t(t,e)}const u7t=se.newInstance(sbe,"vtkRenderWindowViewNode");var f7t={newInstance:u7t,extend:sbe};const d7t="__getUnderlyingContext";function h7t(){const t=new Map,e={apply(i,a,o){return t.has(o[0])?t.get(o[0]):i.apply(a,o)}};function n(i){return{apply(a,o,s){return t.set(i,s[0]),a.apply(o,s)}}}const r=Object.create(null);return r.getParameter=(i,a,o,s)=>new Proxy(s.bind(i),e),r.depthMask=(i,a,o,s)=>new Proxy(s.bind(i),n(i.DEPTH_WRITEMASK)),{get(i,a,o){if(a===d7t)return()=>i;let s=Reflect.get(i,a,i);s instanceof Function&&(s=s.bind(i));const c=r[a];return c?c(i,a,o,s):s}}}const{vtkDebugMacro:ote,vtkErrorMacro:ste}=se,g7t={position:"absolute",top:0,left:0,width:"100%",height:"100%"},p7t=["activateTexture","deactivateTexture","disableCullFace","enableCullFace","get3DContext","getActiveFramebuffer","getContext","getDefaultTextureByteSize","getDefaultTextureInternalFormat","getDefaultToWebgl2","getGLInformations","getGraphicsMemoryInfo","getGraphicsResourceForObject","getHardwareMaximumLineWidth","getPixelData","getShaderCache","getTextureUnitForTexture","getTextureUnitManager","getWebgl2","makeCurrent","releaseGraphicsResources","registerGraphicsResourceUser","unregisterGraphicsResourceUser","restoreContext","setActiveFramebuffer","setContext","setDefaultToWebgl2","setGraphicsResourceForObject"];function Fs(t,e,n){const r=t.createFramebuffer(),i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,e,2,2,0,e,n,null),t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0);const a=t.checkFramebufferStatus(t.FRAMEBUFFER);return t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindTexture(t.TEXTURE_2D,null),a===t.FRAMEBUFFER_COMPLETE}let QT=0;const ZE=[];function m7t(){QT++,ZE.forEach(t=>t(QT))}function v7t(){QT--,ZE.forEach(t=>t(QT))}function y7t(t){ZE.push(t)}function x7t(t){return ZE.pop()}function cte(t){t.preventDefault()}function w7t(t,e){e.classHierarchy.push("vtkOpenGLRenderWindow");let n;function r(){return n||(n=h7t()),n}t.getViewNodeFactory=()=>e.myFactory,e.canvas.addEventListener("webglcontextlost",cte,!1),e.canvas.addEventListener("webglcontextrestored",t.restoreContext,!1);const i=[0,0];function a(){e.renderable&&(e.size[0]!==i[0]||e.size[1]!==i[1])&&(i[0]=e.size[0],i[1]=e.size[1],e.canvas.setAttribute("width",e.size[0]),e.canvas.setAttribute("height",e.size[1])),e.viewStream&&e.viewStream.setSize(e.size[0],e.size[1]),e.canvas.style.display=e.useOffScreen?"none":"block",e.el&&(e.el.style.cursor=e.cursorVisibility?e.cursor:"none"),e.containerSize=null}t.onModified(a),t.buildPass=f=>{if(f){if(!e.renderable)return;t.prepareNodes(),t.addMissingNodes(e.renderable.getRenderersByReference()),t.addMissingNodes(e.renderable.getChildRenderWindowsByReference()),t.removeUnusedNodes(),t.initialize(),e.children.forEach(d=>{d.setOpenGLRenderWindow?.(t)})}},t.initialize=()=>{if(!e.initialized){if(e.rootOpenGLRenderWindow=t.getLastAncestorOfType("vtkOpenGLRenderWindow"),e.rootOpenGLRenderWindow)e.context2D=t.get2DContext();else{e.context=t.get3DContext(),t.resizeFromChildRenderWindows(),e.context&&m7t(),e.textureUnitManager=s7t.newInstance(),e.textureUnitManager.setContext(e.context),e.shaderCache.setContext(e.context);const f=e.context;f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA),f.depthFunc(f.LEQUAL),f.enable(f.BLEND)}e.initialized=!0}},t.makeCurrent=()=>{e.context.makeCurrent()},t.setContainer=f=>{e.el&&e.el!==f&&(e.canvas.parentNode!==e.el&&ste("Error: canvas parent node does not match container"),e.el.removeChild(e.canvas),e.el.contains(e.bgImage)&&e.el.removeChild(e.bgImage)),e.el!==f&&(e.el=f,e.el&&(e.el.appendChild(e.canvas),e.useBackgroundImage&&e.el.appendChild(e.bgImage)),t.modified())},t.getContainer=()=>e.el,t.getContainerSize=()=>{if(!e.containerSize&&e.el){const{width:f,height:d}=e.el.getBoundingClientRect();e.containerSize=[f,d]}return e.containerSize||e.size},t.getFramebufferSize=()=>e.activeFramebuffer?.getSize()||e.size,t.getPixelData=(f,d,h,m)=>{const p=new Uint8Array((h-f+1)*(m-d+1)*4);return e.context.readPixels(f,d,h-f+1,m-d+1,e.context.RGBA,e.context.UNSIGNED_BYTE,p),p},t.get3DContext=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},d=null;const h=typeof WebGL2RenderingContext<"u";return e.webgl2=!1,e.defaultToWebgl2&&h&&(d=e.canvas.getContext("webgl2",f),d&&(e.webgl2=!0,ote("using webgl2"))),d||(ote("using webgl1"),d=e.canvas.getContext("webgl",f)||e.canvas.getContext("experimental-webgl",f)),new Proxy(d,r())},t.get2DContext=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e.canvas.getContext("2d",f)},t.restoreContext=()=>{const f=XE.newInstance();f.setCurrentOperation("Release"),f.traverse(t,null)},t.activateTexture=f=>{const d=e._textureResourceIds.get(f);if(d!==void 0){e.context.activeTexture(e.context.TEXTURE0+d);return}const h=t.getTextureUnitManager().allocate();if(h<0){ste("Hardware does not support the number of textures defined.");return}e._textureResourceIds.set(f,h),e.context.activeTexture(e.context.TEXTURE0+h)},t.deactivateTexture=f=>{const d=e._textureResourceIds.get(f);d!==void 0&&(t.getTextureUnitManager().free(d),e._textureResourceIds.delete(f))},t.getTextureUnitForTexture=f=>{const d=e._textureResourceIds.get(f);return d!==void 0?d:-1},t.getDefaultTextureByteSize=function(f){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e.webgl2)switch(f){case zn.CHAR:case zn.SIGNED_CHAR:case zn.UNSIGNED_CHAR:return 1;case d:case h:case zn.UNSIGNED_SHORT:case zn.SHORT:case zn.VOID:return 2;default:return 4}return 1},t.getDefaultTextureInternalFormat=function(f,d){let h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.webgl2)switch(f){case zn.UNSIGNED_CHAR:switch(d){case 1:return e.context.R8;case 2:return e.context.RG8;case 3:return e.context.RGB8;case 4:default:return e.context.RGBA8}case(h&&!m&&zn.UNSIGNED_SHORT):switch(d){case 1:return h.R16_EXT;case 2:return h.RG16_EXT;case 3:return h.RGB16_EXT;case 4:default:return h.RGBA16_EXT}case(h&&!m&&zn.SHORT):switch(d){case 1:return h.R16_SNORM_EXT;case 2:return h.RG16_SNORM_EXT;case 3:return h.RGB16_SNORM_EXT;case 4:default:return h.RGBA16_SNORM_EXT}case zn.UNSIGNED_SHORT:case zn.SHORT:case zn.FLOAT:default:switch(d){case 1:return m?e.context.R16F:e.context.R32F;case 2:return m?e.context.RG16F:e.context.RG32F;case 3:return m?e.context.RGB16F:e.context.RGB32F;case 4:default:return m?e.context.RGBA16F:e.context.RGBA32F}}switch(d){case 1:return e.context.LUMINANCE;case 2:return e.context.LUMINANCE_ALPHA;case 3:return e.context.RGB;case 4:default:return e.context.RGBA}},t.setBackgroundImage=f=>{e.bgImage.src=f.src},t.setUseBackgroundImage=f=>{e.useBackgroundImage=f,e.useBackgroundImage&&!e.el.contains(e.bgImage)?e.el.appendChild(e.bgImage):!e.useBackgroundImage&&e.el.contains(e.bgImage)&&e.el.removeChild(e.bgImage)};function o(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e.imageFormat;const d=document.createElement("canvas"),h=d.getContext("2d");d.width=e.canvas.width,d.height=e.canvas.height,h.drawImage(e.canvas,0,0);const m=e.canvas.getBoundingClientRect();e.renderable.getRenderers().forEach(S=>{S.getViewProps().forEach(_=>{if(_.getContainer){const O=_.getContainer().getElementsByTagName("canvas");for(let M=0;M<O.length;M++){const I=O[M],V=I.getBoundingClientRect(),k=V.x-m.x,L=V.y-m.y;h.drawImage(I,k,L)}}})});const x=d.toDataURL(f);d.remove(),t.invokeImageReady(x)}t.captureNextImage=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"image/png",{resetCamera:d=!1,size:h=null,scale:m=1}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e.deleted)return null;e.imageFormat=f;const p=e.notifyStartCaptureImage;return e.notifyStartCaptureImage=!0,e._screenshot={size:h||m!==1?h||e.size.map(y=>y*m):null},new Promise((y,x)=>{const S=t.onImageReady(C=>{if(e._screenshot.size===null)e.notifyStartCaptureImage=p,S.unsubscribe(),e._screenshot.placeHolder&&(e.size=e._screenshot.originalSize,t.modified(),e._screenshot.cameras&&e._screenshot.cameras.forEach(_=>{let{restoreParamsFn:T,arg:O}=_;return T(O)}),t.traverseAllPasses(),e.el.removeChild(e._screenshot.placeHolder),e._screenshot.placeHolder.remove(),e._screenshot=null),y(C);else{const _=document.createElement("img");if(_.style=g7t,_.src=C,e._screenshot.placeHolder=e.el.appendChild(_),e.canvas.style.display="none",e._screenshot.originalSize=e.size,e.size=e._screenshot.size,e.rootOpenGLRenderWindow?.resizeFromChildRenderWindows(),e._screenshot.size=null,t.modified(),d){const T=d!==!0;e._screenshot.cameras=e.renderable.getRenderers().map(O=>{const M=O.getActiveCamera(),I=M.get("focalPoint","position","parallelScale");return{resetCameraArgs:T?{renderer:O}:void 0,resetCameraFn:T?d:O.resetCamera,restoreParamsFn:M.set,arg:JSON.parse(JSON.stringify(I))}}),e._screenshot.cameras.forEach(O=>{let{resetCameraFn:M,resetCameraArgs:I}=O;return M(I)})}t.traverseAllPasses()}})})};let s;t.getHardwareMaximumLineWidth=()=>{if(s!=null)return s;const f=t.get3DContext(),d=f.getParameter(f.ALIASED_LINE_WIDTH_RANGE);return s=d[1],d[1]},t.getGLInformations=()=>{if(e._glInformation)return e._glInformation;const f=t.get3DContext(),d=f.getExtension("OES_texture_float"),h=f.getExtension("OES_texture_half_float"),m=f.getExtension("WEBGL_debug_renderer_info"),p=f.getExtension("WEBGL_draw_buffers"),y=f.getExtension("EXT_texture_filter_anisotropic")||f.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),x=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",f.getParameter(f.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",f.getParameter(f.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",f.getParameter(f.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",f.getParameter(f.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",f.getParameter(f.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",f.getParameter(f.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",f.getParameter(f.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",f.getParameter(f.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",y&&f.getParameter(y.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",f.getParameter(f.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",f.getParameter(f.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",f.getParameter(f.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",f.getParameter(f.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",f.getParameter(f.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",f.getParameter(f.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",f.getParameter(f.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",f.getParameter(f.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",f.getParameter(f.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",f.getParameter(f.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",f.getParameter(f.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",f.getParameter(f.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",f.getParameter(f.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets     ","UNSIGNED_BYTE RENDER TARGET FORMATS",[d&&Fs(f,f.RGBA,f.UNSIGNED_BYTE)?"RGBA":"",d&&Fs(f,f.RGB,f.UNSIGNED_BYTE)?"RGB":"",d&&Fs(f,f.LUMINANCE,f.UNSIGNED_BYTE)?"LUMINANCE":"",d&&Fs(f,f.ALPHA,f.UNSIGNED_BYTE)?"ALPHA":"",d&&Fs(f,f.LUMINANCE_ALPHA,f.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[h&&Fs(f,f.RGBA,h.HALF_FLOAT_OES)?"RGBA":"",h&&Fs(f,f.RGB,h.HALF_FLOAT_OES)?"RGB":"",h&&Fs(f,f.LUMINANCE,h.HALF_FLOAT_OES)?"LUMINANCE":"",h&&Fs(f,f.ALPHA,h.HALF_FLOAT_OES)?"ALPHA":"",h&&Fs(f,f.LUMINANCE_ALPHA,h.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[d&&Fs(f,f.RGBA,f.FLOAT)?"RGBA":"",d&&Fs(f,f.RGB,f.FLOAT)?"RGB":"",d&&Fs(f,f.LUMINANCE,f.FLOAT)?"LUMINANCE":"",d&&Fs(f,f.ALPHA,f.FLOAT)?"ALPHA":"",d&&Fs(f,f.LUMINANCE_ALPHA,f.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",p?f.getParameter(p.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_FLOAT).rangeMax,"</sup>)"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_FLOAT).rangeMax,"</sup>)"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_FLOAT).rangeMax,"</sup>)"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_FLOAT).rangeMax,"</sup>)"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_FLOAT).rangeMax,"</sup>)"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_FLOAT).rangeMax,"</sup>)"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_INT).rangeMax,"</sup>)"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_INT).rangeMax,"</sup>)"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_INT).rangeMax,"</sup>)"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_INT).rangeMax,"</sup>)"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_INT).rangeMax,"</sup>)"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_INT).rangeMax,"</sup>)"].join("")],["Supported Extensions","EXTENSIONS",f.getSupportedExtensions().join("<br/>					    ")],["WebGL Renderer","RENDERER",f.getParameter(f.RENDERER)],["WebGL Vendor","VENDOR",f.getParameter(f.VENDOR)],["WebGL Version","VERSION",f.getParameter(f.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",f.getParameter(f.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",m&&f.getParameter(m.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",m&&f.getParameter(m.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",e.webgl2?2:1]],S={};for(;x.length;){const[C,_,T]=x.pop();_&&(S[_]={label:C,value:T})}return e._glInformation=S,S},t.traverseAllPasses=()=>{if(e.renderPasses)for(let d=0;d<e.renderPasses.length;++d)e.renderPasses[d].traverse(t,null);t.copyParentContent(),e.notifyStartCaptureImage&&o();const f=e.renderable.getChildRenderWindowsByReference();for(let d=0;d<f.length;++d)t.getViewNodeFor(f[d])?.traverseAllPasses()},t.copyParentContent=()=>{const f=e.rootOpenGLRenderWindow;if(!f||!e.context2D||e.children.some(m=>!!m.getSelector?.()))return;const d=f.getCanvas(),h=e.canvas;e.context2D.drawImage(d,0,d.height-h.height,h.width,h.height,0,0,h.width,h.height)},t.resizeFromChildRenderWindows=()=>{const f=e.renderable.getChildRenderWindowsByReference();if(f.length>0){const d=[0,0];for(let h=0;h<f.length;++h){const m=t.getViewNodeFor(f[h])?.getSize();m&&(d[0]=m[0]>d[0]?m[0]:d[0],d[1]=m[1]>d[1]?m[1]:d[1])}t.setSize(...d)}},t.disableCullFace=()=>{e.cullFaceEnabled&&(e.context.disable(e.context.CULL_FACE),e.cullFaceEnabled=!1)},t.enableCullFace=()=>{e.cullFaceEnabled||(e.context.enable(e.context.CULL_FACE),e.cullFaceEnabled=!0)},t.setViewStream=f=>{if(e.viewStream===f)return!1;if(e.subscription&&(e.subscription.unsubscribe(),e.subscription=null),e.viewStream=f,e.viewStream){const d=e.renderable.getRenderers()[0];d.getBackgroundByReference()[3]=0,t.setUseBackgroundImage(!0),e.subscription=e.viewStream.onImageReady(h=>t.setBackgroundImage(h.image)),e.viewStream.setSize(e.size[0],e.size[1]),e.viewStream.invalidateCache(),e.viewStream.render(),t.modified()}return!0},t.createSelector=()=>{const f=bF.newInstance();return f.setOpenGLRenderWindow(t),f};function c(){e.canvas.removeEventListener("webglcontextlost",cte),e.canvas.removeEventListener("webglcontextrestored",t.restoreContext)}t.delete=se.chain(()=>{e.context&&v7t(),t.setContainer(),t.setViewStream()},c,t.delete),t.setActiveFramebuffer=f=>{e.activeFramebuffer=f};const l=t.setSize;t.setSize=(f,d)=>{const h=l(f,d);return h&&t.invokeWindowResizeEvent({width:f,height:d}),h},t.registerGraphicsResourceUser=(f,d)=>{e._graphicsResources.has(f)||t.setGraphicsResourceForObject(f,null,null),e._graphicsResources.get(f)?.users.add(d)},t.unregisterGraphicsResourceUser=(f,d)=>{const h=e._graphicsResources.get(f);h&&(h.users.delete(d),h.users.size||(h.oglObject?.releaseGraphicsResources(t),e._graphicsResources.delete(f)))},t.getGraphicsResourceForObject=f=>e._graphicsResources.get(f),t.setGraphicsResourceForObject=(f,d,h)=>{if(!f)return;const m=e._graphicsResources.get(f);m?.oglObject?.releaseGraphicsResources(t),e._graphicsResources.set(f,{coreObject:f,oglObject:d,hash:h,users:m?.users??new Set})},t.getGraphicsMemoryInfo=()=>{let f=0;return e._graphicsResources.forEach(d=>{let{oglObject:h}=d;f+=h.getAllocatedGPUMemoryInBytes()}),f},t.releaseGraphicsResources=()=>{e.shaderCache!==null&&e.shaderCache.releaseGraphicsResources(t),e._graphicsResources.forEach(f=>{let{oglObject:d}=f;d.releaseGraphicsResources(t)}),e._graphicsResources.clear(),e.textureUnitManager!==null&&e.textureUnitManager.freeAll(),e.renderable.getRenderersByReference().forEach(f=>{t.getViewNodeFor(f)?.releaseGraphicsResources()})};const u={...t};p7t.forEach(f=>{t[f]=function(){return e.rootOpenGLRenderWindow?e.rootOpenGLRenderWindow[f](...arguments):u[f](...arguments)}})}const b7t={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,context2D:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};function cbe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,b7t,n),f7t.extend(t,e,n),e.canvas||(e.canvas=document.createElement("canvas"),e.canvas.style.width="100%"),e.selector||(e.selector=bF.newInstance(),e.selector.setOpenGLRenderWindow(t)),e.bgImage=new Image,e.bgImage.style.position="absolute",e.bgImage.style.left="0",e.bgImage.style.top="0",e.bgImage.style.width="100%",e.bgImage.style.height="100%",e.bgImage.style.zIndex="-1",e._textureResourceIds=new Map,e._graphicsResources=new Map,e._glInformation=null,e.myFactory=DCt.newInstance(),e.shaderCache=n7t.newInstance(),e.shaderCache.setOpenGLRenderWindow(t),e.renderPasses[0]=Kwe.newInstance(),se.get(t,e,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer","rootOpenGLRenderWindow"]),se.setGet(t,e,["initialized","context","context2D","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),se.setGetArray(t,e,["size"],2),se.event(t,e,"imageReady"),se.event(t,e,"windowResizeEvent"),w7t(t,e)}const SF=se.newInstance(cbe,"vtkOpenGLRenderWindow");Bwe("WebGL",SF);var S7t={newInstance:SF,extend:cbe,pushMonitorGLContextCount:y7t,popMonitorGLContextCount:x7t};jo("vtkRenderWindow",SF);function C7t(t,e){e.classHierarchy.push("vtkOpenGLActor"),t.buildPass=n=>{if(n){e._openGLRenderWindow=t.getLastAncestorOfType("vtkOpenGLRenderWindow"),e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer"),e.context=e._openGLRenderWindow.getContext(),t.prepareNodes(),t.addMissingNodes(e.renderable.getTextures()),t.addMissingNode(e.renderable.getMapper()),t.removeUnusedNodes(),e.ogltextures=null,e.activeTextures=null;for(let r=0;r<e.children.length;r++){const i=e.children[r];i.isA("vtkOpenGLTexture")?(e.ogltextures||(e.ogltextures=[]),e.ogltextures.push(i)):e.oglmapper=i}}},t.traverseZBufferPass=n=>{!e.renderable||!e.renderable.getNestedVisibility()||e._openGLRenderer.getSelector()&&!e.renderable.getNestedPickable()||(t.apply(n,!0),e.oglmapper.traverse(n),t.apply(n,!1))},t.traverseOpaqueZBufferPass=n=>t.traverseOpaquePass(n),t.traverseOpaquePass=n=>{!e.renderable||!e.renderable.getNestedVisibility()||!e.renderable.getIsOpaque()||e._openGLRenderer.getSelector()&&!e.renderable.getNestedPickable()||(t.apply(n,!0),e.oglmapper.traverse(n),t.apply(n,!1))},t.traverseTranslucentPass=n=>{!e.renderable||!e.renderable.getNestedVisibility()||e.renderable.getIsOpaque()||e._openGLRenderer.getSelector()&&!e.renderable.getNestedPickable()||(t.apply(n,!0),e.oglmapper.traverse(n),t.apply(n,!1))},t.activateTextures=()=>{if(e.ogltextures){e.activeTextures=[];for(let n=0;n<e.ogltextures.length;n++){const r=e.ogltextures[n];r.render(),r.getHandle()&&e.activeTextures.push(r)}}},t.queryPass=(n,r)=>{if(n){if(!e.renderable||!e.renderable.getVisibility())return;e.renderable.getIsOpaque()?r.incrementOpaqueActorCount():r.incrementTranslucentActorCount()}},t.zBufferPass=(n,r)=>t.opaquePass(n,r),t.opaqueZBufferPass=(n,r)=>t.opaquePass(n,r),t.opaquePass=(n,r)=>{if(n)e.context.depthMask(!0),t.activateTextures();else if(e.activeTextures)for(let i=0;i<e.activeTextures.length;i++)e.activeTextures[i].deactivate()},t.translucentPass=(n,r)=>{if(n)e.context.depthMask(e._openGLRenderer.getSelector()&&e.renderable.getNestedPickable()),t.activateTextures();else if(e.activeTextures)for(let i=0;i<e.activeTextures.length;i++)e.activeTextures[i].deactivate()},t.getKeyMatrices=()=>(e.renderable.getMTime()>e.keyMatrixTime.getMTime()&&(e.renderable.computeMatrix(),pa(e.keyMatrices.mcwc,e.renderable.getMatrix()),cr(e.keyMatrices.mcwc,e.keyMatrices.mcwc),e.renderable.getIsIdentity()?vf(e.keyMatrices.normalMatrix):(FE(e.keyMatrices.normalMatrix,e.keyMatrices.mcwc),g3(e.keyMatrices.normalMatrix,e.keyMatrices.normalMatrix),GU(e.keyMatrices.normalMatrix,e.keyMatrices.normalMatrix)),e.keyMatrixTime.modified()),e.keyMatrices)}const _7t={context:null,keyMatrixTime:null,keyMatrices:null,activeTextures:null};function T7t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,_7t,n),La.extend(t,e,n),e.keyMatrixTime={},yi(e.keyMatrixTime,{mtime:0}),e.keyMatrices={normalMatrix:vf(new Float64Array(9)),mcwc:sn(new Float64Array(16))},Ja(t,e,["context"]),sc(t,e,["activeTextures"]),C7t(t,e)}const lbe=ri(T7t);var E7t={newInstance:lbe};jo("vtkActor",lbe);function O7t(t,e){e.classHierarchy.push("vtkOpenGLActor2D"),t.buildPass=n=>{if(n){if(!e.renderable)return;e._openGLRenderWindow=t.getLastAncestorOfType("vtkOpenGLRenderWindow"),e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer"),e.context=e._openGLRenderWindow.getContext(),t.prepareNodes(),t.addMissingNodes(e.renderable.getTextures()),t.addMissingNode(e.renderable.getMapper()),t.removeUnusedNodes(),e.ogltextures=null,e.activeTextures=null;for(let r=0;r<e.children.length;r++){const i=e.children[r];i.isA("vtkOpenGLTexture")?(e.ogltextures||(e.ogltextures=[]),e.ogltextures.push(i)):e.oglmapper=i}}},t.queryPass=(n,r)=>{if(n){if(!e.renderable||!e.renderable.getVisibility())return;r.incrementOverlayActorCount()}},t.traverseOpaquePass=n=>{!e.oglmapper||!e.renderable||!e.renderable.getNestedVisibility()||!e.renderable.getIsOpaque()||e._openGLRenderer.getSelector()&&!e.renderable.getNestedPickable()||(t.apply(n,!0),e.oglmapper.traverse(n),t.apply(n,!1))},t.traverseTranslucentPass=n=>{!e.oglmapper||!e.renderable||!e.renderable.getNestedVisibility()||e.renderable.getIsOpaque()||e._openGLRenderer.getSelector()&&!e.renderable.getNestedPickable()||(t.apply(n,!0),e.oglmapper.traverse(n),t.apply(n,!1))},t.traverseOverlayPass=n=>{!e.oglmapper||!e.renderable||!e.renderable.getNestedVisibility()||e._openGLRenderer.getSelector()&&!e.renderable.getNestedPickable||(t.apply(n,!0),e.oglmapper.traverse(n),t.apply(n,!1))},t.activateTextures=()=>{if(e.ogltextures){e.activeTextures=[];for(let n=0;n<e.ogltextures.length;n++){const r=e.ogltextures[n];r.render(),r.getHandle()&&e.activeTextures.push(r)}}},t.opaquePass=(n,r)=>{if(n)e.context.depthMask(!0),t.activateTextures();else if(e.activeTextures)for(let i=0;i<e.activeTextures.length;i++)e.activeTextures[i].deactivate()},t.translucentPass=(n,r)=>{if(n)e.context.depthMask(!1),t.activateTextures();else if(e.activeTextures)for(let i=0;i<e.activeTextures.length;i++)e.activeTextures[i].deactivate()},t.overlayPass=(n,r)=>{if(n)e.context.depthMask(!0),t.activateTextures();else if(e.activeTextures)for(let i=0;i<e.activeTextures.length;i++)e.activeTextures[i].deactivate()}}const D7t={context:null,activeTextures:null};function M7t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,D7t,n),La.extend(t,e,n),Ja(t,e,["context"]),sc(t,e,["activeTextures"]),O7t(t,e)}const ube=ri(M7t);var R7t={newInstance:ube};jo("vtkActor2D",ube);function I7t(t,e){e.classHierarchy.push("vtkAbstractMapper"),t.update=()=>{t.getInputData()},t.addClippingPlane=n=>n.isA("vtkPlane")?e.clippingPlanes.includes(n)?!1:(e.clippingPlanes.push(n),t.modified(),!0):!1,t.getNumberOfClippingPlanes=()=>e.clippingPlanes.length,t.removeAllClippingPlanes=()=>e.clippingPlanes.length===0?!1:(e.clippingPlanes.length=0,t.modified(),!0),t.removeClippingPlane=n=>{const r=e.clippingPlanes.indexOf(n);return r===-1?!1:(e.clippingPlanes.splice(r,1),t.modified(),!0)},t.getClippingPlanes=()=>e.clippingPlanes,t.setClippingPlanes=n=>{if(n)if(!Array.isArray(n))t.addClippingPlane(n);else{const r=n.length;for(let i=0;i<r&&i<6;i++)t.addClippingPlane(n[i])}},t.getClippingPlaneInDataCoords=(n,r,i)=>{const a=e.clippingPlanes,o=n;if(a){const s=a.length;if(r>=0&&r<s){const c=a[r],l=c.getNormal(),u=c.getOrigin(),f=l[0],d=l[1],h=l[2],m=-(f*u[0]+d*u[1]+h*u[2]);i[0]=f*o[0]+d*o[4]+h*o[8]+m*o[12],i[1]=f*o[1]+d*o[5]+h*o[9]+m*o[13],i[2]=f*o[2]+d*o[6]+h*o[10]+m*o[14],i[3]=f*o[3]+d*o[7]+h*o[11]+m*o[15];return}}se.vtkErrorMacro(`Clipping plane index ${r} is out of range.`)}}const N7t={clippingPlanes:[]};function P7t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,N7t,n),se.obj(t,e),se.algo(t,e,1,0),e.clippingPlanes||(e.clippingPlanes=[]),I7t(t,e)}var k7t={extend:P7t};function A7t(t,e){t.getBounds=()=>(se.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),op()),t.getCenter=()=>{const n=t.getBounds();return e.center=ci.isValid(n)?ci.getCenter(n):null,e.center?.slice()},t.getLength=()=>{const n=t.getBounds();return ci.getDiagonalLength(n)}}const L7t=t=>({bounds:[...ci.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...t});function V7t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,L7t(n)),k7t.extend(t,e,n),se.setGet(t,e,["viewSpecificProperties"]),A7t(t,e)}var CF={extend:V7t};const{vtkErrorMacro:lte}=se,ute=0,fte=1,jR=2;function $7t(t,e){e.classHierarchy.push("vtkLookupTable"),t.isOpaque=()=>{if(e.opaqueFlagBuildTime.getMTime()<t.getMTime()){let n=!0;e.nanColor[3]<1&&(n=0),e.useBelowRangeColor&&e.belowRangeColor[3]<1&&(n=0),e.useAboveRangeColor&&e.aboveRangeColor[3]<1&&(n=0);for(let r=3;r<e.table.length&&n;r+=4)e.table[r]<255&&(n=!1);e.opaqueFlag=n,e.opaqueFlagBuildTime.modified()}return e.opaqueFlag},t.usingLogScale=()=>!1,t.getNumberOfAvailableColors=()=>e.table.length/4-3,t.linearIndexLookup=(n,r)=>{let i=0;const a=Number(n);return a<r.range[0]?i=r.maxIndex+ute+1.5:a>r.range[1]?i=r.maxIndex+fte+1.5:(i=(a+r.shift)*r.scale,i=i<r.maxIndex?i:r.maxIndex),Math.floor(i)},t.linearLookup=(n,r,i)=>{let a=0;$T(n)?a=Math.floor(i.maxIndex+1.5+jR):a=t.linearIndexLookup(n,i);const o=4*a;return r.slice(o,o+4)},t.indexedLookupFunction=(n,r,i)=>{let a=t.getAnnotatedValueIndexInternal(n);a===-1&&(a=e.numberOfColors+jR);const o=4*a;return[r[o],r[o+1],r[o+2],r[o+3]]},t.lookupShiftAndScale=(n,r)=>{r.shift=-n[0],r.scale=Number.MAX_VALUE,n[1]>n[0]&&(r.scale=(r.maxIndex+1)/(n[1]-n[0]))},t.mapScalarsThroughTable=(n,r,i,a)=>{let o=t.linearLookup;e.indexedLookup&&(o=t.indexedLookupFunction);const s=t.getMappingRange(),c={maxIndex:t.getNumberOfColors()-1,range:s,shift:0,scale:0};t.lookupShiftAndScale(s,c);const l=t.getAlpha(),u=n.getNumberOfTuples(),f=n.getNumberOfComponents(),d=r.getData(),h=n.getData();if(l>=1){if(i===rk.RGBA)for(let m=0;m<u;m++){const p=o(h[m*f+a],e.table,c);d[m*4]=p[0],d[m*4+1]=p[1],d[m*4+2]=p[2],d[m*4+3]=p[3]}}else if(i===rk.RGBA)for(let m=0;m<u;m++){const p=o(h[m*f+a],e.table,c);d[m*4]=p[0],d[m*4+1]=p[1],d[m*4+2]=p[2],d[m*4+3]=Math.floor(p[3]*l+.5)}},t.forceBuild=()=>{let n=0,r=0,i=0,a=0;const o=e.numberOfColors-1;o&&(n=(e.hueRange[1]-e.hueRange[0])/o,r=(e.saturationRange[1]-e.saturationRange[0])/o,i=(e.valueRange[1]-e.valueRange[0])/o,a=(e.alphaRange[1]-e.alphaRange[0])/o),e.table.length=4*o+16;const s=[],c=[];for(let l=0;l<=o;l++)s[0]=e.hueRange[0]+l*n,s[1]=e.saturationRange[0]+l*r,s[2]=e.valueRange[0]+l*i,um(s,c),c[3]=e.alphaRange[0]+l*a,e.table[l*4]=c[0]*255+.5,e.table[l*4+1]=c[1]*255+.5,e.table[l*4+2]=c[2]*255+.5,e.table[l*4+3]=c[3]*255+.5;t.buildSpecialColors(),e.buildTime.modified()},t.setTable=n=>{if(Array.isArray(n)){const i=n[0].length;e.numberOfColors=n.length;const a=4-i;let o=0;for(let s=0;s<e.numberOfColors;s++)e.table[s*4]=255,e.table[s*4+1]=255,e.table[s*4+2]=255,e.table[s*4+3]=255;for(let s=0;s<n.length;s++){const c=n[s];for(let l=0;l<i;l++)e.table[o++]=c[l];o+=a}return t.buildSpecialColors(),e.insertTime.modified(),t.modified(),!0}if(n.getNumberOfComponents()!==4)return lte("Expected 4 components for RGBA colors"),!1;if(n.getDataType()!==zn.UNSIGNED_CHAR)return lte("Expected unsigned char values for RGBA colors"),!1;e.numberOfColors=n.getNumberOfTuples();const r=n.getData();e.table.length=r.length;for(let i=0;i<r.length;i++)e.table[i]=r[i];return t.buildSpecialColors(),e.insertTime.modified(),t.modified(),!0},t.buildSpecialColors=()=>{const{numberOfColors:n}=e,r=e.table;let i=(n+ute)*4;e.useBelowRangeColor||n===0?(r[i]=e.belowRangeColor[0]*255+.5,r[i+1]=e.belowRangeColor[1]*255+.5,r[i+2]=e.belowRangeColor[2]*255+.5,r[i+3]=e.belowRangeColor[3]*255+.5):(r[i]=r[0],r[i+1]=r[1],r[i+2]=r[2],r[i+3]=r[3]),i=(n+fte)*4,e.useAboveRangeColor||n===0?(r[i]=e.aboveRangeColor[0]*255+.5,r[i+1]=e.aboveRangeColor[1]*255+.5,r[i+2]=e.aboveRangeColor[2]*255+.5,r[i+3]=e.aboveRangeColor[3]*255+.5):(r[i]=r[4*(n-1)+0],r[i+1]=r[4*(n-1)+1],r[i+2]=r[4*(n-1)+2],r[i+3]=r[4*(n-1)+3]),i=(n+jR)*4,r[i]=e.nanColor[0]*255+.5,r[i+1]=e.nanColor[1]*255+.5,r[i+2]=e.nanColor[2]*255+.5,r[i+3]=e.nanColor[3]*255+.5},t.build=()=>{(e.table.length<1||t.getMTime()>e.buildTime.getMTime()&&e.insertTime.getMTime()<=e.buildTime.getMTime())&&t.forceBuild()},e.table.length>0&&(t.buildSpecialColors(),e.insertTime.modified())}const j7t={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function fbe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,j7t,n),FU.extend(t,e,n),e.table||(e.table=[]),e.buildTime={},se.obj(e.buildTime),e.opaqueFlagBuildTime={},se.obj(e.opaqueFlagBuildTime,{mtime:0}),e.insertTime={},se.obj(e.insertTime,{mtime:0}),se.get(t,e,["buildTime"]),se.setGet(t,e,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),se.setArray(t,e,["alphaRange","hueRange","saturationRange","valueRange"],2),se.setArray(t,e,["nanColor","belowRangeColor","aboveRangeColor"],4),se.getArray(t,e,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),$7t(t,e)}const U7t=se.newInstance(fbe,"vtkLookupTable");var vk={newInstance:U7t,extend:fbe};const{FieldAssociations:dte}=k2,{staticOffsetAPI:F7t,otherStaticMethods:B7t}=qE,{ColorMode:MS,ScalarMode:qp,GetArray:UR}=UU,{VectorMode:z7t}=jU,{VtkDataTypes:G7t}=On;function t5(t){return()=>se.vtkErrorMacro(`vtkMapper::${t} - NOT IMPLEMENTED`)}function W7t(t,e){const n=t[1]%2===0?1:-1;if(t[0]+=n,t[0]>=e[0]||t[0]<0){const r=t[2]%2===0?1:-1;t[0]-=n,t[1]+=r,(t[1]>=e[1]||t[1]<0)&&(t[1]-=r,t[2]++)}}function H7t(t,e){return t[0]+e[0]*(t[1]+e[1]*t[2])}function hte(t,e,n){const r=Math.floor(e),i=r%(2*n[0]);let a,o;i<n[0]?(t[0]=i,a=1,o=t[0]===n[0]-1):(t[0]=2*n[0]-1-i,a=-1,o=t[0]===0);const s=Math.floor(r/n[0]),c=s%(2*n[1]);let l,u;c<n[1]?(t[1]=c,l=1,u=t[1]===n[1]-1):(t[1]=2*n[1]-1-c,l=-1,u=t[1]===0),t[2]=Math.floor(s/n[1]);const f=e-r;o?u?t[2]+=f:t[1]+=l*f:t[0]+=a*f,t[0]=(t[0]+.5)/n[0],t[1]=(t[1]+.5)/n[1],t[2]=(t[2]+.5)/n[2]}const gte=new WeakMap;function q7t(t,e,n,r,i,a,o){const s=new Array(arguments.length);for(let $=0;$<arguments.length;++$){const W=arguments[$];s[$]=W.getMTime?.()??W}const c=s.join("/"),l=gte.get(t);if(l&&l.stringHash===c)return l.textureCoordinates;const u=(n[1]-n[0])/(r-1),[f,d]=[n[0]-u,n[1]+u],h=f-.5*u,m=1/(d-f+u),p=f,y=(r+1)/(d-f),x=t.getData(),S=t.getNumberOfTuples(),C=t.getNumberOfComponents(),_=e<0||e>=C,T=i[2]<=1?2:3,O=On.newInstance({numberOfComponents:T,values:new Float32Array(S*T)}),M=O.getData(),I=[0,0,0];hte(I,r+2,i);let V=0,k=0;const L=[.5,.5,.5];for(let $=0;$<S;++$){let W;if(_){let G=0;for(let oe=0;oe<C;++oe){const U=x[V+oe];G+=U*U}W=Math.sqrt(G)}else W=x[V+e];if(V+=C,a&&(W=vk.applyLogScale(W,n,n)),$T(W))L[0]=I[0],L[1]=I[1],L[2]=I[2];else if(o){let G=(W-p)*y;G<1?G=0:G>r&&(G=r+1),hte(L,G,i)}else{L[1]=.49;const G=(W-h)*m;G>1e3?L[0]=1e3:G<-1e3?L[0]=-1e3:L[0]=G}for(let G=0;G<T;++G)M[k++]=L[G]}return gte.set(t,{stringHash:c,textureCoordinates:O}),O}function K7t(t,e){e.classHierarchy.push("vtkMapper"),t.getBounds=()=>{const n=t.getInputData();return n?(e.static||t.update(),e.bounds=n.getBounds()):e.bounds=op(),e.bounds},t.setForceCompileOnly=n=>{e.forceCompileOnly=n},t.setSelectionWebGLIdsToVTKIds=n=>{e.selectionWebGLIdsToVTKIds=n},t.createDefaultLookupTable=()=>{e.lookupTable=vk.newInstance()},t.getColorModeAsString=()=>se.enumToString(MS,e.colorMode),t.setColorModeToDefault=()=>t.setColorMode(0),t.setColorModeToMapScalars=()=>t.setColorMode(1),t.setColorModeToDirectScalars=()=>t.setColorMode(2),t.getScalarModeAsString=()=>se.enumToString(qp,e.scalarMode),t.setScalarModeToDefault=()=>t.setScalarMode(0),t.setScalarModeToUsePointData=()=>t.setScalarMode(1),t.setScalarModeToUseCellData=()=>t.setScalarMode(2),t.setScalarModeToUsePointFieldData=()=>t.setScalarMode(3),t.setScalarModeToUseCellFieldData=()=>t.setScalarMode(4),t.setScalarModeToUseFieldData=()=>t.setScalarMode(5),t.getAbstractScalars=(n,r,i,a,o)=>{if(!n||!e.scalarVisibility)return{scalars:null,cellFlag:!1};let s=null,c=!1;if(r===qp.DEFAULT)s=n.getPointData().getScalars(),s||(s=n.getCellData().getScalars(),c=!0);else if(r===qp.USE_POINT_DATA)s=n.getPointData().getScalars();else if(r===qp.USE_CELL_DATA)s=n.getCellData().getScalars(),c=!0;else if(r===qp.USE_POINT_FIELD_DATA){const l=n.getPointData();i===UR.BY_ID?s=l.getArrayByIndex(a):s=l.getArrayByName(o)}else if(r===qp.USE_CELL_FIELD_DATA){const l=n.getCellData();c=!0,i===UR.BY_ID?s=l.getArrayByIndex(a):s=l.getArrayByName(o)}else if(r===qp.USE_FIELD_DATA){const l=n.getFieldData();i===UR.BY_ID?s=l.getArrayByIndex(a):s=l.getArrayByName(o)}return{scalars:s,cellFlag:c}},t.mapScalars=(n,r)=>{const{scalars:i,cellFlag:a}=t.getAbstractScalars(n,e.scalarMode,e.arrayAccessMode,e.arrayId,e.colorByArrayName);if(e.areScalarsMappedFromCells=a,!i){e.colorCoordinates=null,e.colorTextureMap=null,e.colorMapColors=null;return}const o=`${t.getMTime()}${i.getMTime()}${r}`;if(e.colorBuildString!==o){if(e.useLookupTableScalarRange||t.getLookupTable().setRange(e.scalarRange[0],e.scalarRange[1]),t.canUseTextureMapForColoring(i,a))e.mapScalarsToTexture(i,a,r);else{e.colorCoordinates=null,e.colorTextureMap=null;const s=t.getLookupTable();s&&(s.build(),e.colorMapColors=s.mapScalars(i,e.colorMode,e.fieldDataTupleId))}e.colorBuildString=`${t.getMTime()}${i.getMTime()}${r}`}},e.mapScalarsToTexture=(n,r,i)=>{const a=e.lookupTable.getRange(),o=e.lookupTable.usingLogScale();o&&vk.getLogRange(a,a);const s=e.lookupTable.getAlpha();if(e.colorMapColors=null,e.colorTextureMap==null||t.getMTime()>e.colorTextureMap.getMTime()||e.lookupTable.getMTime()>e.colorTextureMap.getMTime()||e.lookupTable.getAlpha()!==i){e.lookupTable.setAlpha(i),e.colorTextureMap=null,e.lookupTable.build();const l=e.lookupTable.getNumberOfAvailableColors(),u=2048,f=u**3-3,h=4096-2,m=2,p=r?f:h;e.numberOfColorsInRange=Math.min(Math.max(l,m),p);const y=e.numberOfColorsInRange+3,x=e.numberOfColorsInRange+2,S=r?[Math.min(Math.ceil(y/u**0),u),Math.min(Math.ceil(y/u**1),u),Math.min(Math.ceil(y/u**2),u)]:[x,2,1],C=S[0]*S[1]*S[2],_=new Float64Array(C);_.fill(NaN);const T=e.numberOfColorsInRange,O=T+2,M=[0,0,0],I=a[0],V=a[1]-a[0];for(let $=0;$<O;++$){const W=H7t(M,S),G=I+V*($-1)/(T-1);_[W]=o?10**G:G,W7t(M,S)}const k=On.newInstance({numberOfComponents:1,values:_}),L=e.lookupTable.mapScalars(k,e.colorMode,0);e.colorTextureMap=YE.newInstance(),e.colorTextureMap.setDimensions(S),e.colorTextureMap.getPointData().setScalars(L),e.lookupTable.setAlpha(s)}const c=e.lookupTable.getVectorMode()===z7t.MAGNITUDE&&n.getNumberOfComponents()>1?-1:e.lookupTable.getVectorComponent();e.colorCoordinates=q7t(n,c,a,e.numberOfColorsInRange,e.colorTextureMap.getDimensions(),o,r)},t.getIsOpaque=()=>{const n=t.getInputData(),i=t.getAbstractScalars(n,e.scalarMode,e.arrayAccessMode,e.arrayId,e.colorByArrayName).scalars;if(!e.scalarVisibility||i==null)return!0;const a=t.getLookupTable();return a?(a.build(),a.areScalarsOpaque(i,e.colorMode,-1)):!0},t.canUseTextureMapForColoring=(n,r)=>r&&e.colorMode!==MS.DIRECT_SCALARS?!0:!(!e.interpolateScalarsBeforeMapping||e.lookupTable&&e.lookupTable.getIndexedLookup()||!n||e.colorMode===MS.DEFAULT&&n.getDataType()===G7t.UNSIGNED_CHAR||e.colorMode===MS.DIRECT_SCALARS),t.clearColorArrays=()=>{e.colorMapColors=null,e.colorCoordinates=null,e.colorTextureMap=null},t.getLookupTable=()=>(e.lookupTable||t.createDefaultLookupTable(),e.lookupTable),t.getMTime=()=>{let n=e.mtime;if(e.lookupTable!==null){const r=e.lookupTable.getMTime();n=r>n?r:n}return n},t.getPrimitiveCount=()=>{const n=t.getInputData();return{points:n.getPoints().getNumberOfValues()/3,verts:n.getVerts().getNumberOfValues()-n.getVerts().getNumberOfCells(),lines:n.getLines().getNumberOfValues()-2*n.getLines().getNumberOfCells(),triangles:n.getPolys().getNumberOfValues()-3*n.getPolys().getNumberOfCells()}},t.acquireInvertibleLookupTable=t5("AcquireInvertibleLookupTable"),t.valueToColor=t5("ValueToColor"),t.colorToValue=t5("ColorToValue"),t.useInvertibleColorFor=t5("UseInvertibleColorFor"),t.clearInvertibleColor=t5("ClearInvertibleColor"),t.processSelectorPixelBuffers=(n,r)=>{if(!n||!e.selectionWebGLIdsToVTKIds||!e.populateSelectionSettings)return;const i=n.getRawPixelBuffer(qs.ID_LOW24),a=n.getRawPixelBuffer(qs.ID_HIGH24),o=n.getCurrentPass(),s=n.getFieldAssociation();let c=null;s===dte.FIELD_ASSOCIATION_POINTS?c=e.selectionWebGLIdsToVTKIds.points:s===dte.FIELD_ASSOCIATION_CELLS&&(c=e.selectionWebGLIdsToVTKIds.cells),c&&r.forEach(l=>{if(o===qs.ID_LOW24){let u=0;a&&(u+=a[l],u*=256),u+=i[l+2],u*=256,u+=i[l+1],u*=256,u+=i[l];const f=c[u],d=n.getPixelBuffer(qs.ID_LOW24);d[l]=f&255,d[l+1]=(f&65280)>>8,d[l+2]=(f&16711680)>>16}else if(o===qs.ID_HIGH24&&a){let u=0;u+=a[l],u*=256,u+=i[l+2],u*=256,u+=i[l+1],u*=256,u+=i[l];const f=c[u],d=n.getPixelBuffer(qs.ID_HIGH24);d[l]=(f&4278190080)>>24}})}}const Y7t={colorMapColors:null,areScalarsMappedFromCells:!1,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,numberOfColorsInRange:0,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function dbe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,Y7t,n),CF.extend(t,e,n),se.get(t,e,["areScalarsMappedFromCells","colorCoordinates","colorMapColors","colorTextureMap","numberOfColorsInRange","selectionWebGLIdsToVTKIds"]),se.setGet(t,e,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),se.setGetArray(t,e,["scalarRange"],2),qE.implementCoincidentTopologyMethods(t,e),K7t(t,e)}const X7t=se.newInstance(dbe,"vtkMapper");var hbe={newInstance:X7t,extend:dbe,...F7t,...B7t,...UU};const{FieldAssociations:FR}=k2,{primTypes:co}=Ph,{Representation:wv,Shading:pte}=w3,{ScalarMode:RS}=hbe,{Filter:mte,Wrap:vte}=mi,{vtkErrorMacro:Kp}=Rs,Z7t={type:"StartEvent"},Q7t={type:"EndEvent"},{CoordinateSystem:J7t}=x5e;function eOt(t){const e=t.getSelector();return e?e.getCurrentPass():qs.MIN_KNOWN_PASS-1}function tOt(t,e){e.classHierarchy.push("vtkOpenGLPolyDataMapper"),t.buildPass=r=>{r&&(e.currentRenderPass=null,e.openGLActor=t.getFirstAncestorOfType("vtkOpenGLActor"),e._openGLRenderer=e.openGLActor.getFirstAncestorOfType("vtkOpenGLRenderer"),e._openGLRenderWindow=e._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow"),e.openGLCamera=e._openGLRenderer.getViewNodeFor(e._openGLRenderer.getRenderable().getActiveCamera()))},t.translucentPass=(r,i)=>{r&&(e.currentRenderPass=i,t.render())},t.zBufferPass=r=>{r&&(e.haveSeenDepthRequest=!0,e.renderDepth=!0,t.render(),e.renderDepth=!1)},t.opaqueZBufferPass=r=>t.zBufferPass(r),t.opaquePass=r=>{r&&t.render()},t.render=()=>{const r=e._openGLRenderWindow.getContext();if(e.context!==r){e.context=r;for(let o=co.Start;o<co.End;o++)e.primitives[o].setOpenGLRenderWindow(e._openGLRenderWindow)}const i=e.openGLActor.getRenderable(),a=e._openGLRenderer.getRenderable();t.renderPiece(a,i)},t.getShaderTemplate=(r,i,a)=>{r.Vertex=wF,r.Fragment=v3,r.Geometry=""},t.replaceShaderColor=(r,i,a)=>{let o=r.Vertex,s=r.Geometry,c=r.Fragment;const l=e.lastBoundBO.getReferenceByName("lastLightComplexity");let u=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity","uniform vec3 ambientColorUniform;","uniform vec3 diffuseColorUniform;"];l&&(u=u.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let f=["vec3 ambientColor;","  vec3 diffuseColor;","  float opacity;"];l&&(f=f.concat(["  vec3 specularColor;","  float specularPower;"])),f=f.concat(["  ambientColor = ambientColorUniform;","  diffuseColor = diffuseColorUniform;","  opacity = opacityUniform;"]),l&&(f=f.concat(["  specularColor = specularColorUniform;","  specularPower = specularPowerUniform;"])),e.lastBoundBO.getCABO().getColorComponents()!==0&&!e.drawingEdges&&(u=u.concat(["varying vec4 vertexColorVSOutput;"]),o=Ie.substitute(o,"//VTK::Color::Dec",["attribute vec4 scalarColor;","varying vec4 vertexColorVSOutput;"]).result,o=Ie.substitute(o,"//VTK::Color::Impl",["vertexColorVSOutput =  scalarColor;"]).result,s=Ie.substitute(s,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,s=Ie.substitute(s,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result),e.lastBoundBO.getCABO().getColorComponents()!==0&&!e.drawingEdges?c=Ie.substitute(c,"//VTK::Color::Impl",f.concat(["  diffuseColor = vertexColorVSOutput.rgb;","  ambientColor = vertexColorVSOutput.rgb;","  opacity = opacity*vertexColorVSOutput.a;"])).result:(e.renderable.getAreScalarsMappedFromCells()||e.renderable.getInterpolateScalarsBeforeMapping())&&e.renderable.getColorCoordinates()&&!e.drawingEdges?c=Ie.substitute(c,"//VTK::Color::Impl",f.concat(["  vec4 texColor = texture2D(texture1, tcoordVCVSOutput.st);","  diffuseColor = texColor.rgb;","  ambientColor = texColor.rgb;","  opacity = opacity*texColor.a;"])).result:(a.getBackfaceProperty()&&!e.drawingEdges&&(u=u.concat(["uniform float opacityUniformBF; // the fragment opacity","uniform float ambientIntensityBF; // the material ambient","uniform float diffuseIntensityBF; // the material diffuse","uniform vec3 ambientColorUniformBF; // ambient material color","uniform vec3 diffuseColorUniformBF; // diffuse material color"]),l?(u=u.concat(["uniform float specularIntensityBF; // the material specular intensity","uniform vec3 specularColorUniformBF; // intensity weighted color","uniform float specularPowerUniformBF;"]),f=f.concat(["if (gl_FrontFacing == false) {","  ambientColor = ambientIntensityBF * ambientColorUniformBF;","  diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;","  specularColor = specularIntensityBF * specularColorUniformBF;","  specularPower = specularPowerUniformBF;","  opacity = opacityUniformBF; }"])):f=f.concat(["if (gl_FrontFacing == false) {","  ambientColor = ambientIntensityBF * ambientColorUniformBF;","  diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;","  opacity = opacityUniformBF; }"])),e.haveCellScalars&&!e.drawingEdges&&(u=u.concat(["uniform samplerBuffer texture1;"])),c=Ie.substitute(c,"//VTK::Color::Impl",f).result),c=Ie.substitute(c,"//VTK::Color::Dec",u).result,r.Vertex=o,r.Geometry=s,r.Fragment=c},t.replaceShaderLight=(r,i,a)=>{let o=r.Fragment;const s="",c=e.lastBoundBO.getReferenceByName("lastLightComplexity"),l=e.lastBoundBO.getReferenceByName("lastLightCount");let u=[];switch(c){case 0:o=Ie.substitute(o,"//VTK::Light::Impl",["  gl_FragData[0] = vec4(ambientColor * ambient + diffuseColor * diffuse, opacity);","  //VTK::Light::Impl"],!1).result;break;case 1:o=Ie.substitute(o,"//VTK::Light::Impl",["  float df = max(0.0, normalVCVSOutput.z);","  float sf = pow(df, specularPower);","  vec3 diffuseL = df * diffuseColor;","  vec3 specularL = sf * specularColor;","  gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);","  //VTK::Light::Impl"],!1).result;break;case 2:for(let f=0;f<l;++f)u=u.concat([`uniform vec3 lightColor${f};`,`uniform vec3 lightDirectionVC${f}; // normalized`,`uniform vec3 lightHalfAngleVC${f}; // normalized`]);o=Ie.substitute(o,"//VTK::Light::Dec",u).result,u=["vec3 diffuseL = vec3(0,0,0);","  vec3 specularL = vec3(0,0,0);","  float df;"];for(let f=0;f<l;++f)u=u.concat([`  df = max(0.0, dot(normalVCVSOutput, -lightDirectionVC${f}));`,`  diffuseL += ((df${s}) * lightColor${f});`,`  if (dot(normalVCVSOutput, lightDirectionVC${f}) < 0.0)`,"    {",`    float sf = sign(df)*pow(max(1e-5,
                                              dot(reflect(lightDirectionVC${f},normalVCVSOutput),
                                                  normalize(-vertexVC.xyz))),
                                         specularPower);`,`    specularL += (sf${s} * lightColor${f});`,"    }"]);u=u.concat(["  diffuseL = diffuseL * diffuseColor;","  specularL = specularL * specularColor;","  gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);","  //VTK::Light::Impl"]),o=Ie.substitute(o,"//VTK::Light::Impl",u,!1).result;break;case 3:for(let f=0;f<l;++f)u=u.concat([`uniform vec3 lightColor${f};`,`uniform vec3 lightDirectionVC${f}; // normalized`,`uniform vec3 lightHalfAngleVC${f}; // normalized`,`uniform vec3 lightPositionVC${f};`,`uniform vec3 lightAttenuation${f};`,`uniform float lightConeAngle${f};`,`uniform float lightExponent${f};`,`uniform int lightPositional${f};`]);o=Ie.substitute(o,"//VTK::Light::Dec",u).result,u=["vec3 diffuseL = vec3(0,0,0);","  vec3 specularL = vec3(0,0,0);","  vec3 vertLightDirectionVC;","  float attenuation;","  float df;"];for(let f=0;f<l;++f)u=u.concat(["  attenuation = 1.0;",`  if (lightPositional${f} == 0)`,"    {",`      vertLightDirectionVC = lightDirectionVC${f};`,"    }","  else","    {",`    vertLightDirectionVC = vertexVC.xyz - lightPositionVC${f};`,"    float distanceVC = length(vertLightDirectionVC);","    vertLightDirectionVC = normalize(vertLightDirectionVC);","    attenuation = 1.0 /",`      (lightAttenuation${f}.x`,`       + lightAttenuation${f}.y * distanceVC`,`       + lightAttenuation${f}.z * distanceVC * distanceVC);`,"    // per OpenGL standard cone angle is 90 or less for a spot light",`    if (lightConeAngle${f} <= 90.0)`,"      {",`      float coneDot = dot(vertLightDirectionVC, lightDirectionVC${f});`,"      // if inside the cone",`      if (coneDot >= cos(radians(lightConeAngle${f})))`,"        {",`        attenuation = attenuation * pow(coneDot, lightExponent${f});`,"        }","      else","        {","        attenuation = 0.0;","        }","      }","    }","    df = max(0.0, attenuation*dot(normalVCVSOutput, -vertLightDirectionVC));",`    diffuseL += ((df${s}) * lightColor${f});`,"    if (dot(normalVCVSOutput, vertLightDirectionVC) < 0.0)","      {",`      float sf = sign(df)*attenuation*pow(max(1e-5,
                                                           dot(reflect(lightDirectionVC${f},
                                                                       normalVCVSOutput),
                                                               normalize(-vertexVC.xyz))),
                                                       specularPower);`,`    specularL += ((sf${s}) * lightColor${f});`,"    }"]);u=u.concat(["  diffuseL = diffuseL * diffuseColor;","  specularL = specularL * specularColor;","  gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);","  //VTK::Light::Impl"]),o=Ie.substitute(o,"//VTK::Light::Impl",u,!1).result;break;default:Kp("bad light complexity")}r.Fragment=o},t.replaceShaderNormal=(r,i,a)=>{if(e.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let s=r.Vertex,c=r.Geometry,l=r.Fragment;e.lastBoundBO.getCABO().getNormalOffset()?(s=Ie.substitute(s,"//VTK::Normal::Dec",["attribute vec3 normalMC;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,s=Ie.substitute(s,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * normalMC;"]).result,c=Ie.substitute(c,"//VTK::Normal::Dec",["in vec3 normalVCVSOutput[];","out vec3 normalVCGSOutput;"]).result,c=Ie.substitute(c,"//VTK::Normal::Impl",["normalVCGSOutput = normalVCVSOutput[i];"]).result,l=Ie.substitute(l,"//VTK::Normal::Dec",["varying vec3 normalVCVSOutput;"]).result,l=Ie.substitute(l,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalVCVSOutput);","  if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):e.haveCellNormals?(l=Ie.substitute(l,"//VTK::Normal::Dec",["uniform mat3 normalMatrix;","uniform samplerBuffer textureN;"]).result,l=Ie.substitute(l,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalMatrix *","    texelFetchBuffer(textureN, gl_PrimitiveID + PrimitiveIDOffset).xyz);","  if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):e.lastBoundBO.getOpenGLMode(a.getProperty().getRepresentation())===e.context.LINES?(l=Ie.substitute(l,"//VTK::UniformFlow::Impl",["  vec3 fdx = dFdx(vertexVC.xyz);","  vec3 fdy = dFdy(vertexVC.xyz);","  //VTK::UniformFlow::Impl"]).result,l=Ie.substitute(l,"//VTK::Normal::Impl",["vec3 normalVCVSOutput;","  if (abs(fdx.x) > 0.0)","    { fdx = normalize(fdx); normalVCVSOutput = normalize(cross(vec3(fdx.y, -fdx.x, 0.0), fdx)); }","  else { fdy = normalize(fdy); normalVCVSOutput = normalize(cross(vec3(fdy.y, -fdy.x, 0.0), fdy));}"]).result):(l=Ie.substitute(l,"//VTK::Normal::Dec",["uniform int cameraParallel;"]).result,l=Ie.substitute(l,"//VTK::UniformFlow::Impl",["  vec3 fdx = dFdx(vertexVC.xyz);","  vec3 fdy = dFdy(vertexVC.xyz);","  //VTK::UniformFlow::Impl"]).result,l=Ie.substitute(l,"//VTK::Normal::Impl",["  fdx = normalize(fdx);","  fdy = normalize(fdy);","  vec3 normalVCVSOutput = normalize(cross(fdx,fdy));","  if (cameraParallel == 1 && normalVCVSOutput.z < 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }","  if (cameraParallel == 0 && dot(normalVCVSOutput,vertexVC.xyz) > 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"]).result),r.Vertex=s,r.Geometry=c,r.Fragment=l}},t.replaceShaderPositionVC=(r,i,a)=>{e.lastBoundBO.replaceShaderPositionVC(r,i,a);let o=r.Vertex,s=r.Geometry,c=r.Fragment;e.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(o=Ie.substitute(o,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,o=Ie.substitute(o,"//VTK::PositionVC::Impl",["vertexVCVSOutput = MCVCMatrix * vertexMC;","  gl_Position = MCPCMatrix * vertexMC;"]).result,o=Ie.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result,s=Ie.substitute(s,"//VTK::PositionVC::Dec",["in vec4 vertexVCVSOutput[];","out vec4 vertexVCGSOutput;"]).result,s=Ie.substitute(s,"//VTK::PositionVC::Impl",["vertexVCGSOutput = vertexVCVSOutput[i];"]).result,c=Ie.substitute(c,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,c=Ie.substitute(c,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;"]).result):(o=Ie.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,o=Ie.substitute(o,"//VTK::PositionVC::Impl",["  gl_Position = MCPCMatrix * vertexMC;"]).result),r.Vertex=o,r.Geometry=s,r.Fragment=c},t.replaceShaderTCoord=(r,i,a)=>{if(e.lastBoundBO.getCABO().getTCoordOffset()){let o=r.Vertex,s=r.Geometry,c=r.Fragment;if(e.drawingEdges)return;o=Ie.substitute(o,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result;const l=e.openGLActor.getActiveTextures();let u=2,f=2;if(l&&l.length>0&&(u=l[0].getComponents(),l[0].getTarget()===e.context.TEXTURE_CUBE_MAP&&(f=3)),e.renderable.getColorTextureMap()&&(u=e.renderable.getColorTextureMap().getPointData().getScalars().getNumberOfComponents(),f=2),f===2){if(o=Ie.substitute(o,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result,s=Ie.substitute(s,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];","out vec2 tcoordVCGSOutput;"]).result,s=Ie.substitute(s,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,c=Ie.substitute(c,"//VTK::TCoord::Dec",["varying vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,l&&l.length>=1)switch(u){case 1:c=Ie.substitute(c,"//VTK::TCoord::Impl",["  vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","  ambientColor = ambientColor*tcolor.r;","  diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:c=Ie.substitute(c,"//VTK::TCoord::Impl",["  vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","  ambientColor = ambientColor*tcolor.r;","  diffuseColor = diffuseColor*tcolor.r;","  opacity = opacity * tcolor.g;"]).result;break;default:c=Ie.substitute(c,"//VTK::TCoord::Impl",["  vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","  ambientColor = ambientColor*tcolor.rgb;","  diffuseColor = diffuseColor*tcolor.rgb;","  opacity = opacity * tcolor.a;"]).result}}else switch(o=Ie.substitute(o,"//VTK::TCoord::Dec","attribute vec3 tcoordMC; varying vec3 tcoordVCVSOutput;").result,s=Ie.substitute(s,"//VTK::TCoord::Dec",["in vec3 tcoordVCVSOutput[];","out vec3 tcoordVCGSOutput;"]).result,s=Ie.substitute(s,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,c=Ie.substitute(c,"//VTK::TCoord::Dec",["varying vec3 tcoordVCVSOutput;","uniform samplerCube texture1;"]).result,u){case 1:c=Ie.substitute(c,"//VTK::TCoord::Impl",["  vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);","  ambientColor = ambientColor*tcolor.r;","  diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:c=Ie.substitute(c,"//VTK::TCoord::Impl",["  vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);","  ambientColor = ambientColor*tcolor.r;","  diffuseColor = diffuseColor*tcolor.r;","  opacity = opacity * tcolor.g;"]).result;break;default:c=Ie.substitute(c,"//VTK::TCoord::Impl",["  vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);","  ambientColor = ambientColor*tcolor.rgb;","  diffuseColor = diffuseColor*tcolor.rgb;","  opacity = opacity * tcolor.a;"]).result}r.Vertex=o,r.Geometry=s,r.Fragment=c}},t.replaceShaderClip=(r,i,a)=>{let o=r.Vertex,s=r.Fragment;if(e.renderable.getNumberOfClippingPlanes()){const c=e.renderable.getNumberOfClippingPlanes();o=Ie.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`uniform vec4 clipPlanes[${c}];`,`varying float clipDistancesVSOutput[${c}];`]).result,o=Ie.substitute(o,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${c}; planeNum++)`,"    {","    if (planeNum >= numClipPlanes)","        {","        break;","        }","    clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);","    }"]).result,s=Ie.substitute(s,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`varying float clipDistancesVSOutput[${c}];`]).result,s=Ie.substitute(s,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${c}; planeNum++)`,"    {","    if (planeNum >= numClipPlanes)","        {","        break;","        }","    if (clipDistancesVSOutput[planeNum] < 0.0) discard;","    }"]).result}r.Vertex=o,r.Fragment=s},t.getCoincidentParameters=(r,i)=>{let a={factor:0,offset:0};const o=i.getProperty();if(e.renderable.getResolveCoincidentTopology()==Of.PolygonOffset||o.getEdgeVisibility()&&o.getRepresentation()===wv.SURFACE){const c=e.lastBoundBO.getPrimitiveType();c===co.Points||o.getRepresentation()===wv.POINTS?a=e.renderable.getCoincidentTopologyPointOffsetParameter():c===co.Lines||o.getRepresentation()===wv.WIREFRAME?a=e.renderable.getCoincidentTopologyLineOffsetParameters():(c===co.Tris||c===co.TriStrips)&&(a=e.renderable.getCoincidentTopologyPolygonOffsetParameters()),(c===co.TrisEdges||c===co.TriStripsEdges)&&(a=e.renderable.getCoincidentTopologyPolygonOffsetParameters(),a.factor/=2,a.offset/=2)}const s=e._openGLRenderer.getSelector();return s&&s.getFieldAssociation()===FR.FIELD_ASSOCIATION_POINTS&&(a.offset-=2),a},t.replaceShaderPicking=(r,i,a)=>{let o=r.Fragment,s=r.Vertex;if(o=Ie.substitute(o,"//VTK::Picking::Dec",["uniform int picking;","//VTK::Picking::Dec"]).result,!!e._openGLRenderer.getSelector()){switch((e.lastSelectionState===qs.ID_LOW24||e.lastSelectionState===qs.ID_HIGH24)&&(s=Ie.substitute(s,"//VTK::Picking::Dec",[`flat out int vertexIDVSOutput;
`,`uniform int VertexIDOffset;
`]).result,s=Ie.substitute(s,"//VTK::Picking::Impl",`  vertexIDVSOutput = gl_VertexID + VertexIDOffset;
`).result,o=Ie.substitute(o,"//VTK::Picking::Dec",`flat in int vertexIDVSOutput;
`).result,o=Ie.substitute(o,"//VTK::Picking::Impl",["  int idx = vertexIDVSOutput;","//VTK::Picking::Impl"]).result),e.lastSelectionState){case qs.ID_LOW24:o=Ie.substitute(o,"//VTK::Picking::Impl","  gl_FragData[0] = vec4(float(idx%256)/255.0, float((idx/256)%256)/255.0, float((idx/65536)%256)/255.0, 1.0);").result;break;case qs.ID_HIGH24:o=Ie.substitute(o,"//VTK::Picking::Impl","  gl_FragData[0] = vec4(float((idx/16777216)%256)/255.0, 0.0, 0.0, 1.0);").result;break;default:o=Ie.substitute(o,"//VTK::Picking::Dec","uniform vec3 mapperIndex;").result,o=Ie.substitute(o,"//VTK::Picking::Impl","  gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result}r.Fragment=o,r.Vertex=s}},t.replaceShaderValues=(r,i,a)=>{if(t.replaceShaderColor(r,i,a),t.replaceShaderNormal(r,i,a),t.replaceShaderLight(r,i,a),t.replaceShaderTCoord(r,i,a),t.replaceShaderPicking(r,i,a),t.replaceShaderClip(r,i,a),t.replaceShaderCoincidentOffset(r,i,a),t.replaceShaderPositionVC(r,i,a),e.haveSeenDepthRequest){let o=r.Fragment;o=Ie.substitute(o,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,o=Ie.substitute(o,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,r.Fragment=o}},t.getNeedToRebuildShaders=(r,i,a)=>{let o=0,s=0;const c=r.getPrimitiveType(),l=e.currentInput;let u=!1;const f=l.getPointData().getNormals(),d=l.getCellData().getNormals(),h=a.getProperty().getInterpolation()===pte.FLAT,m=a.getProperty().getRepresentation(),p=r.getOpenGLMode(m,c);if((p===e.context.TRIANGLES||d&&!f||!h&&f||!h&&p===e.context.LINES)&&(u=!0),a.getProperty().getLighting()&&u){o=0;const C=i.getLightsByReference();for(let _=0;_<C.length;++_){const T=C[_];T.getSwitch()>0&&(s++,o===0&&(o=1)),o===1&&(s>1||T.getIntensity()!==1||!T.lightTypeIsHeadLight())&&(o=2),o<3&&T.getPositional()&&(o=3)}}let y=!1;const x=e.lastBoundBO.getReferenceByName("lastLightComplexity"),S=e.lastBoundBO.getReferenceByName("lastLightCount");return(x!==o||S!==s)&&(e.lastBoundBO.set({lastLightComplexity:o},!0),e.lastBoundBO.set({lastLightCount:s},!0),y=!0),(!e.currentRenderPass&&e.lastRenderPassShaderReplacement||e.currentRenderPass&&e.currentRenderPass.getShaderReplacement()!==e.lastRenderPassShaderReplacement)&&(y=!0),e.lastHaveSeenDepthRequest!==e.haveSeenDepthRequest||r.getShaderSourceTime().getMTime()<e.renderable.getMTime()||r.getShaderSourceTime().getMTime()<e.currentInput.getMTime()||r.getShaderSourceTime().getMTime()<e.selectionStateChanged.getMTime()||y?(e.lastHaveSeenDepthRequest=e.haveSeenDepthRequest,!0):!1},t.invokeShaderCallbacks=(r,i,a)=>{const o=e.renderable.getViewSpecificProperties().ShadersCallbacks;o&&o.forEach(s=>{s.callback(s.userData,r,i,a)})},t.setMapperShaderParameters=(r,i,a)=>{if(r.getProgram().isUniformUsed("PrimitiveIDOffset")&&r.getProgram().setUniformi("PrimitiveIDOffset",e.primitiveIDOffset),r.getProgram().isUniformUsed("VertexIDOffset")&&r.getProgram().setUniformi("VertexIDOffset",e.vertexIDOffset),r.getCABO().getElementCount()&&(e.VBOBuildTime.getMTime()>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())){const c=e.lastBoundBO.getReferenceByName("lastLightComplexity");r.getProgram().isAttributeUsed("vertexMC")&&(r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"vertexMC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),e.context.FLOAT,3,!1)||Kp("Error setting vertexMC in shader VAO.")),r.getProgram().isAttributeUsed("normalMC")&&r.getCABO().getNormalOffset()&&c>0?r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"normalMC",r.getCABO().getNormalOffset(),r.getCABO().getStride(),e.context.FLOAT,3,!1)||Kp("Error setting normalMC in shader VAO."):r.getVAO().removeAttributeArray("normalMC"),e.renderable.getCustomShaderAttributes().forEach((l,u)=>{r.getProgram().isAttributeUsed(`${l}MC`)&&(r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),`${l}MC`,r.getCABO().getCustomData()[u].offset,r.getCABO().getStride(),e.context.FLOAT,r.getCABO().getCustomData()[u].components,!1)||Kp(`Error setting ${l}MC in shader VAO.`))}),r.getProgram().isAttributeUsed("tcoordMC")&&r.getCABO().getTCoordOffset()?r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"tcoordMC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),e.context.FLOAT,r.getCABO().getTCoordComponents(),!1)||Kp("Error setting tcoordMC in shader VAO."):r.getVAO().removeAttributeArray("tcoordMC"),r.getProgram().isAttributeUsed("scalarColor")&&r.getCABO().getColorComponents()?r.getVAO().addAttributeArray(r.getProgram(),r.getCABO().getColorBO(),"scalarColor",r.getCABO().getColorOffset(),r.getCABO().getColorBOStride(),e.context.UNSIGNED_BYTE,4,!0)||Kp("Error setting scalarColor in shader VAO."):r.getVAO().removeAttributeArray("scalarColor"),r.getAttributeUpdateTime().modified()}if(e.renderable.getNumberOfClippingPlanes()){const c=e.renderable.getNumberOfClippingPlanes(),l=[],f=r.getCABO().getCoordShiftAndScaleEnabled()?r.getCABO().getInverseShiftAndScaleMatrix():null,d=f?pa(e.tmpMat4,a.getMatrix()):a.getMatrix();f&&(cr(d,d),Xn(d,d,f),cr(d,d));for(let h=0;h<c;h++){const m=[];e.renderable.getClippingPlaneInDataCoords(d,h,m);for(let p=0;p<4;p++)l.push(m[p])}r.getProgram().setUniformi("numClipPlanes",c),r.getProgram().setUniform4fv("clipPlanes",l)}e.internalColorTexture&&r.getProgram().isUniformUsed("texture1")&&r.getProgram().setUniformi("texture1",e.internalColorTexture.getTextureUnit());const o=e.openGLActor.getActiveTextures();if(o)for(let c=0;c<o.length;++c){const u=o[c].getTextureUnit(),f=`texture${u+1}`;r.getProgram().isUniformUsed(f)&&r.getProgram().setUniformi(f,u)}if(e.haveSeenDepthRequest&&r.getProgram().setUniformi("depthRequest",e.renderDepth?1:0),r.getProgram().isUniformUsed("coffset")){const c=t.getCoincidentParameters(i,a);r.getProgram().setUniformf("coffset",c.offset),r.getProgram().isUniformUsed("cfactor")&&r.getProgram().setUniformf("cfactor",c.factor)}r.setMapperShaderParameters(i,a,e._openGLRenderer.getTiledSizeAndOrigin());const s=e._openGLRenderer.getSelector();r.getProgram().setUniform3fArray("mapperIndex",s?s.getPropColorValue():[0,0,0]),r.getProgram().setUniformi("picking",s?s.getCurrentPass()+1:0)},t.setLightingShaderParameters=(r,i,a)=>{const o=e.lastBoundBO.getReferenceByName("lastLightComplexity");if(o<2)return;const s=r.getProgram();let c=0;const l=i.getLightsByReference();for(let d=0;d<l.length;++d){const h=l[d];if(h.getSwitch()>0){const p=h.getColorByReference(),y=h.getIntensity();e.lightColor[0]=p[0]*y,e.lightColor[1]=p[1]*y,e.lightColor[2]=p[2]*y;const x=h.getDirection(),S=i.getActiveCamera().getViewMatrix(),C=[...x];h.lightTypeIsSceneLight()&&(C[0]=S[0]*x[0]+S[1]*x[1]+S[2]*x[2],C[1]=S[4]*x[0]+S[5]*x[1]+S[6]*x[2],C[2]=S[8]*x[0]+S[9]*x[1]+S[10]*x[2],c1(C)),e.lightDirection[0]=C[0],e.lightDirection[1]=C[1],e.lightDirection[2]=C[2],c1(e.lightDirection),s.setUniform3fArray(`lightColor${c}`,e.lightColor),s.setUniform3fArray(`lightDirectionVC${c}`,e.lightDirection),c++}}if(o<3)return;const f=i.getActiveCamera().getViewMatrix();cr(f,f),c=0;for(let d=0;d<l.length;++d){const h=l[d];if(h.getSwitch()>0){const p=h.getTransformedPosition(),y=new Float64Array(3);gr(y,p,f),s.setUniform3fArray(`lightAttenuation${c}`,h.getAttenuationValuesByReference()),s.setUniformi(`lightPositional${c}`,h.getPositional()),s.setUniformf(`lightExponent${c}`,h.getExponent()),s.setUniformf(`lightConeAngle${c}`,h.getConeAngle()),s.setUniform3fArray(`lightPositionVC${c}`,[y[0],y[1],y[2]]),c++}}};function n(r,i,a){return i.identity(a),r.reduce((o,s,c)=>c===0?s?i.copy(o,s):i.identity(o):s?i.multiply(o,o,s):o,a)}t.setCameraShaderParameters=(r,i,a)=>{const o=r.getProgram(),s=e.openGLCamera.getKeyMatrices(i),c=i.getActiveCamera(),l=e.openGLCamera.getKeyMatrixTime().getMTime(),u=o.getLastCameraMTime(),d=r.getCABO().getCoordShiftAndScaleEnabled()?r.getCABO().getInverseShiftAndScaleMatrix():null,h=a.getIsIdentity(),m=h?{mcwc:null,normalMatrix:null}:e.openGLActor.getKeyMatrices();if(a.getCoordinateSystem()===J7t.DISPLAY){const p=e._openGLRenderer.getTiledSizeAndOrigin();sn(e.tmpMat4),e.tmpMat4[0]=2/p.usize,e.tmpMat4[12]=-1,e.tmpMat4[5]=2/p.vsize,e.tmpMat4[13]=-1,Xn(e.tmpMat4,e.tmpMat4,d),o.setUniformMatrix("MCPCMatrix",e.tmpMat4)}else o.setUniformMatrix("MCPCMatrix",n([s.wcpc,m.mcwc,d],BT,e.tmpMat4));o.isUniformUsed("MCVCMatrix")&&o.setUniformMatrix("MCVCMatrix",n([s.wcvc,m.mcwc,d],BT,e.tmpMat4)),o.isUniformUsed("normalMatrix")&&o.setUniformMatrix3x3("normalMatrix",n([s.normalMatrix,m.normalMatrix],H4t,e.tmpMat3)),u!==l&&(o.isUniformUsed("cameraParallel")&&o.setUniformi("cameraParallel",c.getParallelProjection()),o.setLastCameraMTime(l)),h||o.setLastCameraMTime(0)},t.setPropertyShaderParameters=(r,i,a)=>{const o=r.getProgram();let s=a.getProperty(),c=s.getOpacity(),l=e.drawingEdges?s.getEdgeColorByReference():s.getAmbientColorByReference(),u=e.drawingEdges?s.getEdgeColorByReference():s.getDiffuseColorByReference(),f=e.drawingEdges?1:s.getAmbient(),d=e.drawingEdges?0:s.getDiffuse(),h=e.drawingEdges?0:s.getSpecular();const m=s.getSpecularPower();o.setUniformf("opacityUniform",c),o.setUniform3fArray("ambientColorUniform",l),o.setUniform3fArray("diffuseColorUniform",u),o.setUniformf("ambient",f),o.setUniformf("diffuse",d);const p=e.lastBoundBO.getReferenceByName("lastLightComplexity");if(p<1)return;let y=s.getSpecularColorByReference();if(o.setUniform3fArray("specularColorUniform",y),o.setUniformf("specularPowerUniform",m),o.setUniformf("specular",h),o.isUniformUsed("ambientIntensityBF")){if(s=a.getBackfaceProperty(),c=s.getOpacity(),l=s.getAmbientColor(),f=s.getAmbient(),u=s.getDiffuseColor(),d=s.getDiffuse(),y=s.getSpecularColor(),h=s.getSpecular(),o.setUniformf("ambientIntensityBF",f),o.setUniformf("diffuseIntensityBF",d),o.setUniformf("opacityUniformBF",c),o.setUniform3fArray("ambientColorUniformBF",l),o.setUniform3fArray("diffuseColorUniformBF",u),p<1)return;o.setUniformf("specularIntensityBF",h),o.setUniform3fArray("specularColorUniformBF",y),o.setUniformf("specularPowerUniformBF",m)}},t.updateMaximumPointCellIds=(r,i)=>{const a=e._openGLRenderer.getSelector();if(!a)return;if(e.selectionWebGLIdsToVTKIds?.points?.length){const s=e.selectionWebGLIdsToVTKIds.points.length;a.setMaximumPointId(s-1)}if(e.selectionWebGLIdsToVTKIds?.cells?.length){const s=e.selectionWebGLIdsToVTKIds.cells.length;a.setMaximumCellId(s-1)}a.getFieldAssociation()===FR.FIELD_ASSOCIATION_POINTS&&(e.pointPicking=!0)},t.renderPieceStart=(r,i)=>{e.primitiveIDOffset=0,e.vertexIDOffset=0;const a=eOt(e._openGLRenderer);e.lastSelectionState!==a&&(e.selectionStateChanged.modified(),e.lastSelectionState=a),e._openGLRenderer.getSelector()&&e._openGLRenderer.getSelector().renderProp(i),t.updateBufferObjects(r,i),e.renderable.getColorTextureMap()&&e.internalColorTexture.activate(),e.lastBoundBO=null},t.renderPieceDraw=(r,i)=>{const a=i.getProperty().getRepresentation(),o=i.getProperty().getEdgeVisibility()&&a===wv.SURFACE,s=e._openGLRenderer.getSelector(),c=s&&s.getFieldAssociation()===FR.FIELD_ASSOCIATION_POINTS&&(e.lastSelectionState===qs.ID_LOW24||e.lastSelectionState===qs.ID_HIGH24);for(let l=co.Start;l<co.End;l++)e.primitives[l].setPointPicking(c),e.primitives[l].getCABO().getElementCount()&&(e.drawingEdges=o&&(l===co.TrisEdges||l===co.TriStripsEdges),(!e.drawingEdges||!(e.renderDepth||e.lastSelectionState>=0))&&(e.lastBoundBO=e.primitives[l],e.primitiveIDOffset+=e.primitives[l].drawArrays(r,i,a,t),e.vertexIDOffset+=e.primitives[l].getCABO().getElementCount()))},t.renderPieceFinish=(r,i)=>{e.LastBoundBO&&e.LastBoundBO.getVAO().release(),e.renderable.getColorTextureMap()&&e.internalColorTexture.deactivate()},t.renderPiece=(r,i)=>{if(t.invokeEvent(Z7t),e.renderable.getStatic()||e.renderable.update(),e.currentInput=e.renderable.getInputData(),t.invokeEvent(Q7t),!e.currentInput){Kp("No input!");return}if(!e.currentInput.getPoints||!e.currentInput.getPoints().getNumberOfValues())return;const a=e.context,o=i.getProperty().getBackfaceCulling(),s=i.getProperty().getFrontfaceCulling();!o&&!s?e._openGLRenderWindow.disableCullFace():s?(e._openGLRenderWindow.enableCullFace(),a.cullFace(a.FRONT)):(e._openGLRenderWindow.enableCullFace(),a.cullFace(a.BACK)),t.renderPieceStart(r,i),t.renderPieceDraw(r,i),t.renderPieceFinish(r,i)},t.computeBounds=(r,i)=>{if(!t.getInput()){P2(e.bounds);return}e.bounds=t.getInput().getBounds()},t.updateBufferObjects=(r,i)=>{t.getNeedToRebuildBufferObjects(r,i)&&t.buildBufferObjects(r,i),t.updateMaximumPointCellIds()},t.getNeedToRebuildBufferObjects=(r,i)=>{const a=e.VBOBuildTime.getMTime();return a<t.getMTime()||a<e.renderable.getMTime()||a<i.getMTime()||a<e.currentInput.getMTime()},t.buildBufferObjects=(r,i)=>{const a=e.currentInput;if(a===null)return;e.renderable.mapScalars(a,1);const o=e.renderable.getColorMapColors();e.haveCellScalars=!1;const s=e.renderable.getScalarMode();e.renderable.getScalarVisibility()&&(s===RS.USE_CELL_DATA||s===RS.USE_CELL_FIELD_DATA||s===RS.USE_FIELD_DATA||!a.getPointData().getScalars())&&s!==RS.USE_POINT_FIELD_DATA&&o&&(e.haveCellScalars=!0);let c=i.getProperty().getInterpolation()!==pte.FLAT?a.getPointData().getNormals():null;c===null&&a.getCellData().getNormals()&&(e.haveCellNormals=!0,c=a.getCellData().getNormals());const l=i.getProperty().getRepresentation();let u=a.getPointData().getTCoords();e.openGLActor.getActiveTextures()||(u=null);let f=!1;if(e.renderable.getColorCoordinates()){u=e.renderable.getColorCoordinates(),f=e.renderable.getAreScalarsMappedFromCells(),e.internalColorTexture||(e.internalColorTexture=mi.newInstance({resizable:!0}));const h=e.internalColorTexture;h.setMinificationFilter(mte.NEAREST),h.setMagnificationFilter(mte.NEAREST),h.setWrapS(vte.CLAMP_TO_EDGE),h.setWrapT(vte.CLAMP_TO_EDGE),h.setOpenGLRenderWindow(e._openGLRenderWindow);const m=e.renderable.getColorTextureMap(),p=m.getExtent(),y=m.getPointData().getScalars();h.create2DFromRaw(p[1]-p[0]+1,p[3]-p[2]+1,y.getNumberOfComponents(),y.getDataType(),y.getData()),h.activate(),h.sendParameters(),h.deactivate()}const d=`${a.getMTime()}A${l}B${a.getMTime()}C${c?c.getMTime():1}D${o?o.getMTime():1}E${i.getProperty().getEdgeVisibility()}F${u?u.getMTime():1}`;if(e.VBOBuildString!==d){const m={points:a.getPoints(),normals:c,tcoords:u,colors:o,cellOffset:0,vertexOffset:0,useTCoordsPerCell:f,haveCellScalars:e.haveCellScalars,haveCellNormals:e.haveCellNormals,customAttributes:e.renderable.getCustomShaderAttributes().map(x=>a.getPointData().getArrayByName(x))};e.renderable.getPopulateSelectionSettings()&&(e.selectionWebGLIdsToVTKIds={points:null,cells:null});const p=[{inRep:"verts",cells:a.getVerts()},{inRep:"lines",cells:a.getLines()},{inRep:"polys",cells:a.getPolys()},{inRep:"strips",cells:a.getStrips()},{inRep:"polys",cells:a.getPolys()},{inRep:"strips",cells:a.getStrips()}],y=i.getProperty().getEdgeVisibility()&&l===wv.SURFACE;for(let x=co.Start;x<co.End;x++)x!==co.TrisEdges&&x!==co.TriStripsEdges?(m.cellOffset+=e.primitives[x].getCABO().createVBO(p[x].cells,p[x].inRep,l,m,e.selectionWebGLIdsToVTKIds),m.vertexOffset+=e.primitives[x].getCABO().getElementCount()):y?e.primitives[x].getCABO().createVBO(p[x].cells,p[x].inRep,wv.WIREFRAME,{...m,tcoords:null,colors:null,haveCellScalars:!1,haveCellNormals:!1}):e.primitives[x].releaseGraphicsResources();e.renderable.getPopulateSelectionSettings()&&e.renderable.setSelectionWebGLIdsToVTKIds(e.selectionWebGLIdsToVTKIds),e.VBOBuildString=d}e.VBOBuildTime.modified()},t.getAllocatedGPUMemoryInBytes=()=>{let r=0;return e.primitives.forEach(i=>{r+=i.getAllocatedGPUMemoryInBytes()}),r}}const nOt={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null,tmpMat4:null,ambientColor:[],diffuseColor:[],specularColor:[],lightColor:[],lightDirection:[],lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastSelectionState:qs.MIN_KNOWN_PASS-1,selectionStateChanged:null,selectionWebGLIdsToVTKIds:null,pointPicking:!1};function gbe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,nOt,n),La.extend(t,e,n),sp.implementReplaceShaderCoincidentOffset(t,e,n),sp.implementBuildShadersWithReplacements(t,e,n),e.primitives=[],e.primTypes=co,e.tmpMat3=vf(new Float64Array(9)),e.tmpMat4=sn(new Float64Array(16));for(let r=co.Start;r<co.End;r++)e.primitives[r]=Ph.newInstance(),e.primitives[r].setPrimitiveType(r),e.primitives[r].set({lastLightComplexity:0,lastLightCount:0,lastSelectionPass:!1},!0);Ja(t,e,["context"]),e.VBOBuildTime={},yi(e.VBOBuildTime,{mtime:0}),e.selectionStateChanged={},yi(e.selectionStateChanged,{mtime:0}),tOt(t,e)}const pbe=ri(gbe,"vtkOpenGLPolyDataMapper");var QE={newInstance:pbe,extend:gbe};jo("vtkMapper",pbe);const{vtkErrorMacro:n5}=Rs,{Representation:rOt}=w3,{ObjectType:IS}=H0,{PassTypes:iOt}=bF,aOt={type:"StartEvent"},oOt={type:"EndEvent"};function sOt(t,e){e.classHierarchy.push("vtkOpenGLGlyph3DMapper");const n={...t};t.renderPiece=(r,i)=>{if(t.invokeEvent(aOt),e.renderable.getStatic()||e.renderable.update(),e.currentInput=e.renderable.getInputData(1),t.invokeEvent(oOt),!e.currentInput){n5("No input!");return}if(!e.currentInput.getPoints||!e.currentInput.getPoints().getNumberOfValues())return;const a=e.context;e._openGLRenderWindow.getWebgl2()?(e.hardwareSupport=!0,e.extension=null):e.extension||(e.extension=e.context.getExtension("ANGLE_instanced_arrays"),e.hardwareSupport=!!e.extension);const o=i.getProperty().getBackfaceCulling(),s=i.getProperty().getFrontfaceCulling();!o&&!s?e._openGLRenderWindow.disableCullFace():s?(e._openGLRenderWindow.enableCullFace(),a.cullFace(a.FRONT)):(e._openGLRenderWindow.enableCullFace(),a.cullFace(a.BACK)),t.renderPieceStart(r,i),t.renderPieceDraw(r,i),t.renderPieceFinish(r,i)},t.multiply4x4WithOffset=(r,i,a,o)=>{const s=i[0],c=i[1],l=i[2],u=i[3],f=i[4],d=i[5],h=i[6],m=i[7],p=i[8],y=i[9],x=i[10],S=i[11],C=i[12],_=i[13],T=i[14],O=i[15];let M=a[o],I=a[o+1],V=a[o+2],k=a[o+3];r[0]=M*s+I*f+V*p+k*C,r[1]=M*c+I*d+V*y+k*_,r[2]=M*l+I*h+V*x+k*T,r[3]=M*u+I*m+V*S+k*O,M=a[o+4],I=a[o+5],V=a[o+6],k=a[o+7],r[4]=M*s+I*f+V*p+k*C,r[5]=M*c+I*d+V*y+k*_,r[6]=M*l+I*h+V*x+k*T,r[7]=M*u+I*m+V*S+k*O,M=a[o+8],I=a[o+9],V=a[o+10],k=a[o+11],r[8]=M*s+I*f+V*p+k*C,r[9]=M*c+I*d+V*y+k*_,r[10]=M*l+I*h+V*x+k*T,r[11]=M*u+I*m+V*S+k*O,M=a[o+12],I=a[o+13],V=a[o+14],k=a[o+15],r[12]=M*s+I*f+V*p+k*C,r[13]=M*c+I*d+V*y+k*_,r[14]=M*l+I*h+V*x+k*T,r[15]=M*u+I*m+V*S+k*O},t.replaceShaderNormal=(r,i,a)=>{if(e.hardwareSupport&&e.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let s=r.Vertex;e.lastBoundBO.getCABO().getNormalOffset()&&(s=Ie.substitute(s,"//VTK::Normal::Dec",["attribute vec3 normalMC;","attribute mat3 gNormal;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,s=Ie.substitute(s,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * gNormal * normalMC;"]).result),r.Vertex=s}n.replaceShaderNormal(r,i,a)},t.replaceShaderColor=(r,i,a)=>{if(e.hardwareSupport&&e.renderable.getColorArray()){let o=r.Vertex,s=r.Geometry,c=r.Fragment;const l=e.lastBoundBO.getReferenceByName("lastLightComplexity");let u=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity"];l&&(u=u.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let f=["vec3 ambientColor;","  vec3 diffuseColor;","  float opacity;"];l&&(f=f.concat(["  vec3 specularColor;","  float specularPower;"])),f=f.concat(["  opacity = opacityUniform;"]),l&&(f=f.concat(["  specularColor = specularColorUniform;","  specularPower = specularPowerUniform;"])),e.drawingEdges||(u=u.concat(["varying vec4 vertexColorVSOutput;"]),o=Ie.substitute(o,"//VTK::Color::Dec",["attribute vec4 gColor;","varying vec4 vertexColorVSOutput;"]).result,o=Ie.substitute(o,"//VTK::Color::Impl",["vertexColorVSOutput = gColor;"]).result,s=Ie.substitute(s,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,s=Ie.substitute(s,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result,f=f.concat(["  diffuseColor = vertexColorVSOutput.rgb;","  ambientColor = vertexColorVSOutput.rgb;","  opacity = opacity*vertexColorVSOutput.a;"])),c=Ie.substitute(c,"//VTK::Color::Impl",f).result,c=Ie.substitute(c,"//VTK::Color::Dec",u).result,r.Vertex=o,r.Geometry=s,r.Fragment=c}n.replaceShaderColor(r,i,a)},t.replaceShaderPositionVC=(r,i,a)=>{if(e.hardwareSupport){let o=r.Vertex;e.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(o=Ie.substitute(o,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;","vertexVCVSOutput = MCVCMatrix * gVertexMC;","  gl_Position = MCPCMatrix * gVertexMC;"]).result,o=Ie.substitute(o,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result):(o=Ie.substitute(o,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;"]).result,o=Ie.substitute(o,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;","  gl_Position = MCPCMatrix * gVertexMC;"]).result),r.Vertex=o}n.replaceShaderPositionVC(r,i,a)},t.replaceShaderPicking=(r,i,a)=>{if(e.hardwareSupport){let o=r.Fragment,s=r.Vertex;s=Ie.substitute(s,"//VTK::Picking::Dec",["attribute vec3 mapperIndexVS;","varying vec3 mapperIndexVSOutput;"]).result,s=Ie.substitute(s,"//VTK::Picking::Impl","  mapperIndexVSOutput = mapperIndexVS;").result,r.Vertex=s,o=Ie.substitute(o,"//VTK::Picking::Dec",["varying vec3 mapperIndexVSOutput;","uniform vec3 mapperIndex;","uniform int picking;"]).result,o=Ie.substitute(o,"//VTK::Picking::Impl",["  vec4 pickColor = picking == 2 ? vec4(mapperIndexVSOutput,1.0) : vec4(mapperIndex,1.0);","  gl_FragData[0] = picking != 0 ? pickColor : gl_FragData[0];"]).result,r.Fragment=o}else n.replaceShaderPicking(r,i,a)},t.updateGlyphShaderParameters=(r,i,a,o,s,c,l,u)=>{const f=a.getProgram();if(r){const d=e.normalMatrix,h=c,m=l*9,p=e.tmpMat3,y=d[0],x=d[1],S=d[2],C=d[3],_=d[4],T=d[5],O=d[6],M=d[7],I=d[8],V=h[m],k=h[m+1],L=h[m+2],$=h[m+3],W=h[m+4],G=h[m+5],oe=h[m+6],U=h[m+7],Y=h[m+8];p[0]=V*y+k*C+L*O,p[1]=V*x+k*_+L*M,p[2]=V*S+k*T+L*I,p[3]=$*y+W*C+G*O,p[4]=$*x+W*_+G*M,p[5]=$*S+W*T+G*I,p[6]=oe*y+U*C+Y*O,p[7]=oe*x+U*_+Y*M,p[8]=oe*S+U*T+Y*I,f.setUniformMatrix3x3("normalMatrix",e.tmpMat3)}if(t.multiply4x4WithOffset(e.tmpMat4,e.mcpcMatrix,s,l*16),f.setUniformMatrix("MCPCMatrix",e.tmpMat4),i&&(t.multiply4x4WithOffset(e.tmpMat4,e.mcvcMatrix,s,l*16),f.setUniformMatrix("MCVCMatrix",e.tmpMat4)),o){const d=o.getData();e.tmpColor[0]=d[l*4]/255,e.tmpColor[1]=d[l*4+1]/255,e.tmpColor[2]=d[l*4+2]/255,f.setUniform3fArray("ambientColorUniform",e.tmpColor),f.setUniform3fArray("diffuseColorUniform",e.tmpColor)}u&&f.setUniform3fArray("mapperIndex",u.getPropColorValue())},t.renderPieceDraw=(r,i)=>{const a=i.getProperty().getRepresentation(),o=e.context,s=i.getProperty().getEdgeVisibility()&&a===rOt.SURFACE,c=e.openGLCamera.getKeyMatrices(r),l=e.openGLActor.getKeyMatrices();zy(e.normalMatrix,c.normalMatrix,l.normalMatrix),Xn(e.mcpcMatrix,c.wcpc,l.mcwc),Xn(e.mcvcMatrix,c.wcvc,l.mcwc);const u=e.renderable.getMatrixArray(),f=e.renderable.getNormalArray(),d=e.renderable.getColorArray(),h=u.length/16;let m=!1;e._openGLRenderer.getSelector()&&e._openGLRenderer.getSelector().getCurrentPass()===iOt.COMPOSITE_INDEX_PASS&&(m=!0);for(let p=e.primTypes.Start;p<e.primTypes.End;p++){const y=e.primitives[p].getCABO();if(y.getElementCount()){e.drawingEdges=s&&(p===e.primTypes.TrisEdges||p===e.primTypes.TriStripsEdges),e.lastBoundBO=e.primitives[p],e.primitives[p].updateShaders(r,i,t);const x=e.primitives[p].getProgram(),S=e.primitives[p].getOpenGLMode(a),C=x.isUniformUsed("normalMatrix"),_=x.isUniformUsed("MCVCMatrix");if(e.hardwareSupport)e.extension?e.extension.drawArraysInstancedANGLE(S,0,y.getElementCount(),h):o.drawArraysInstanced(S,0,y.getElementCount(),h);else for(let T=0;T<h;++T)m&&e._openGLRenderer.getSelector().renderCompositeIndex(T),t.updateGlyphShaderParameters(C,_,e.primitives[p],d,u,f,T,m?e._openGLRenderer.getSelector():null),o.drawArrays(S,0,y.getElementCount())}}},t.setMapperShaderParameters=(r,i,a)=>{if(r.getCABO().getElementCount()&&(e.glyphBOBuildTime.getMTime()>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())){r.getProgram().isAttributeUsed("gMatrix")?r.getVAO().addAttributeMatrixWithDivisor(r.getProgram(),e.matrixBuffer,"gMatrix",0,64,e.context.FLOAT,4,!1,1)||n5("Error setting gMatrix in shader VAO."):r.getVAO().removeAttributeArray("gMatrix"),r.getProgram().isAttributeUsed("gNormal")?r.getVAO().addAttributeMatrixWithDivisor(r.getProgram(),e.normalBuffer,"gNormal",0,36,e.context.FLOAT,3,!1,1)||n5("Error setting gNormal in shader VAO."):r.getVAO().removeAttributeArray("gNormal"),r.getProgram().isAttributeUsed("gColor")?r.getVAO().addAttributeArrayWithDivisor(r.getProgram(),e.colorBuffer,"gColor",0,4,e.context.UNSIGNED_BYTE,4,!0,1,!1)||n5("Error setting gColor in shader VAO."):r.getVAO().removeAttributeArray("gColor"),r.getProgram().isAttributeUsed("mapperIndexVS")?r.getVAO().addAttributeArrayWithDivisor(r.getProgram(),e.pickBuffer,"mapperIndexVS",0,4,e.context.UNSIGNED_BYTE,4,!0,1,!1)||n5("Error setting mapperIndexVS in shader VAO."):r.getVAO().removeAttributeArray("mapperIndexVS"),n.setMapperShaderParameters(r,i,a),r.getAttributeUpdateTime().modified();return}n.setMapperShaderParameters(r,i,a)},t.getNeedToRebuildBufferObjects=(r,i)=>(e.renderable.buildArrays(),e.VBOBuildTime.getMTime()<e.renderable.getBuildTime().getMTime()?!0:n.getNeedToRebuildBufferObjects(r,i)),t.getNeedToRebuildShaders=(r,i,a)=>!!(n.getNeedToRebuildShaders(r,i,a)||r.getShaderSourceTime().getMTime()<e.renderable.getMTime()||r.getShaderSourceTime().getMTime()<e.currentInput.getMTime()),t.buildBufferObjects=(r,i)=>{if(e.hardwareSupport){const a=e.renderable.getMatrixArray(),o=e.renderable.getNormalArray(),s=e.renderable.getColorArray();if(e.matrixBuffer||(e.matrixBuffer=H0.newInstance(),e.matrixBuffer.setOpenGLRenderWindow(e._openGLRenderWindow),e.normalBuffer=H0.newInstance(),e.normalBuffer.setOpenGLRenderWindow(e._openGLRenderWindow),e.colorBuffer=H0.newInstance(),e.colorBuffer.setOpenGLRenderWindow(e._openGLRenderWindow),e.pickBuffer=H0.newInstance(),e.pickBuffer.setOpenGLRenderWindow(e._openGLRenderWindow)),e.renderable.getBuildTime().getMTime()>e.glyphBOBuildTime.getMTime()){e.matrixBuffer.upload(a,IS.ARRAY_BUFFER),e.normalBuffer.upload(o,IS.ARRAY_BUFFER),s?e.colorBuffer.upload(s.getData(),IS.ARRAY_BUFFER):e.colorBuffer.releaseGraphicsResources();const c=a.length/16,l=new Uint8Array(4*c);for(let u=0;u<c;++u){let f=u+1;const d=u*4;l[d]=f%256,f-=l[d],f/=256,l[d+1]=f%256,f-=l[d+1],f/=256,l[d+2]=f%256,l[d+3]=255}e.pickBuffer.upload(l,IS.ARRAY_BUFFER),e.glyphBOBuildTime.modified()}}return n.buildBufferObjects(r,i)}}const cOt={normalMatrix:null,mcpcMatrix:null,mcwcMatrix:null};function lOt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,cOt,n),QE.extend(t,e,n),e.tmpMat3=vf(new Float64Array(9)),e.normalMatrix=vf(new Float64Array(9)),e.mcpcMatrix=sn(new Float64Array(16)),e.mcvcMatrix=sn(new Float64Array(16)),e.tmpColor=[],e.glyphBOBuildTime={},yi(e.glyphBOBuildTime,{mtime:0}),sOt(t,e)}const mbe=ri(lOt,"vtkOpenGLGlyph3DMapper");var uOt={newInstance:mbe};jo("vtkGlyph3DMapper",mbe);const{vtkErrorMacro:yte}=Rs;function fOt(t,e){e.classHierarchy.push("vtkOpenGLSkybox"),t.buildPass=n=>{if(n){e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer"),e._openGLRenderWindow=e._openGLRenderer.getParent(),e.context=e._openGLRenderWindow.getContext(),e.tris.setOpenGLRenderWindow(e._openGLRenderWindow),e.openGLTexture.setOpenGLRenderWindow(e._openGLRenderWindow);const r=e._openGLRenderer.getRenderable();e.openGLCamera=e._openGLRenderer.getViewNodeFor(r.getActiveCamera())}},t.queryPass=(n,r)=>{if(n){if(!e.renderable||!e.renderable.getVisibility())return;r.incrementOpaqueActorCount()}},t.opaquePass=(n,r)=>{if(n&&!e._openGLRenderer.getSelector()){t.updateBufferObjects(),e.context.depthMask(!0),e._openGLRenderWindow.getShaderCache().readyShaderProgram(e.tris.getProgram()),e.openGLTexture.render(e._openGLRenderWindow);const i=e.openGLTexture.getTextureUnit();e.tris.getProgram().setUniformi("sbtexture",i);const a=e._openGLRenderer.getRenderable(),o=e.openGLCamera.getKeyMatrices(a),s=new Float64Array(16);if(Na(s,o.wcpc),e.tris.getProgram().setUniformMatrix("IMCPCMatrix",s),e.lastFormat==="box"){const c=a.getActiveCamera().getPosition();e.tris.getProgram().setUniform3f("camPos",c[0],c[1],c[2])}e.tris.getVAO().bind(),e.context.drawArrays(e.context.TRIANGLES,0,e.tris.getCABO().getElementCount()),e.tris.getVAO().release(),e.openGLTexture.deactivate()}},t.updateBufferObjects=()=>{if(!e.tris.getCABO().getElementCount()){const r=new Float32Array(12);for(let s=0;s<4;s++)r[s*3]=s%2*2-1,r[s*3+1]=s>1?1:-1,r[s*3+2]=1;const i=On.newInstance({numberOfComponents:3,values:r});i.setName("points");const a=new Uint16Array(8);a[0]=3,a[1]=0,a[2]=1,a[3]=3,a[4]=3,a[5]=0,a[6]=3,a[7]=2;const o=On.newInstance({numberOfComponents:1,values:a});e.tris.getCABO().createVBO(o,"polys",_l.SURFACE,{points:i,cellOffset:0})}e.renderable.getFormat()!==e.lastFormat&&(e.lastFormat=e.renderable.getFormat(),e.lastFormat==="box"&&e.tris.setProgram(e._openGLRenderWindow.getShaderCache().readyShaderProgramArray(`//VTK::System::Dec
             attribute vec3 vertexMC;
             uniform mat4 IMCPCMatrix;
             varying vec3 TexCoords;
             void main () {
              gl_Position = vec4(vertexMC.xyz, 1.0);
              vec4 wpos = IMCPCMatrix * gl_Position;
              TexCoords = wpos.xyz/wpos.w;
             }`,`//VTK::System::Dec
             //VTK::Output::Dec
             varying vec3 TexCoords;
             uniform samplerCube sbtexture;
             uniform vec3 camPos;
             void main () {
               // skybox looks from inside out
               // which means we have to adjust
               // our tcoords. Otherwise text would
               // be flipped
               vec3 tc = normalize(TexCoords - camPos);
               if (abs(tc.z) < max(abs(tc.x),abs(tc.y)))
               {
                 tc = vec3(1.0, 1.0, -1.0) * tc;
               }
               else
               {
                 tc = vec3(-1.0, 1.0, 1.0) * tc;
               }
               gl_FragData[0] = textureCube(sbtexture, tc);
             }`,"")),e.lastFormat==="background"&&e.tris.setProgram(e._openGLRenderWindow.getShaderCache().readyShaderProgramArray(`//VTK::System::Dec
             attribute vec3 vertexMC;
             uniform mat4 IMCPCMatrix;
             varying vec2 TexCoords;
             void main () {
              gl_Position = vec4(vertexMC.xyz, 1.0);
              vec4 wpos = IMCPCMatrix * gl_Position;
              TexCoords = vec2(vertexMC.x, vertexMC.y)*0.5 + 0.5;
             }`,`//VTK::System::Dec
             //VTK::Output::Dec
             varying vec2 TexCoords;
             uniform sampler2D sbtexture;
             void main () {
               gl_FragData[0] = texture2D(sbtexture, TexCoords);
             }`,"")),e.tris.getShaderSourceTime().modified(),e.tris.getVAO().bind(),e.tris.getVAO().addAttributeArray(e.tris.getProgram(),e.tris.getCABO(),"vertexMC",e.tris.getCABO().getVertexOffset(),e.tris.getCABO().getStride(),e.context.FLOAT,3,e.context.FALSE)||yte("Error setting vertexMC in shader VAO."));const n=e.renderable.getTextures();n.length||yte("vtkSkybox requires a texture map"),e.openGLTexture.getRenderable()!==n[0]&&(e.openGLTexture.releaseGraphicsResources(e._openGLRenderWindow),e.openGLTexture.setRenderable(n[0]))}}const dOt={context:null};function hOt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,dOt,n),La.extend(t,e,n),e.openGLTexture=mi.newInstance(),e.tris=Ph.newInstance(),e.keyMatrixTime={},yi(e.keyMatrixTime,{mtime:0}),e.keyMatrices={normalMatrix:vf(new Float64Array(9)),mcwc:sn(new Float64Array(16))},Ja(t,e,["context"]),sc(t,e,["activeTextures"]),fOt(t,e)}const vbe=ri(hOt);var gOt={newInstance:vbe};jo("vtkSkybox",vbe);var pOt=`//VTK::System::Dec

/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkSphereMapperVS.glsl

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// this shader implements imposters in OpenGL for Spheres

attribute vec4 vertexMC;
attribute vec2 offsetMC;

// optional normal declaration
//VTK::Normal::Dec

//VTK::Picking::Dec

// Texture coordinates
//VTK::TCoord::Dec

uniform mat3 normalMatrix; // transform model coordinate directions to view coordinates

// material property values
//VTK::Color::Dec

// clipping plane vars
//VTK::Clip::Dec

// camera and actor matrix values
//VTK::Camera::Dec

varying vec4 vertexVCVSOutput;
varying float radiusVCVSOutput;
varying vec3 centerVCVSOutput;

uniform int cameraParallel;
uniform float scaleFactor;

void main()
{
  //VTK::Picking::Impl

  //VTK::Color::Impl

  //VTK::Normal::Impl

  //VTK::TCoord::Impl

  //VTK::Clip::Impl

  // compute the projected vertex position
  vec2 scaledOffsetMC = scaleFactor * offsetMC;
  vertexVCVSOutput = MCVCMatrix * vertexMC;
  centerVCVSOutput = vertexVCVSOutput.xyz;
  radiusVCVSOutput = length(scaledOffsetMC)*0.5;

  // make the triangle face the camera
  if (cameraParallel == 0)
    {
    vec3 dir = normalize(-vertexVCVSOutput.xyz);
    vec3 base2 = normalize(cross(dir,vec3(1.0,0.0,0.0)));
    vec3 base1 = cross(base2,dir);
    vertexVCVSOutput.xyz = vertexVCVSOutput.xyz + scaledOffsetMC.x*base1 + scaledOffsetMC.y*base2;
    }
  else
    {
    // add in the offset
    vertexVCVSOutput.xy = vertexVCVSOutput.xy + scaledOffsetMC;
    }

  gl_Position = VCPCMatrix * vertexVCVSOutput;
}
`;const{vtkErrorMacro:mOt}=Rs;function vOt(t,e){e.classHierarchy.push("vtkOpenGLSphereMapper");const n={...t};t.getShaderTemplate=(r,i,a)=>{r.Vertex=pOt,r.Fragment=v3,r.Geometry=""},t.replaceShaderValues=(r,i,a)=>{let o=r.Vertex,s=r.Fragment;o=Ie.substitute(o,"//VTK::Camera::Dec",[`uniform mat4 VCPCMatrix;
`,"uniform mat4 MCVCMatrix;"]).result,s=Ie.substitute(s,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,s=Ie.substitute(s,"//VTK::PositionVC::Impl",[`vec4 vertexVC = vertexVCVSOutput;
`]).result;const c=[`uniform float invertedDepth;
`,`uniform int cameraParallel;
`,`varying float radiusVCVSOutput;
`,`varying vec3 centerVCVSOutput;
`,`uniform mat4 VCPCMatrix;
`];s=Ie.substitute(s,"//VTK::Normal::Dec",c).result;let l="";e.context.getExtension("EXT_frag_depth")&&(l=`gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;
`),e._openGLRenderWindow.getWebgl2()&&(l=`gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;
`),s=Ie.substitute(s,"//VTK::Depth::Impl",[`  vec3 EyePos;
`,`  vec3 EyeDir;
`,`  if (cameraParallel != 0) {
`,`    EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);
`,`    EyeDir = vec3(0.0,0.0,-1.0); }
`,`  else {
`,`    EyeDir = vertexVC.xyz;
`,`    EyePos = vec3(0.0,0.0,0.0);
`,`    float lengthED = length(EyeDir);
`,`    EyeDir = normalize(EyeDir);
`,`    if (lengthED > radiusVCVSOutput*3.0) {
`,`      EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }
`,`    }
`,`  EyePos = EyePos - centerVCVSOutput;
`,`  EyePos = EyePos/radiusVCVSOutput;
`,`  float b = 2.0*dot(EyePos,EyeDir);
`,`  float c = dot(EyePos,EyePos) - 1.0;
`,`  float d = b*b - 4.0*c;
`,`  vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);
`,`  if (d < 0.0) { discard; }
`,`  else {
`,`    float t = (-b - invertedDepth*sqrt(d))*0.5;
`,`    normalVCVSOutput = invertedDepth*normalize(EyePos + t*EyeDir);
`,`    vertexVC.xyz = normalVCVSOutput*radiusVCVSOutput + centerVCVSOutput;
`,`    }
`,`  vec4 pos = VCPCMatrix * vertexVC;
`,l]).result,s=Ie.substitute(s,"//VTK::Normal::Impl","").result,e.haveSeenDepthRequest&&(s=Ie.substitute(s,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),r.Vertex=o,r.Fragment=s,n.replaceShaderValues(r,i,a)},t.setMapperShaderParameters=(r,i,a)=>{if(r.getCABO().getElementCount()&&(e.VBOBuildTime>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())&&r.getProgram().isAttributeUsed("offsetMC")&&(r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"offsetMC",12,r.getCABO().getStride(),e.context.FLOAT,2,!1)||mOt("Error setting 'offsetMC' in shader VAO.")),r.getProgram().isUniformUsed("invertedDepth")&&r.getProgram().setUniformf("invertedDepth",e.invert?-1:1),r.getProgram().isUniformUsed("scaleFactor")){const s=e.currentInput.getPointData();e.renderable.getScaleArray()!=null&&s.hasArray(e.renderable.getScaleArray())?r.getProgram().setUniformf("scaleFactor",e.renderable.getScaleFactor()):r.getProgram().setUniformf("scaleFactor",1)}n.setMapperShaderParameters(r,i,a)},t.setCameraShaderParameters=(r,i,a)=>{const o=r.getProgram(),s=i.getActiveCamera(),c=e.openGLCamera.getKeyMatrices(i);if(o.isUniformUsed("VCPCMatrix")&&o.setUniformMatrix("VCPCMatrix",c.vcpc),o.isUniformUsed("MCVCMatrix"))if(a.getIsIdentity())o.setUniformMatrix("MCVCMatrix",c.wcvc);else{const l=e.openGLActor.getKeyMatrices(),u=new Float64Array(16);Xn(u,c.wcvc,l.mcwc),o.setUniformMatrix("MCVCMatrix",u)}o.isUniformUsed("cameraParallel")&&r.getProgram().setUniformi("cameraParallel",s.getParallelProjection())},t.getOpenGLMode=(r,i)=>e.context.TRIANGLES,t.buildBufferObjects=(r,i)=>{const a=e.currentInput;if(a===null)return;e.renderable.mapScalars(a,1);const o=e.renderable.getColorMapColors(),s=e.primitives[e.primTypes.Tris].getCABO(),c=a.getPointData(),l=a.getPoints(),u=l.getNumberOfPoints(),f=l.getData(),d=5;let h=null;e.renderable.getScaleArray()!=null&&c.hasArray(e.renderable.getScaleArray())&&(h=c.getArray(e.renderable.getScaleArray()).getData());let m=null,p=0,y=null;o?(p=o.getNumberOfComponents(),s.setColorOffset(0),s.setColorBOStride(4),m=o.getData(),y=new Uint8Array(3*u*4),s.getColorBO()||s.setColorBO(H0.newInstance()),s.getColorBO().setOpenGLRenderWindow(e._openGLRenderWindow)):s.getColorBO()&&s.setColorBO(null),s.setColorComponents(p);const x=new Float32Array(d*u*3);s.setStride(d*4);const S=Math.cos(Hi(30));let C=0,_=0,T=0,O=0;for(let M=0;M<u;++M){let I=e.renderable.getRadius();h&&(I=h[M]),C=M*3,x[T++]=f[C++],x[T++]=f[C++],x[T++]=f[C++],x[T++]=-2*I*S,x[T++]=-I,m&&(_=M*p,y[O++]=m[_],y[O++]=m[_+1],y[O++]=m[_+2],y[O++]=m[_+3]),C=M*3,x[T++]=f[C++],x[T++]=f[C++],x[T++]=f[C++],x[T++]=2*I*S,x[T++]=-I,m&&(y[O++]=m[_],y[O++]=m[_+1],y[O++]=m[_+2],y[O++]=m[_+3]),C=M*3,x[T++]=f[C++],x[T++]=f[C++],x[T++]=f[C++],x[T++]=0,x[T++]=2*I,m&&(y[O++]=m[_],y[O++]=m[_+1],y[O++]=m[_+2],y[O++]=m[_+3])}s.setElementCount(T/d),s.upload(x,rh.ARRAY_BUFFER),o&&s.getColorBO().upload(y,rh.ARRAY_BUFFER),e.VBOBuildTime.modified()}}const yOt={};function xOt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,yOt,n),QE.extend(t,e,n),vOt(t,e)}const ybe=ri(xOt,"vtkOpenGLSphereMapper");var wOt={newInstance:ybe};jo("vtkSphereMapper",ybe);var bOt=`//VTK::System::Dec

/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkStickMapperVS.glsl

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// this shader implements imposters in OpenGL for Sticks

attribute vec4 vertexMC;
attribute vec3 orientMC;
attribute vec4 offsetMC;
attribute float radiusMC;

// optional normal declaration
//VTK::Normal::Dec

//VTK::Picking::Dec

// Texture coordinates
//VTK::TCoord::Dec

uniform mat3 normalMatrix; // transform model coordinate directions to view coordinates

// material property values
//VTK::Color::Dec

// clipping plane vars
//VTK::Clip::Dec

// camera and actor matrix values
//VTK::Camera::Dec

varying vec4 vertexVCVSOutput;
varying float radiusVCVSOutput;
varying float lengthVCVSOutput;
varying vec3 centerVCVSOutput;
varying vec3 orientVCVSOutput;

uniform int cameraParallel;

void main()
{
  //VTK::Picking::Impl

  //VTK::Color::Impl

  //VTK::Normal::Impl

  //VTK::TCoord::Impl

  //VTK::Clip::Impl

  vertexVCVSOutput = MCVCMatrix * vertexMC;
  centerVCVSOutput = vertexVCVSOutput.xyz;
  radiusVCVSOutput = radiusMC;
  lengthVCVSOutput = length(orientMC);
  orientVCVSOutput = normalMatrix * normalize(orientMC);

  // make sure it is pointing out of the screen
  if (orientVCVSOutput.z < 0.0)
    {
    orientVCVSOutput = -orientVCVSOutput;
    }

  // make the basis
  vec3 xbase;
  vec3 ybase;
  vec3 dir = vec3(0.0,0.0,1.0);
  if (cameraParallel == 0)
    {
    dir = normalize(-vertexVCVSOutput.xyz);
    }
  if (abs(dot(dir,orientVCVSOutput)) == 1.0)
    {
    xbase = normalize(cross(vec3(0.0,1.0,0.0),orientVCVSOutput));
    ybase = cross(xbase,orientVCVSOutput);
    }
  else
    {
    xbase = normalize(cross(orientVCVSOutput,dir));
    ybase = cross(orientVCVSOutput,xbase);
    }

  vec3 offsets = offsetMC.xyz*2.0-1.0;
  vertexVCVSOutput.xyz = vertexVCVSOutput.xyz +
    radiusVCVSOutput*offsets.x*xbase +
    radiusVCVSOutput*offsets.y*ybase +
    0.5*lengthVCVSOutput*offsets.z*orientVCVSOutput;

  gl_Position = VCPCMatrix * vertexVCVSOutput;
}
`;const{vtkErrorMacro:NS}=Rs;function SOt(t,e){e.classHierarchy.push("vtkOpenGLStickMapper");const n={...t};t.getShaderTemplate=(r,i,a)=>{r.Vertex=bOt,r.Fragment=v3,r.Geometry=""},t.replaceShaderValues=(r,i,a)=>{let o=r.Vertex,s=r.Fragment;o=Ie.substitute(o,"//VTK::Camera::Dec",[`uniform mat4 VCPCMatrix;
`,"uniform mat4 MCVCMatrix;"]).result,s=Ie.substitute(s,"//VTK::PositionVC::Dec","varying vec4 vertexVCVSOutput;").result,s=Ie.substitute(s,"//VTK::PositionVC::Impl",`  vec4 vertexVC = vertexVCVSOutput;
`).result;const c=[`uniform int cameraParallel;
`,`varying float radiusVCVSOutput;
`,`varying vec3 orientVCVSOutput;
`,`varying float lengthVCVSOutput;
`,`varying vec3 centerVCVSOutput;
`,`uniform mat4 VCPCMatrix;
`];s=Ie.substitute(s,"//VTK::Normal::Dec",c).result;let l="";e.context.getExtension("EXT_frag_depth")&&(l=`  gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;
`),e._openGLRenderWindow.getWebgl2()&&(l=`gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;
`),s=Ie.substitute(s,"//VTK::Depth::Impl",[`  vec3 EyePos;
`,`  vec3 EyeDir;
`,`  if (cameraParallel != 0) {
`,`    EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);
`,`    EyeDir = vec3(0.0,0.0,-1.0); }
`,`  else {
`,`    EyeDir = vertexVC.xyz;
`,`    EyePos = vec3(0.0,0.0,0.0);
`,`    float lengthED = length(EyeDir);
`,`    EyeDir = normalize(EyeDir);
`,`    if (lengthED > radiusVCVSOutput*3.0) {
`,`      EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }
`,`    }
`,`  EyePos = EyePos - centerVCVSOutput;
`,`  vec3 base1;
`,`  if (abs(orientVCVSOutput.z) < 0.99) {
`,`    base1 = normalize(cross(orientVCVSOutput,vec3(0.0,0.0,1.0))); }
`,`  else {
`,`    base1 = normalize(cross(orientVCVSOutput,vec3(0.0,1.0,0.0))); }
`,`  vec3 base2 = cross(orientVCVSOutput,base1);
`,`  EyePos = vec3(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,orientVCVSOutput));
`,`  EyeDir = vec3(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,orientVCVSOutput));
`,`  EyePos = EyePos/radiusVCVSOutput;
`,`  float a = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;
`,`  float b = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);
`,`  float c = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;
`,`  float d = b*b - 4.0*a*c;
`,`  vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);
`,`  if (d < 0.0) { discard; }
`,`  else {
`,`    float t =  (-b - sqrt(d))/(2.0*a);
`,`    float tz = EyePos.z + t*EyeDir.z;
`,`    vec3 iPoint = EyePos + t*EyeDir;
`,`    if (abs(iPoint.z)*radiusVCVSOutput > lengthVCVSOutput*0.5) {
`,`      float t2 = (-b + sqrt(d))/(2.0*a);
`,`      float tz2 = EyePos.z + t2*EyeDir.z;
`,`      if (tz2*radiusVCVSOutput > lengthVCVSOutput*0.5 || tz*radiusVCVSOutput < -0.5*lengthVCVSOutput) { discard; }
`,`      else {
`,`        normalVCVSOutput = orientVCVSOutput;
`,`        float t3 = (lengthVCVSOutput*0.5/radiusVCVSOutput - EyePos.z)/EyeDir.z;
`,`        iPoint = EyePos + t3*EyeDir;
`,`        vertexVC.xyz = radiusVCVSOutput*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*orientVCVSOutput) + centerVCVSOutput;
`,`        }
`,`      }
`,`    else {
`,`      normalVCVSOutput = iPoint.x*base1 + iPoint.y*base2;
`,`      vertexVC.xyz = radiusVCVSOutput*(normalVCVSOutput + iPoint.z*orientVCVSOutput) + centerVCVSOutput;
`,`      }
`,`    }
`,`  vec4 pos = VCPCMatrix * vertexVC;
`,l]).result,s=Ie.substitute(s,"//VTK::Normal::Impl","").result,e.haveSeenDepthRequest&&(s=Ie.substitute(s,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),r.Vertex=o,r.Fragment=s,n.replaceShaderValues(r,i,a)},t.setMapperShaderParameters=(r,i,a)=>{r.getCABO().getElementCount()&&(e.VBOBuildTime>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())&&(r.getProgram().isAttributeUsed("orientMC")&&(r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"orientMC",12,r.getCABO().getStride(),e.context.FLOAT,3,!1)||NS("Error setting 'orientMC' in shader VAO.")),r.getProgram().isAttributeUsed("offsetMC")&&(r.getVAO().addAttributeArray(r.getProgram(),r.getCABO().getColorBO(),"offsetMC",0,r.getCABO().getColorBOStride(),e.context.UNSIGNED_BYTE,3,!0)||NS("Error setting 'offsetMC' in shader VAO.")),r.getProgram().isAttributeUsed("radiusMC")&&(r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"radiusMC",24,r.getCABO().getStride(),e.context.FLOAT,1,!1)||NS("Error setting 'radiusMC' in shader VAO."))),n.setMapperShaderParameters(r,i,a)},t.setCameraShaderParameters=(r,i,a)=>{const o=r.getProgram(),s=i.getActiveCamera(),c=e.openGLCamera.getKeyMatrices(i);if(o.isUniformUsed("VCPCMatrix")&&o.setUniformMatrix("VCPCMatrix",c.vcpc),a.getIsIdentity())o.isUniformUsed("MCVCMatrix")&&o.setUniformMatrix("MCVCMatrix",c.wcvc),o.isUniformUsed("normalMatrix")&&o.setUniformMatrix3x3("normalMatrix",c.normalMatrix);else{const l=e.openGLActor.getKeyMatrices();if(o.isUniformUsed("MCVCMatrix")){const u=new Float64Array(16);Xn(u,c.wcvc,l.mcwc),o.setUniformMatrix("MCVCMatrix",u)}if(o.isUniformUsed("normalMatrix")){const u=new Float64Array(9);zy(u,c.normalMatrix,l.normalMatrix),o.setUniformMatrix3x3("normalMatrix",u)}}o.isUniformUsed("cameraParallel")&&r.getProgram().setUniformi("cameraParallel",s.getParallelProjection())},t.getOpenGLMode=(r,i)=>e.context.TRIANGLES,t.buildBufferObjects=(r,i)=>{const a=e.currentInput;if(a===null)return;e.renderable.mapScalars(a,1);const o=e.renderable.getColorMapColors(),s=e.primitives[e.primTypes.Tris].getCABO(),c=a.getPointData(),l=a.getPoints(),u=l.getNumberOfPoints(),f=l.getData();let d=3;d+=4;let h=null,m=0;s.setColorBOStride(4),s.getColorBO()||s.setColorBO(H0.newInstance()),s.getColorBO().setOpenGLRenderWindow(e._openGLRenderWindow),o&&(m=o.getNumberOfComponents(),s.setColorOffset(4),h=o.getData(),s.setColorBOStride(8)),s.setColorComponents(m),s.setStride(d*4);const p=new Float32Array(d*u*12),y=new Uint8Array(12*u*(h?8:4));let x=null,S=null;e.renderable.getScaleArray()!=null&&c.hasArray(e.renderable.getScaleArray())&&(x=c.getArray(e.renderable.getScaleArray()).getData()),e.renderable.getOrientationArray()!=null&&c.hasArray(e.renderable.getOrientationArray())?S=c.getArray(e.renderable.getOrientationArray()).getData():NS([`Error setting orientationArray.
`,"You have to specify the stick orientation"]);const C=[0,1,3,0,3,2,2,3,5,2,5,4];let _=0,T=0,O=0,M=0;for(let I=0;I<u;++I){let V=e.renderable.getLength(),k=e.renderable.getRadius();x&&(V=x[I*2],k=x[I*2+1]);for(let L=0;L<C.length;++L)_=I*3,p[O++]=f[_++],p[O++]=f[_++],p[O++]=f[_++],_=I*3,p[O++]=S[_++]*V,p[O++]=S[_++]*V,p[O++]=S[_++]*V,p[O++]=k,y[M++]=255*(C[L]%2),y[M++]=C[L]>=4?255:0,y[M++]=C[L]>=2?255:0,y[M++]=255,T=I*m,h&&(y[M++]=h[T],y[M++]=h[T+1],y[M++]=h[T+2],y[M++]=h[T+3])}s.setElementCount(O/d),s.upload(p,rh.ARRAY_BUFFER),s.getColorBO().upload(y,rh.ARRAY_BUFFER),e.VBOBuildTime.modified()}}const COt={};function _Ot(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,COt,n),QE.extend(t,e,n),SOt(t,e)}const xbe=ri(_Ot,"vtkOpenGLStickMapper");var TOt={newInstance:xbe};jo("vtkStickMapper",xbe);function _F(t,e){switch(t){case"Float32Array":return Float32Array;case"Uint8Array":return Uint8Array;case"Uint32Array":return Uint32Array;case"Uint16Array":case"Int16Array":return e?(console.debug(`${t} is not supported for volume rendering, switching back to Float32Array`),Float32Array):t==="Uint16Array"?Uint16Array:Int16Array;default:if(t)throw new Error("TargetBuffer should be Float32Array, Uint8Array, Uint16Array, Int16Array, or Uint32Array");return Float32Array}}function wbe(t,e,n={}){const{isVolumeBuffer:r=!1}=n,i=_F(t,r),a=i.BYTES_PER_ELEMENT;return{numBytes:e*a,TypedArrayConstructor:i}}function EOt(t,e){e.classHierarchy.push("vtkStreamingOpenGLVolumeMapper"),t.buildBufferObjects=(n,r)=>{const i=e.currentInput;if(!i)return;const a=r.getProperty();if(!e.jitterTexture.getHandle()){const p=new Uint8Array(1024);for(let y=0;y<1024;++y)p[y]=255*Math.random();e.jitterTexture.setMinificationFilter(Kt.LINEAR),e.jitterTexture.setMagnificationFilter(Kt.LINEAR),e.jitterTexture.create2DFromRaw(32,32,1,zn.UNSIGNED_CHAR,p)}const{numberOfComponents:o}=i.get("numberOfComponents"),s=t.useIndependentComponents(a),c=a.getScalarOpacity(),l=e._openGLRenderWindow.getGraphicsResourceForObject(c);let u=Od(c,s,o);if(!l?.oglObject||l.hash!==u){e.opacityTexture=mi.newInstance(),e.opacityTexture.setOpenGLRenderWindow(e._openGLRenderWindow);const p=1024,y=p*2*o,x=new Float32Array(y),S=new Float32Array(p);for(let C=0;C<o;++C){const _=a.getScalarOpacity(C),T=t.getCurrentSampleDistance(n)/a.getScalarOpacityUnitDistance(C),O=_.getRange();_.getTable(O[0],O[1],p,S,1);for(let M=0;M<p;++M)x[C*p*2+M]=1-(1-S[M])**T,x[C*p*2+M+p]=x[C*p*2+M]}if(e.opacityTexture.resetFormatAndType(),e.opacityTexture.setMinificationFilter(Kt.LINEAR),e.opacityTexture.setMagnificationFilter(Kt.LINEAR),e._openGLRenderWindow.getWebgl2()&&e.context.getExtension("OES_texture_float")&&e.context.getExtension("OES_texture_float_linear"))e.opacityTexture.create2DFromRaw(p,2*o,1,zn.FLOAT,x);else{const C=new Uint8ClampedArray(y);for(let _=0;_<y;++_)C[_]=255*x[_];e.opacityTexture.create2DFromRaw(p,2*o,1,zn.UNSIGNED_CHAR,C)}c&&(e._openGLRenderWindow.setGraphicsResourceForObject(c,e.opacityTexture,u),c!==e._scalarOpacityFunc&&(e._openGLRenderWindow.registerGraphicsResourceUser(c,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._scalarOpacityFunc,t)),e._scalarOpacityFunc=c)}else e.opacityTexture=l.oglObject;const d=a.getRGBTransferFunction();u=Od(d,s,o);const h=e._openGLRenderWindow.getGraphicsResourceForObject(d);if(!h?.oglObject?.getHandle()||h?.hash!==u){e.colorTexture=mi.newInstance(),e.colorTexture.setOpenGLRenderWindow(e._openGLRenderWindow);const p=1024,y=p*2*o*3,x=new Uint8ClampedArray(y),S=new Float32Array(p*3);for(let C=0;C<o;++C){const _=a.getRGBTransferFunction(C),T=_.getRange();_.getTable(T[0],T[1],p,S,1);for(let O=0;O<p*3;++O)x[C*p*6+O]=255*S[O],x[C*p*6+O+p*3]=255*S[O]}e.colorTexture.resetFormatAndType(),e.colorTexture.setMinificationFilter(Kt.LINEAR),e.colorTexture.setMagnificationFilter(Kt.LINEAR),e.colorTexture.create2DFromRaw(p,2*o,3,zn.UNSIGNED_CHAR,x),d&&(e._openGLRenderWindow.setGraphicsResourceForObject(d,e.colorTexture,u),d!==e._colorTransferFunc&&(e._openGLRenderWindow.registerGraphicsResourceUser(d,t),e._openGLRenderWindow.unregisterGraphicsResourceUser(e._colorTransferFunc,t)),e._colorTransferFunc=d)}else e.colorTexture=h.oglObject;if(t.updateLabelOutlineThicknessTexture(r),u=`${i.getMTime()}-${e.scalarTexture.getMTime()}`,e.scalarTextureString!==u){const p=i.getDimensions();e.scalarTexture.setOpenGLRenderWindow(e._openGLRenderWindow),e.scalarTexture.enableUseHalfFloat(!1);const y=e.scalarTexture.getTextureParameters(),x=i.get("dataType").dataType;let S=!0;if(y?.dataType===x&&y?.width===p[0]&&y?.height===p[1]&&y?.depth===p[2]&&(S=!1),S){const C=e.context.getExtension("EXT_texture_norm16");e.scalarTexture.setOglNorm16Ext(Ywt()?C:null),e.scalarTexture.resetFormatAndType(),e.scalarTexture.setTextureParameters({width:p[0],height:p[1],depth:p[2],numberOfComponents:o,dataType:x}),e.scalarTexture.create3DFromRaw(p[0],p[1],p[2],o,x,null),e.scalarTexture.update3DFromRaw()}else e.scalarTexture.deactivate(),e.scalarTexture.update3DFromRaw();e.scalarTextureString=u}if(!e.tris.getCABO().getElementCount()){const p=new Float32Array(12);for(let C=0;C<4;C++)p[C*3]=C%2*2-1,p[C*3+1]=C>1?1:-1,p[C*3+2]=-1;const y=new Uint16Array(8);y[0]=3,y[1]=0,y[2]=1,y[3]=3,y[4]=3,y[5]=0,y[6]=3,y[7]=2;const x=On.newInstance({numberOfComponents:3,values:p});x.setName("points");const S=On.newInstance({numberOfComponents:1,values:y});e.tris.getCABO().createVBO(S,"polys",_l.SURFACE,{points:x,cellOffset:0})}e.VBOBuildTime.modified()},t.getNeedToRebuildBufferObjects=(n,r)=>e.VBOBuildTime.getMTime()<t.getMTime()||e.VBOBuildTime.getMTime()<r.getMTime()||e.VBOBuildTime.getMTime()<e.renderable.getMTime()||e.VBOBuildTime.getMTime()<r.getProperty().getMTime()||e.VBOBuildTime.getMTime()<e.currentInput.getMTime()||e.VBOBuildTime.getMTime()<e.scalarTexture?.getMTime()||e.VBOBuildTime.getMTime()<e.colorTexture?.getMTime()||e.VBOBuildTime.getMTime()<e.labelOutlineThicknessTexture?.getMTime()||!e.scalarTexture?.getHandle()||!e.colorTexture?.getHandle()||!e.labelOutlineThicknessTexture?.getHandle()}const OOt={};function DOt(t,e,n={}){Object.assign(e,OOt,n),wwe.extend(t,e,n),e.scalarTexture=n.scalarTexture,e.previousState={},EOt(t,e)}const MOt=se.newInstance(DOt,"vtkStreamingOpenGLVolumeMapper"),ROt={newInstance:MOt},bbe=Object.create(null);function Oo(t,e){bbe[t]=e}function IOt(t,e){e.classHierarchy.push("vtkStreamingOpenGLViewNodeFactory"),t.createNode=n=>{if(n.isDeleted())return null;let r=0,i=n.getClassName(r++),a=!1;const o=Object.keys(e.overrides);for(;i&&!a;)o.includes(i)?a=!0:i=n.getClassName(r++);if(!a)return null;const s=e.getModelInitialValues(n),c=e.overrides[i](s);return c.setMyFactory(t),c},e.overrides=bbe,e.getModelInitialValues=n=>{const r={};return n.getClassName()==="vtkSharedVolumeMapper"&&(r.scalarTexture=n.getScalarTexture()),r}}const NOt={};function Sbe(t,e,n={}){Object.assign(e,NOt,n),pF.extend(t,e,n),IOt(t,e),Oo("vtkActor",E7t.newInstance),Oo("vtkActor2D",R7t.newInstance),Oo("vtkCamera",NCt.newInstance),Oo("vtkGlyph3DMapper",uOt.newInstance),Oo("vtkImageMapper",O6t.newInstance),Oo("vtkImageCPRMapper",N6t.newInstance),Oo("vtkImageSlice",L6t.newInstance),Oo("vtkMapper",QE.newInstance),Oo("vtkPixelSpaceCallbackMapper",e8t.newInstance),Oo("vtkRenderer",VCt.newInstance),Oo("vtkSkybox",gOt.newInstance),Oo("vtkSphereMapper",wOt.newInstance),Oo("vtkStickMapper",TOt.newInstance),Oo("vtkTexture",mi.newInstance),Oo("vtkVolume",U6t.newInstance),Oo("vtkVolumeMapper",wwe.newInstance),Oo("vtkSharedVolumeMapper",ROt.newInstance)}const POt=se.newInstance(Sbe,"vtkStreamingOpenGLViewNodeFactory"),kOt={newInstance:POt,extend:Sbe};function AOt(t,e){e.classHierarchy.push("vtkStreamingOpenGLRenderWindow")}function Cbe(t,e,n={}){Object.assign(e,n),S7t.extend(t,e,n),e.myFactory=kOt.newInstance(),Oo("vtkRenderWindow",_be),AOt(t,e)}const _be=se.newInstance(Cbe,"vtkStreamingOpenGLRenderWindow"),LOt={newInstance:_be,extend:Cbe},{vtkDebugMacro:PS}=se;function VOt(t,e){e.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),i=new Float64Array([0,1,0]),a=sn(new Float64Array(16)),o=sn(new Float64Array(16)),s=new Float64Array(3),c=new Float64Array(3),l=new Float64Array(3),u=sn(new Float64Array(16)),f=sn(new Float64Array(16)),d=new Float64Array(3),h=new Float64Array(3);function m(){e.viewPlaneNormal[0]=-e.directionOfProjection[0],e.viewPlaneNormal[1]=-e.directionOfProjection[1],e.viewPlaneNormal[2]=-e.directionOfProjection[2]}t.orthogonalizeViewUp=()=>{const p=t.getViewMatrix();e.viewUp[0]=p[4],e.viewUp[1]=p[5],e.viewUp[2]=p[6],t.modified()},t.setPosition=(p,y,x)=>{p===e.position[0]&&y===e.position[1]&&x===e.position[2]||(e.position[0]=p,e.position[1]=y,e.position[2]=x,t.computeDistance(),t.modified())},t.setFocalPoint=(p,y,x)=>{p===e.focalPoint[0]&&y===e.focalPoint[1]&&x===e.focalPoint[2]||(e.focalPoint[0]=p,e.focalPoint[1]=y,e.focalPoint[2]=x,t.computeDistance(),t.modified())},t.setDistance=p=>{if(e.distance===p)return;e.distance=p,e.distance<1e-20&&(e.distance=1e-20,PS("Distance is set to minimum."));const y=e.directionOfProjection;e.focalPoint[0]=e.position[0]+y[0]*e.distance,e.focalPoint[1]=e.position[1]+y[1]*e.distance,e.focalPoint[2]=e.position[2]+y[2]*e.distance,t.modified()},t.computeDistance=()=>{const p=e.focalPoint[0]-e.position[0],y=e.focalPoint[1]-e.position[1],x=e.focalPoint[2]-e.position[2];if(e.distance=Math.sqrt(p*p+y*y+x*x),e.distance<1e-20){e.distance=1e-20,PS("Distance is set to minimum.");const S=e.directionOfProjection;e.focalPoint[0]=e.position[0]+S[0]*e.distance,e.focalPoint[1]=e.position[1]+S[1]*e.distance,e.focalPoint[2]=e.position[2]+S[2]*e.distance}e.directionOfProjection[0]=p/e.distance,e.directionOfProjection[1]=y/e.distance,e.directionOfProjection[2]=x/e.distance,m()},t.dolly=p=>{if(p<=0)return;const y=e.distance/p;t.setPosition(e.focalPoint[0]-y*e.directionOfProjection[0],e.focalPoint[1]-y*e.directionOfProjection[1],e.focalPoint[2]-y*e.directionOfProjection[2])},t.roll=p=>{const y=e.position,x=e.focalPoint,S=e.viewUp,C=new Float64Array([S[0],S[1],S[2],0]);sn(u);const _=new Float64Array([x[0]-y[0],x[1]-y[1],x[2]-y[2]]);Hu(u,u,Hi(p),_),Tm(C,C,u),e.viewUp[0]=C[0],e.viewUp[1]=C[1],e.viewUp[2]=C[2],t.modified()},t.azimuth=p=>{const y=e.focalPoint;sn(f),Ma(f,f,y),Hu(f,f,Hi(p),e.viewUp),Ma(f,f,[-y[0],-y[1],-y[2]]),gr(d,e.position,f),t.setPosition(d[0],d[1],d[2])},t.yaw=p=>{const y=e.position;sn(f),Ma(f,f,y),Hu(f,f,Hi(p),e.viewUp),Ma(f,f,[-y[0],-y[1],-y[2]]),gr(h,e.focalPoint,f),t.setFocalPoint(h[0],h[1],h[2])},t.elevation=p=>{const y=e.focalPoint,x=t.getViewMatrix(),S=[-x[0],-x[1],-x[2]];sn(f),Ma(f,f,y),Hu(f,f,Hi(p),S),Ma(f,f,[-y[0],-y[1],-y[2]]),gr(d,e.position,f),t.setPosition(d[0],d[1],d[2])},t.pitch=p=>{const y=e.position,x=t.getViewMatrix(),S=[x[0],x[1],x[2]];sn(f),Ma(f,f,y),Hu(f,f,Hi(p),S),Ma(f,f,[-y[0],-y[1],-y[2]]),gr(h,e.focalPoint,f),t.setFocalPoint(...h)},t.zoom=p=>{p<=0||(e.parallelProjection?e.parallelScale/=p:e.viewAngle/=p,t.modified())},t.translate=(p,y,x)=>{const S=[p,y,x];LT(e.position,S,e.position),LT(e.focalPoint,S,e.focalPoint),t.computeDistance(),t.modified()},t.applyTransform=p=>{const y=[...e.viewUp,1],x=[],S=[],C=[];y[0]+=e.position[0],y[1]+=e.position[1],y[2]+=e.position[2],Tm(x,[...e.position,1],p),Tm(S,[...e.focalPoint,1],p),Tm(C,y,p),C[0]-=x[0],C[1]-=x[1],C[2]-=x[2],t.setPosition(...x.slice(0,3)),t.setFocalPoint(...S.slice(0,3)),t.setViewUp(...C.slice(0,3))},t.getThickness=()=>e.clippingRange[1]-e.clippingRange[0],t.setThickness=p=>{let y=p;y<1e-20&&(y=1e-20,PS("Thickness is set to minimum.")),t.setClippingRange(e.clippingRange[0],e.clippingRange[0]+y)},t.setThicknessFromFocalPoint=p=>{let y=p;y<1e-20&&(y=1e-20,PS("Thickness is set to minimum.")),t.setClippingRange(e.distance-y/2,e.distance+y/2)},t.setRoll=p=>{},t.getRoll=()=>{},t.setObliqueAngles=(p,y)=>{},t.getOrientation=()=>{},t.getOrientationWXYZ=()=>{},t.getFrustumPlanes=p=>{},t.getCameraLightTransformMatrix=p=>(pa(p,e.cameraLightTransform),p),t.computeCameraLightTransform=()=>{pa(a,t.getViewMatrix()),Na(a,a),KU(o,[e.distance,e.distance,e.distance]),Xn(a,a,o),sn(e.cameraLightTransform),Ma(e.cameraLightTransform,a,[0,0,-1])},t.deepCopy=p=>{},t.physicalOrientationToWorldDirection=p=>{const y=Ree(p[0],p[1],p[2],p[3]),x=u1(),S=Ree(0,0,1,0);return OSt(x,y),Mee(S,y,S),Mee(S,S,x),[S[0],S[1],S[2]]},t.getPhysicalToWorldMatrix=p=>{t.getWorldToPhysicalMatrix(p),Na(p,p)},t.getWorldToPhysicalMatrix=p=>{sn(p);const y=[3];_d(e.physicalViewNorth,e.physicalViewUp,y),p[0]=y[0],p[1]=y[1],p[2]=y[2],p[4]=e.physicalViewUp[0],p[5]=e.physicalViewUp[1],p[6]=e.physicalViewUp[2],p[8]=-e.physicalViewNorth[0],p[9]=-e.physicalViewNorth[1],p[10]=-e.physicalViewNorth[2],cr(p,p),_r(s,1/e.physicalScale,1/e.physicalScale,1/e.physicalScale),Ed(p,p,s),Ma(p,p,e.physicalTranslation)},t.computeViewParametersFromViewMatrix=p=>{Na(a,p),gr(s,n,a),t.computeDistance();const y=e.distance;t.setPosition(s[0],s[1],s[2]),gr(c,r,a),Xi(c,c,s),Vr(c,c),t.setDirectionOfProjection(c[0],c[1],c[2]),gr(l,i,a),Xi(l,l,s),Vr(l,l),t.setViewUp(l[0],l[1],l[2]),t.setDistance(y)},t.computeViewParametersFromPhysicalMatrix=p=>{t.getWorldToPhysicalMatrix(a),Xn(a,p,a),t.computeViewParametersFromViewMatrix(a)},t.setViewMatrix=p=>{e.viewMatrix=p,e.viewMatrix&&(pa(a,e.viewMatrix),t.computeViewParametersFromViewMatrix(a),cr(e.viewMatrix,e.viewMatrix))},t.getViewMatrix=()=>{if(e.viewMatrix)return e.viewMatrix;Mxe(a,e.position,e.focalPoint,e.viewUp),cr(a,a);const p=new Float64Array(16);return pa(p,a),p},t.setProjectionMatrix=p=>{e.projectionMatrix=p},t.getProjectionMatrix=(p,y,x)=>{const S=new Float64Array(16);if(sn(S),e.projectionMatrix){const T=1/e.physicalScale;return _r(s,T,T,T),pa(S,e.projectionMatrix),Ed(S,S,s),cr(S,S),S}sn(a);const C=e.clippingRange[1]-e.clippingRange[0],_=[e.clippingRange[0]+(y+1)*C/2,e.clippingRange[0]+(x+1)*C/2];if(e.parallelProjection){const T=e.parallelScale*p,O=e.parallelScale,M=(e.windowCenter[0]-1)*T,I=(e.windowCenter[0]+1)*T,V=(e.windowCenter[1]-1)*O,k=(e.windowCenter[1]+1)*O;XU(a,M,I,V,k,_[0],_[1]),cr(a,a)}else{if(e.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const T=Math.tan(Hi(e.viewAngle)/2);let O,M;e.useHorizontalViewAngle===!0?(O=e.clippingRange[0]*T,M=e.clippingRange[0]*T/p):(O=e.clippingRange[0]*T*p,M=e.clippingRange[0]*T);const I=(e.windowCenter[0]-1)*O,V=(e.windowCenter[0]+1)*O,k=(e.windowCenter[1]-1)*M,L=(e.windowCenter[1]+1)*M,$=_[0],W=_[1];a[0]=2*$/(V-I),a[5]=2*$/(L-k),a[2]=(I+V)/(V-I),a[6]=(k+L)/(L-k),a[10]=-($+W)/(W-$),a[14]=-1,a[11]=-2*$*W/(W-$),a[15]=0}}return pa(S,a),S},t.getCompositeProjectionMatrix=(p,y,x)=>{const S=t.getViewMatrix(),C=t.getProjectionMatrix(p,y,x);return Xn(C,S,C),C},t.setDirectionOfProjection=(p,y,x)=>{if(e.directionOfProjection[0]===p&&e.directionOfProjection[1]===y&&e.directionOfProjection[2]===x)return;e.directionOfProjection[0]=p,e.directionOfProjection[1]=y,e.directionOfProjection[2]=x;const S=e.directionOfProjection;e.focalPoint[0]=e.position[0]+S[0]*e.distance,e.focalPoint[1]=e.position[1]+S[1]*e.distance,e.focalPoint[2]=e.position[2]+S[2]*e.distance,m()},t.setDeviceAngles=(p,y,x,S)=>{const C=[3];_d(e.physicalViewNorth,e.physicalViewUp,C);const _=sn(new Float64Array(16));Hu(_,_,Hi(p),e.physicalViewUp),Hu(_,_,Hi(y),C),Hu(_,_,Hi(x),e.physicalViewNorth),Hu(_,_,Hi(-S),e.physicalViewUp);const T=new Float64Array([-e.physicalViewUp[0],-e.physicalViewUp[1],-e.physicalViewUp[2]]),O=new Float64Array(e.physicalViewNorth);gr(T,T,_),gr(O,O,_),t.setDirectionOfProjection(T[0],T[1],T[2]),t.setViewUp(O[0],O[1],O[2]),t.modified()},t.setOrientationWXYZ=(p,y,x,S)=>{const C=sn(new Float64Array(16));if(p!==0&&(y!==0||x!==0||S!==0)){const O=Hi(p),M=u1();ZU(M,[y,x,S],O),UT(C,M)}const _=new Float64Array(3);gr(_,[0,0,-1],C);const T=new Float64Array(3);gr(T,[0,1,0],C),t.setDirectionOfProjection(..._),t.setViewUp(...T),t.modified()},t.computeClippingRange=p=>{let y=null,x=null;y=e.viewPlaneNormal,x=e.position;const S=-y[0],C=-y[1],_=-y[2],T=-(S*x[0]+C*x[1]+_*x[2]),O=[S*p[0]+C*p[2]+_*p[4]+T,1e-18];for(let M=0;M<2;M++)for(let I=0;I<2;I++)for(let V=0;V<2;V++){const k=S*p[V]+C*p[2+I]+_*p[4+M]+T;O[0]=k<O[0]?k:O[0],O[1]=k>O[1]?k:O[1]}return O}}const $Ot={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:Td(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Tbe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,$Ot,n),se.obj(t,e),se.get(t,e,["distance"]),se.setGet(t,e,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),se.getArray(t,e,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),se.setGetArray(t,e,["clippingRange","windowCenter"],2),se.setGetArray(t,e,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),VOt(t,e)}const jOt=se.newInstance(Tbe,"vtkCamera");var TF={newInstance:jOt,extend:Tbe};function UOt(t,e){e.classHierarchy.push("vtkLight");const n=new Float64Array(3);t.getTransformedPosition=()=>(e.transformMatrix?gr(n,e.position,e.transformMatrix):_r(n,e.position[0],e.position[1],e.position[2]),n),t.getTransformedFocalPoint=()=>(e.transformMatrix?gr(n,e.focalPoint,e.transformMatrix):_r(n,e.focalPoint[0],e.focalPoint[1],e.focalPoint[2]),n),t.getDirection=()=>(e.directionMTime<e.mtime&&(yr(e.direction,e.focalPoint,e.position),c1(e.direction),e.directionMTime=e.mtime),e.direction),t.setDirection=r=>{const i=new Float64Array(3);yr(i,e.position,r),e.focalPoint=i},t.setDirectionAngle=(r,i)=>{const a=Hi(r),o=Hi(i);t.setPosition(Math.cos(a)*Math.sin(o),Math.sin(a),Math.cos(a)*Math.cos(o)),t.setFocalPoint(0,0,0),t.setPositional(0)},t.setLightTypeToHeadLight=()=>{t.setLightType("HeadLight")},t.setLightTypeToCameraLight=()=>{t.setLightType("CameraLight")},t.setLightTypeToSceneLight=()=>{t.setTransformMatrix(null),t.setLightType("SceneLight")},t.lightTypeIsHeadLight=()=>e.lightType==="HeadLight",t.lightTypeIsSceneLight=()=>e.lightType==="SceneLight",t.lightTypeIsCameraLight=()=>e.lightType==="CameraLight"}const FOt={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function BOt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,FOt,n),se.obj(t,e),se.setGet(t,e,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),se.setGetArray(t,e,["color","position","focalPoint","attenuationValues"],3),UOt(t,e)}const zOt=se.newInstance(BOt,"vtkLight");var GOt={newInstance:zOt};const{vtkErrorMacro:FC}=se;function WOt(t){return()=>FC(`vtkViewport::${t} - NOT IMPLEMENTED`)}function HOt(t,e){e.classHierarchy.push("vtkViewport"),t.getViewProps=()=>e.props,t.hasViewProp=r=>e.props.includes(r),t.addViewProp=r=>{r&&!t.hasViewProp(r)&&e.props.push(r)},t.removeViewProp=r=>{const i=e.props.filter(a=>a!==r);e.props.length!==i.length&&(e.props=i)},t.removeAllViewProps=()=>{e.props=[]};function n(r){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];i.push(r);const a=r.getNestedProps();if(a&&a.length)for(let o=0;o<a.length;o++)n(a[o],i);return i}t.getViewPropsWithNestedProps=()=>{const r=[];for(let i=0;i<e.props.length;i++)n(e.props[i],r);return r},t.addActor2D=t.addViewProp,t.removeActor2D=r=>{t.removeViewProp(r)},t.getActors2D=()=>(e.actors2D=[],e.props.forEach(r=>{e.actors2D=e.actors2D.concat(r.getActors2D())}),e.actors2D),t.displayToView=()=>FC("call displayToView on your view instead"),t.viewToDisplay=()=>FC("callviewtodisplay on your view instead"),t.getSize=()=>FC("call getSize on your View instead"),t.normalizedDisplayToProjection=(r,i,a)=>{const o=t.normalizedDisplayToNormalizedViewport(r,i,a);return t.normalizedViewportToProjection(o[0],o[1],o[2])},t.normalizedDisplayToNormalizedViewport=(r,i,a)=>{const o=[e.viewport[2]-e.viewport[0],e.viewport[3]-e.viewport[1]];return[(r-e.viewport[0])/o[0],(i-e.viewport[1])/o[1],a]},t.normalizedViewportToProjection=(r,i,a)=>[r*2-1,i*2-1,a*2-1],t.projectionToNormalizedDisplay=(r,i,a)=>{const o=t.projectionToNormalizedViewport(r,i,a);return t.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},t.normalizedViewportToNormalizedDisplay=(r,i,a)=>{const o=[e.viewport[2]-e.viewport[0],e.viewport[3]-e.viewport[1]];return[r*o[0]+e.viewport[0],i*o[1]+e.viewport[1],a]},t.projectionToNormalizedViewport=(r,i,a)=>[(r+1)*.5,(i+1)*.5,(a+1)*.5],t.PickPropFrom=WOt("PickPropFrom")}const qOt={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function Ebe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,qOt,n),se.obj(t,e),se.event(t,e,"event"),se.setGetArray(t,e,["viewport"],4),se.setGetArray(t,e,["background","background2"],3),HOt(t,e)}const KOt=se.newInstance(Ebe,"vtkViewport");var YOt={newInstance:KOt,extend:Ebe};const{vtkDebugMacro:r5,vtkErrorMacro:hg,vtkWarningMacro:XOt}=Rs;function xte(t){return()=>hg(`vtkRenderer::${t} - NOT IMPLEMENTED`)}function ZOt(t,e){e.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:t},r={type:"ResetCameraClippingRangeEvent",renderer:t},i={type:"ResetCameraEvent",renderer:t};t.updateCamera=()=>(e.activeCamera||(r5("No cameras are on, creating one."),t.getActiveCameraAndResetIfCreated()),e.activeCamera.render(t),!0),t.updateLightsGeometryToFollowCamera=()=>{const a=t.getActiveCameraAndResetIfCreated();e.lights.forEach(o=>{o.lightTypeIsSceneLight()||(o.lightTypeIsHeadLight()?(o.setPositionFrom(a.getPositionByReference()),o.setFocalPointFrom(a.getFocalPointByReference()),o.modified(a.getMTime())):o.lightTypeIsCameraLight()?o.setTransformMatrix(a.getCameraLightTransformMatrix(Td())):hg("light has unknown light type",o.get()))})},t.updateLightGeometry=()=>e.lightFollowCamera?t.updateLightsGeometryToFollowCamera():!0,t.allocateTime=xte("allocateTime"),t.updateGeometry=xte("updateGeometry"),t.getVTKWindow=()=>e._renderWindow,t.setLayer=a=>{r5(t.getClassName(),t,"setting Layer to ",a),e.layer!==a&&(e.layer=a,t.modified()),t.setPreserveColorBuffer(!!a)},t.setActiveCamera=a=>e.activeCamera===a?!1:(e.activeCamera=a,t.modified(),t.invokeEvent({type:"ActiveCameraEvent",camera:a}),!0),t.makeCamera=()=>{const a=TF.newInstance();return t.invokeEvent({type:"CreateCameraEvent",camera:a}),a},t.getActiveCamera=()=>(e.activeCamera||(e.activeCamera=t.makeCamera()),e.activeCamera),t.getActiveCameraAndResetIfCreated=()=>(e.activeCamera||(t.getActiveCamera(),t.resetCamera()),e.activeCamera),t.getActors=()=>(e.actors=[],e.props.forEach(a=>{e.actors=e.actors.concat(a.getActors())}),e.actors),t.addActor=t.addViewProp,t.removeActor=a=>{e.actors=e.actors.filter(o=>o!==a),t.removeViewProp(a),t.modified()},t.removeAllActors=()=>{t.getActors().forEach(o=>{t.removeViewProp(o)}),e.actors=[],t.modified()},t.getVolumes=()=>(e.volumes=[],e.props.forEach(a=>{e.volumes=e.volumes.concat(a.getVolumes())}),e.volumes),t.addVolume=t.addViewProp,t.removeVolume=a=>{e.volumes=e.volumes.filter(o=>o!==a),t.removeViewProp(a),t.modified()},t.removeAllVolumes=()=>{t.getVolumes().forEach(o=>{t.removeViewProp(o)}),e.volumes=[],t.modified()},t.hasLight=a=>e.lights.includes(a),t.addLight=a=>{a&&!t.hasLight(a)&&(e.lights.push(a),t.modified())},t.removeLight=a=>{e.lights=e.lights.filter(o=>o!==a),t.modified()},t.removeAllLights=()=>{e.lights=[],t.modified()},t.setLightCollection=a=>{e.lights=a,t.modified()},t.makeLight=GOt.newInstance,t.createLight=()=>{e.automaticLightCreation&&(e._createdLight&&(t.removeLight(e._createdLight),e._createdLight.delete(),e._createdLight=null),e._createdLight=t.makeLight(),t.addLight(e._createdLight),e._createdLight.setLightTypeToHeadLight(),e._createdLight.setPosition(t.getActiveCamera().getPosition()),e._createdLight.setFocalPoint(t.getActiveCamera().getFocalPoint()))},t.normalizedDisplayToWorld=(a,o,s,c)=>{let l=t.normalizedDisplayToProjection(a,o,s);return l=t.projectionToView(l[0],l[1],l[2],c),t.viewToWorld(l[0],l[1],l[2])},t.worldToNormalizedDisplay=(a,o,s,c)=>{let l=t.worldToView(a,o,s);return l=t.viewToProjection(l[0],l[1],l[2],c),t.projectionToNormalizedDisplay(l[0],l[1],l[2])},t.viewToWorld=(a,o,s)=>{if(e.activeCamera===null)return hg("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const c=e.activeCamera.getViewMatrix();Na(c,c),cr(c,c);const l=new Float64Array([a,o,s]);return gr(l,l,c),l},t.projectionToView=(a,o,s,c)=>{if(e.activeCamera===null)return hg("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const l=e.activeCamera.getProjectionMatrix(c,-1,1);Na(l,l),cr(l,l);const u=new Float64Array([a,o,s]);return gr(u,u,l),u},t.worldToView=(a,o,s)=>{if(e.activeCamera===null)return hg("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const c=e.activeCamera.getViewMatrix();cr(c,c);const l=new Float64Array([a,o,s]);return gr(l,l,c),l},t.viewToProjection=(a,o,s,c)=>{if(e.activeCamera===null)return hg("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const l=e.activeCamera.getProjectionMatrix(c,-1,1);cr(l,l);const u=new Float64Array([a,o,s]);return gr(u,u,l),u},t.computeVisiblePropBounds=()=>{e.allBounds[0]=ci.INIT_BOUNDS[0],e.allBounds[1]=ci.INIT_BOUNDS[1],e.allBounds[2]=ci.INIT_BOUNDS[2],e.allBounds[3]=ci.INIT_BOUNDS[3],e.allBounds[4]=ci.INIT_BOUNDS[4],e.allBounds[5]=ci.INIT_BOUNDS[5];let a=!0;t.invokeEvent(n);for(let o=0;o<e.props.length;++o){const s=e.props[o];if(s.getVisibility()&&s.getUseBounds()){const c=s.getBounds();c&&IC(c)&&(a=!1,c[0]<e.allBounds[0]&&(e.allBounds[0]=c[0]),c[1]>e.allBounds[1]&&(e.allBounds[1]=c[1]),c[2]<e.allBounds[2]&&(e.allBounds[2]=c[2]),c[3]>e.allBounds[3]&&(e.allBounds[3]=c[3]),c[4]<e.allBounds[4]&&(e.allBounds[4]=c[4]),c[5]>e.allBounds[5]&&(e.allBounds[5]=c[5]))}}return a&&(P2(e.allBounds),r5("Can't compute bounds, no 3D props are visible")),e.allBounds},t.resetCamera=function(){const o=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:null)||t.computeVisiblePropBounds(),s=[0,0,0];if(!IC(o))return r5("Cannot reset camera!"),!1;let c=null;if(t.getActiveCamera())c=e.activeCamera.getViewPlaneNormal();else return hg("Trying to reset non-existent camera"),!1;e.activeCamera.setViewAngle(30),s[0]=(o[0]+o[1])/2,s[1]=(o[2]+o[3])/2,s[2]=(o[4]+o[5])/2;let l=o[1]-o[0],u=o[3]-o[2],f=o[5]-o[4];l*=l,u*=u,f*=f;let d=l+u+f;d=d===0?1:d,d=Math.sqrt(d)*.5;const h=Hi(e.activeCamera.getViewAngle()),m=d,p=d/Math.sin(h*.5),y=e.activeCamera.getViewUp();return Math.abs(Fn(y,c))>.999&&(XOt("Resetting view-up since view plane normal is parallel"),e.activeCamera.setViewUp(-y[2],y[0],y[1])),e.activeCamera.setFocalPoint(s[0],s[1],s[2]),e.activeCamera.setPosition(s[0]+p*c[0],s[1]+p*c[1],s[2]+p*c[2]),t.resetCameraClippingRange(o),e.activeCamera.setParallelScale(m),e.activeCamera.setPhysicalScale(d),e.activeCamera.setPhysicalTranslation(-s[0],-s[1],-s[2]),t.invokeEvent(i),!0},t.resetCameraClippingRange=function(){const o=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:null)||t.computeVisiblePropBounds();if(!IC(o))return r5("Cannot reset camera clipping range!"),!1;if(t.getActiveCameraAndResetIfCreated(),!e.activeCamera)return hg("Trying to reset clipping range of non-existent camera"),!1;const s=e.activeCamera.computeClippingRange(o);let c=0;if(e.activeCamera.getParallelProjection())c=.2*e.activeCamera.getParallelScale();else{const l=Hi(e.activeCamera.getViewAngle());c=.2*Math.tan(l/2)*s[1]}return s[1]-s[0]<c&&(c=c-s[1]+s[0],s[1]+=c/2,s[0]-=c/2),s[0]<0&&(s[0]=0),s[0]=.99*s[0]-(s[1]-s[0])*e.clippingRangeExpansion,s[1]=1.01*s[1]+(s[1]-s[0])*e.clippingRangeExpansion,s[0]=s[0]>=s[1]?.01*s[1]:s[0],e.nearClippingPlaneTolerance||(e.nearClippingPlaneTolerance=.01),s[0]<e.nearClippingPlaneTolerance*s[1]&&(s[0]=e.nearClippingPlaneTolerance*s[1]),e.activeCamera.setClippingRange(s[0],s[1]),t.invokeEvent(r),!1},t.setRenderWindow=a=>{a!==e._renderWindow&&(e._vtkWindow=a,e._renderWindow=a)},t.visibleActorCount=()=>e.props.filter(a=>a.getVisibility()).length,t.visibleVolumeCount=t.visibleActorCount,t.getMTime=()=>{let a=e.mtime;const o=e.activeCamera?e.activeCamera.getMTime():0;o>a&&(a=o);const s=e._createdLight?e._createdLight.getMTime():0;return s>a&&(a=s),a},t.getTransparent=()=>!!e.preserveColorBuffer,t.isActiveCameraCreated=()=>!!e.activeCamera}const QOt={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:op(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function Obe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};for(Object.assign(e,QOt,n),YOt.extend(t,e,n),e.background||(e.background=[0,0,0,1]);e.background.length<3;)e.background.push(0);e.background.length===3&&e.background.push(1),sc(t,e,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),Ja(t,e,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),N2(t,e,["actors","volumes","lights"]),OU(t,e,["background"],4,1),l3(t,e,["renderWindow"]),ZOt(t,e)}const JOt=ri(Obe,"vtkRenderer");var eDt={newInstance:JOt,extend:Obe};const tDt={Unknown:0,LeftController:1,RightController:2},nDt={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7},rDt={Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4};var Dbe={Device:tDt,Input:nDt,Axis:rDt};const{Device:kS,Input:om}=Dbe,{vtkWarningMacro:AS,vtkErrorMacro:LS,normalizeWheel:iDt,vtkOnceErrorMacro:aDt}=se,bv={ctrlKey:!1,altKey:!1,shiftKey:!1},BR={"xr-standard":[om.Trigger,om.Grip,om.TrackPad,om.Thumbstick,om.A,om.B]},EF=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function i5(t){t.cancelable&&t.preventDefault()}function VS(t){const e=Object.create(null);return t.forEach(n=>{let{pointerId:r,position:i}=n;e[r]=i}),e}function oDt(t,e){e.classHierarchy.push("vtkRenderWindowInteractor");const n={...t},r=new Set,i=new Map;let a=1;t.start=()=>{!e.initialized&&(t.initialize(),!e.initialized)||t.startEventLoop()},t.setRenderWindow=p=>{LS("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},t.setInteractorStyle=p=>{e.interactorStyle!==p&&(e.interactorStyle!=null&&e.interactorStyle.setInteractor(null),e.interactorStyle=p,e.interactorStyle!=null&&e.interactorStyle.getInteractor()!==t&&e.interactorStyle.setInteractor(t))},t.initialize=()=>{e.initialized=!0,t.enable(),t.render()},t.enable=()=>t.setEnabled(!0),t.disable=()=>t.setEnabled(!1),t.startEventLoop=()=>AS("empty event loop");function o(p,y){e._forcedRenderer||(e.currentRenderer=t.findPokedRenderer(p,y))}t.getCurrentRenderer=()=>(e.currentRenderer||o(0,0),e.currentRenderer);function s(p){const y=e._view.getCanvas(),x=y.getBoundingClientRect(),S=y.width/x.width,C=y.height/x.height,_={x:S*(p.clientX-x.left),y:C*(x.height-p.clientY+x.top),z:0};return(i.size<=1||!e.currentRenderer)&&o(_.x,_.y),_}const c=e._getScreenEventPositionFor||s;function l(p){return{controlKey:p.ctrlKey,altKey:p.altKey,shiftKey:p.shiftKey}}function u(p){const y=l(p);return{key:p.key,keyCode:p.charCode,...y}}function f(p){return p.pointerType||""}const d=()=>{if(e.container===null)return;const{container:p}=e;p.addEventListener("contextmenu",i5),p.addEventListener("wheel",t.handleWheel),p.addEventListener("DOMMouseScroll",t.handleWheel),p.addEventListener("pointerenter",t.handlePointerEnter),p.addEventListener("pointerleave",t.handlePointerLeave),p.addEventListener("pointermove",t.handlePointerMove,{passive:!1}),p.addEventListener("pointerdown",t.handlePointerDown,{passive:!1}),p.addEventListener("pointerup",t.handlePointerUp),p.addEventListener("pointercancel",t.handlePointerCancel),document.addEventListener("keypress",t.handleKeyPress),document.addEventListener("keydown",t.handleKeyDown),document.addEventListener("keyup",t.handleKeyUp),document.addEventListener("pointerlockchange",t.handlePointerLockChange),p.style.touchAction="none",p.style.userSelect="none",p.style.webkitTapHighlightColor="rgba(0,0,0,0)"};t.bindEvents=p=>{if(p===null)return;n.setContainer(p)&&d()};const h=()=>{clearTimeout(e.moveTimeoutID),clearTimeout(e.wheelTimeoutID),e.moveTimeoutID=0,e.wheelTimeoutID=0,a=1;const{container:p}=e;p&&(p.removeEventListener("contextmenu",i5),p.removeEventListener("wheel",t.handleWheel),p.removeEventListener("DOMMouseScroll",t.handleWheel),p.removeEventListener("pointerenter",t.handlePointerEnter),p.removeEventListener("pointerleave",t.handlePointerLeave),p.removeEventListener("pointermove",t.handlePointerMove,{passive:!1}),p.removeEventListener("pointerdown",t.handlePointerDown,{passive:!1}),p.removeEventListener("pointerup",t.handlePointerUp),p.removeEventListener("pointercancel",t.handlePointerCancel)),document.removeEventListener("keypress",t.handleKeyPress),document.removeEventListener("keydown",t.handleKeyDown),document.removeEventListener("keyup",t.handleKeyUp),document.removeEventListener("pointerlockchange",t.handlePointerLockChange),i.clear()};t.unbindEvents=()=>{h(),n.setContainer(null)},t.handleKeyPress=p=>{const y=u(p);t.keyPressEvent(y)},t.handleKeyDown=p=>{const y=u(p);t.keyDownEvent(y)},t.handleKeyUp=p=>{const y=u(p);t.keyUpEvent(y)},t.handlePointerEnter=p=>{const y={...l(p),position:c(p),deviceType:f(p)};t.pointerEnterEvent(y),y.deviceType==="mouse"&&t.mouseEnterEvent(y)},t.handlePointerLeave=p=>{const y={...l(p),position:c(p),deviceType:f(p)};t.pointerLeaveEvent(y),y.deviceType==="mouse"&&t.mouseLeaveEvent(y)},t.handlePointerDown=p=>{if(!(p.button>2||t.isPointerLocked()))switch(e.preventDefaultOnPointerDown&&i5(p),p.target.hasPointerCapture(p.pointerId)&&p.target.releasePointerCapture(p.pointerId),e.container.setPointerCapture(p.pointerId),i.has(p.pointerId)&&AS("[RenderWindowInteractor] duplicate pointerId detected"),i.set(p.pointerId,{pointerId:p.pointerId,position:c(p)}),p.pointerType){case"pen":case"touch":t.handleTouchStart(p);break;case"mouse":default:t.handleMouseDown(p);break}},t.handlePointerUp=p=>{if(i.has(p.pointerId))switch(e.preventDefaultOnPointerUp&&i5(p),i.delete(p.pointerId),e.container.releasePointerCapture(p.pointerId),p.pointerType){case"pen":case"touch":t.handleTouchEnd(p);break;case"mouse":default:t.handleMouseUp(p);break}},t.handlePointerCancel=p=>{if(i.has(p.pointerId))switch(i.delete(p.pointerId),p.pointerType){case"pen":case"touch":t.handleTouchEnd(p);break;case"mouse":default:t.handleMouseUp(p);break}},t.handlePointerMove=p=>{if(i.has(p.pointerId)){const y=i.get(p.pointerId);y.position=c(p)}switch(p.pointerType){case"pen":case"touch":t.handleTouchMove(p);break;case"mouse":default:t.handleMouseMove(p);break}},t.handleMouseDown=p=>{const y={...l(p),position:c(p),deviceType:f(p)};switch(p.button){case 0:t.leftButtonPressEvent(y);break;case 1:t.middleButtonPressEvent(y);break;case 2:t.rightButtonPressEvent(y);break;default:LS(`Unknown mouse button pressed: ${p.button}`);break}},t.requestPointerLock=()=>{e.container&&e.container.requestPointerLock()},t.exitPointerLock=()=>document.exitPointerLock?.(),t.isPointerLocked=()=>!!e.container&&document.pointerLockElement===e.container,t.handlePointerLockChange=()=>{t.isPointerLocked()?t.startPointerLockEvent():t.endPointerLockEvent()};function m(){e._view&&e.enabled&&e.enableRender&&(e.inRender=!0,e._view.traverseAllPasses(),e.inRender=!1),t.invokeRenderEvent()}t.requestAnimation=p=>{if(p===void 0){LS("undefined requester, can not start animating");return}if(r.has(p)){AS("requester is already registered for animating");return}r.add(p),!e.animationRequest&&r.size===1&&!e.xrAnimation&&(e._animationStartTime=Date.now(),e._animationFrameCount=0,e.animationRequest=requestAnimationFrame(t.handleAnimation),t.startAnimationEvent())},t.extendAnimation=p=>{const y=Date.now()+p;e._animationExtendedEnd=Math.max(e._animationExtendedEnd,y),!e.animationRequest&&r.size===0&&!e.xrAnimation&&(e._animationStartTime=Date.now(),e._animationFrameCount=0,e.animationRequest=requestAnimationFrame(t.handleAnimation),t.startAnimationEvent())},t.isAnimating=()=>e.xrAnimation||e.animationRequest!==null,t.cancelAnimation=function(p){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!r.has(p)){if(!y){const x=p&&p.getClassName?p.getClassName():p;AS(`${x} did not request an animation`)}return}r.delete(p),e.animationRequest&&r.size===0&&Date.now()>e._animationExtendedEnd&&(cancelAnimationFrame(e.animationRequest),e.animationRequest=null,t.endAnimationEvent(),t.render())},t.switchToXRAnimation=()=>{e.animationRequest&&(cancelAnimationFrame(e.animationRequest),e.animationRequest=null),e.xrAnimation=!0},t.returnFromXRAnimation=()=>{e.xrAnimation=!1,r.size!==0&&(e.recentAnimationFrameRate=10,e.animationRequest=requestAnimationFrame(t.handleAnimation))},t.updateXRGamepads=(p,y,x)=>{p.inputSources.forEach(S=>{const C=S.gripSpace==null?null:y.getPose(S.gripSpace,x),_=S.gripSpace==null?null:y.getPose(S.targetRaySpace,x),T=S.gamepad,O=S.handedness;if(T){T.index in e.lastGamepadValues||(e.lastGamepadValues[T.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let M=0;M<T.buttons.length;++M)M in e.lastGamepadValues[T.index][O].buttons||(e.lastGamepadValues[T.index][O].buttons[M]=!1),e.lastGamepadValues[T.index][O].buttons[M]!==T.buttons[M].pressed&&C!=null&&(t.button3DEvent({gamepad:T,position:C.transform.position,orientation:C.transform.orientation,targetPosition:_.transform.position,targetOrientation:_.transform.orientation,pressed:T.buttons[M].pressed,device:S.handedness==="left"?kS.LeftController:kS.RightController,input:BR[T.mapping]&&BR[T.mapping][M]?BR[T.mapping][M]:om.Trigger}),e.lastGamepadValues[T.index][O].buttons[M]=T.buttons[M].pressed),e.lastGamepadValues[T.index][O].buttons[M]&&C!=null&&t.move3DEvent({gamepad:T,position:C.transform.position,orientation:C.transform.orientation,targetPosition:_.transform.position,targetOrientation:_.transform.orientation,device:S.handedness==="left"?kS.LeftController:kS.RightController})}})},t.handleMouseMove=p=>{const y={...l(p),position:c(p),deviceType:f(p)};e.moveTimeoutID===0?t.startMouseMoveEvent(y):(t.mouseMoveEvent(y),clearTimeout(e.moveTimeoutID)),e.moveTimeoutID=setTimeout(()=>{t.endMouseMoveEvent(),e.moveTimeoutID=0},200)},t.handleAnimation=()=>{const p=Date.now();e._animationFrameCount++,p-e._animationStartTime>1e3&&e._animationFrameCount>1&&(e.recentAnimationFrameRate=1e3*(e._animationFrameCount-1)/(p-e._animationStartTime),e.lastFrameTime=1/e.recentAnimationFrameRate,t.animationFrameRateUpdateEvent(),e._animationStartTime=p,e._animationFrameCount=1),t.animationEvent(),m(),r.size>0||Date.now()<e._animationExtendedEnd?e.animationRequest=requestAnimationFrame(t.handleAnimation):(cancelAnimationFrame(e.animationRequest),e.animationRequest=null,t.endAnimationEvent(),t.render())},t.handleWheel=p=>{i5(p);const y={...iDt(p),...l(p),position:c(p),deviceType:f(p)};e.wheelTimeoutID===0&&(Math.abs(y.spinY)>=.3?a=Math.abs(y.spinY):a=1),y.spinY/=a,e.wheelTimeoutID===0?(t.startMouseWheelEvent(y),t.mouseWheelEvent(y)):(t.mouseWheelEvent(y),clearTimeout(e.wheelTimeoutID)),e.mouseScrollDebounceByPass?(t.extendAnimation(600),t.endMouseWheelEvent(),e.wheelTimeoutID=0):e.wheelTimeoutID=setTimeout(()=>{t.extendAnimation(600),t.endMouseWheelEvent(),e.wheelTimeoutID=0},200)},t.handleMouseUp=p=>{const y={...l(p),position:c(p),deviceType:f(p)};switch(p.button){case 0:t.leftButtonReleaseEvent(y);break;case 1:t.middleButtonReleaseEvent(y);break;case 2:t.rightButtonReleaseEvent(y);break;default:LS(`Unknown mouse button released: ${p.button}`);break}},t.handleTouchStart=p=>{const y=[...i.values()];if(e.recognizeGestures&&y.length>1){const x=VS(i);if(y.length===2){const S={...l(bv),position:y[0].position,deviceType:f(p)};t.leftButtonReleaseEvent(S)}t.recognizeGesture("TouchStart",x)}else if(y.length===1){const x={...l(bv),position:c(p),deviceType:f(p)};t.leftButtonPressEvent(x)}},t.handleTouchMove=p=>{const y=[...i.values()];if(e.recognizeGestures&&y.length>1){const x=VS(i);t.recognizeGesture("TouchMove",x)}else if(y.length===1){const x={...l(bv),position:y[0].position,deviceType:f(p)};t.mouseMoveEvent(x)}},t.handleTouchEnd=p=>{const y=[...i.values()];if(e.recognizeGestures)if(y.length===0){const x={...l(bv),position:c(p),deviceType:f(p)};t.leftButtonReleaseEvent(x)}else if(y.length===1){const x=VS(i);t.recognizeGesture("TouchEnd",x);const S={...l(bv),position:y[0].position,deviceType:f(p)};t.leftButtonPressEvent(S)}else{const x=VS(i);t.recognizeGesture("TouchMove",x)}else if(y.length===1){const x={...l(bv),position:y[0].position,deviceType:f(p)};t.leftButtonReleaseEvent(x)}},t.setView=p=>{e._view!==p&&(e._view=p,e._view.getRenderable().setInteractor(t),t.modified())},t.getFirstRenderer=()=>e._view?.getRenderable()?.getRenderersByReference()?.[0],t.findPokedRenderer=function(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!e._view)return null;const x=e._view?.getRenderable()?.getRenderers();if(!x||x.length===0)return null;x.sort((O,M)=>O.getLayer()-M.getLayer());let S=null,C=null,_=null,T=x.length;for(;T--;){const O=x[T];if(e._view.isInViewport(p,y,O)&&O.getInteractive()){_=O;break}S===null&&O.getInteractive()&&(S=O),C===null&&e._view.isInViewport(p,y,O)&&(C=O)}return _===null&&(_=S),_===null&&(_=C),_==null&&(_=x[0]),_},t.render=()=>{!t.isAnimating()&&!e.inRender&&m()},EF.forEach(p=>{const y=p.charAt(0).toLowerCase()+p.slice(1);t[`${y}Event`]=x=>{if(!e.enabled)return;if(!t.getCurrentRenderer()){aDt(`
          Can not forward events without a current renderer on the interactor.
        `);return}const C={type:p,pokedRenderer:e.currentRenderer,firstRenderer:t.getFirstRenderer(),...x};t[`invoke${p}`](C)}}),t.recognizeGesture=(p,y)=>{if(Object.keys(y).length>2)return;if(e.startingEventPositions||(e.startingEventPositions={}),p==="TouchStart"){Object.keys(y).forEach(k=>{e.startingEventPositions[k]=y[k]}),e.currentGesture="Start";return}if(p==="TouchEnd"){e.currentGesture==="Pinch"&&(t.render(),t.endPinchEvent()),e.currentGesture==="Rotate"&&(t.render(),t.endRotateEvent()),e.currentGesture==="Pan"&&(t.render(),t.endPanEvent()),e.currentGesture="Start",e.startingEventPositions={};return}let x=0;const S=[],C=[];Object.keys(y).forEach(k=>{S[x]=y[k],C[x]=e.startingEventPositions[k],x++});const _=Math.sqrt((C[0].x-C[1].x)*(C[0].x-C[1].x)+(C[0].y-C[1].y)*(C[0].y-C[1].y)),T=Math.sqrt((S[0].x-S[1].x)*(S[0].x-S[1].x)+(S[0].y-S[1].y)*(S[0].y-S[1].y));let O=AT(Math.atan2(C[1].y-C[0].y,C[1].x-C[0].x)),M=AT(Math.atan2(S[1].y-S[0].y,S[1].x-S[0].x)),I=M-O;M=M+180>=360?M-180:M+180,O=O+180>=360?O-180:O+180,Math.abs(M-O)<Math.abs(I)&&(I=M-O);const V=[];if(V[0]=(S[0].x-C[0].x+S[1].x-C[1].x)/2,V[1]=(S[0].y-C[0].y+S[1].y-C[1].y)/2,p==="TouchMove")if(e.currentGesture==="Start"){let k=.01*Math.sqrt(e.container.clientWidth*e.container.clientWidth+e.container.clientHeight*e.container.clientHeight);k<15&&(k=15);const L=Math.abs(T-_),$=T*3.1415926*Math.abs(I)/360,W=Math.sqrt(V[0]*V[0]+V[1]*V[1]);if(L>k&&L>$&&L>W){e.currentGesture="Pinch";const G={scale:1,touches:y};t.startPinchEvent(G)}else if($>k&&$>W){e.currentGesture="Rotate";const G={rotation:0,touches:y};t.startRotateEvent(G)}else if(W>k){e.currentGesture="Pan";const G={translation:[0,0],touches:y};t.startPanEvent(G)}}else{if(e.currentGesture==="Rotate"){const k={rotation:I,touches:y};t.rotateEvent(k)}if(e.currentGesture==="Pinch"){const k={scale:T/_,touches:y};t.pinchEvent(k)}if(e.currentGesture==="Pan"){const k={translation:V,touches:y};t.panEvent(k)}}},t.handleVisibilityChange=()=>{e._animationStartTime=Date.now(),e._animationFrameCount=0},t.setCurrentRenderer=p=>{e._forcedRenderer=!!p,e.currentRenderer=p},t.setContainer=p=>{h();const y=n.setContainer(p??null);return y&&d(),y},t.delete=()=>{for(;r.size;)t.cancelAnimation(r.values().next().value);typeof document.hidden<"u"&&document.removeEventListener("visibilitychange",t.handleVisibilityChange),e.container&&t.setContainer(null),n.delete()},typeof document.hidden<"u"&&document.addEventListener("visibilitychange",t.handleVisibilityChange,!1)}const sDt={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function Mbe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,sDt,n),se.obj(t,e),e._animationExtendedEnd=0,se.event(t,e,"RenderEvent"),EF.forEach(r=>se.event(t,e,r)),se.get(t,e,["initialized","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),se.setGet(t,e,["container","lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),se.moveToProtected(t,e,["view"]),oDt(t,e)}const cDt=se.newInstance(Mbe,"vtkRenderWindowInteractor");var lDt={newInstance:cDt,extend:Mbe,handledEvents:EF,...Dbe};const{vtkDebugMacro:uDt}=se;function fDt(t,e){e.classHierarchy.push("vtkActor");const n={...t};t.getActors=()=>[t],t.getIsOpaque=()=>{if(e.forceOpaque)return!0;if(e.forceTranslucent)return!1;e.property||t.getProperty();let r=e.property.getOpacity()>=1;return r=r&&(!e.texture||!e.texture.isTranslucent()),r=r&&(!e.mapper||e.mapper.getIsOpaque()),r},t.hasTranslucentPolygonalGeometry=()=>e.mapper===null?!1:(e.property===null&&t.setProperty(t.makeProperty()),!t.getIsOpaque()),t.makeProperty=w3.newInstance,t.getProperty=()=>(e.property===null&&(e.property=t.makeProperty()),e.property),t.getBounds=()=>{if(e.mapper===null)return e.bounds;const r=e.mapper.getBounds();if(!r||r.length!==6)return r;if(r[0]>r[1])return e.mapperBounds=r.concat(),e.bounds=[1,-1,1,-1,1,-1],e.boundsMTime.modified(),r;if(!e.mapperBounds||r[0]!==e.mapperBounds[0]||r[1]!==e.mapperBounds[1]||r[2]!==e.mapperBounds[2]||r[3]!==e.mapperBounds[3]||r[4]!==e.mapperBounds[4]||r[5]!==e.mapperBounds[5]||t.getMTime()>e.boundsMTime.getMTime()){uDt("Recomputing bounds..."),e.mapperBounds=r.concat();const i=[];ci.getCorners(r,i),t.computeMatrix();const a=new Float64Array(16);cr(a,e.matrix),i.forEach(o=>gr(o,o,a)),e.bounds[0]=e.bounds[2]=e.bounds[4]=Number.MAX_VALUE,e.bounds[1]=e.bounds[3]=e.bounds[5]=-Number.MAX_VALUE,e.bounds=e.bounds.map((o,s)=>s%2===0?i.reduce((c,l)=>c>l[s/2]?l[s/2]:c,o):i.reduce((c,l)=>c<l[(s-1)/2]?l[(s-1)/2]:c,o)),e.boundsMTime.modified()}return e.bounds},t.getMTime=()=>{let r=n.getMTime();if(e.property!==null){const i=e.property.getMTime();r=i>r?i:r}if(e.backfaceProperty!==null){const i=e.backfaceProperty.getMTime();r=i>r?i:r}return r},t.getRedrawMTime=()=>{let r=e.mtime;if(e.mapper!==null){let i=e.mapper.getMTime();r=i>r?i:r,e.mapper.getInput()!==null&&(e.mapper.getInputAlgorithm().update(),i=e.mapper.getInput().getMTime(),r=i>r?i:r)}return r},t.getSupportsSelection=()=>e.mapper?e.mapper.getSupportsSelection():!1,t.processSelectorPixelBuffers=(r,i)=>{e.mapper&&e.mapper.processSelectorPixelBuffers&&e.mapper.processSelectorPixelBuffers(r,i)}}const dDt={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function Rbe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,dDt,n),gF.extend(t,e,n),e.boundsMTime={},se.obj(e.boundsMTime),se.set(t,e,["property"]),se.setGet(t,e,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),fDt(t,e)}const hDt=se.newInstance(Rbe,"vtkActor");var gDt={newInstance:hDt,extend:Rbe};function pDt(t,e){const n=t.invokeResize;delete t.invokeResize,e.renderWindow=y9t.newInstance(),e.rendererMap={},e.openGLRenderWindow=LOt.newInstance(),e.renderWindow.addView(e.openGLRenderWindow),e.interactor=lDt.newInstance(),e.interactor.setView(e.openGLRenderWindow),e.interactor.initialize(),t.addRenderer=({viewport:r,id:i,background:a})=>{const o=eDt.newInstance({viewport:r,background:a||e.background});e.renderWindow.addRenderer(o),e.rendererMap[i]=o},t.destroy=()=>{e.renderWindow.getInteractor().delete()},t.removeRenderer=r=>{const i=t.getRenderer(r);e.renderWindow.removeRenderer(i),i.delete(),delete e.rendererMap[r]},t.getRenderer=r=>e.rendererMap[r],t.getRenderers=()=>{const{rendererMap:r}=e;return Object.keys(r).map(a=>({id:a,renderer:r[a]}))},t.resize=()=>{if(e.container){const{width:r,height:i}=e.container;e.openGLRenderWindow.setSize(Math.floor(r),Math.floor(i)),n(),e.renderWindow.render()}},t.setContainer=r=>{e.container=r,e.openGLRenderWindow.setContainer(e.container)},t.delete=se.chain(t.setContainer,t.destroy,e.openGLRenderWindow.delete,t.delete),t.resize()}const mDt={background:[0,0,0],container:null};function Ibe(t,e,n={}){Object.assign(e,mDt,n),se.obj(t,e),se.get(t,e,["renderWindow","openGLRenderWindow","interactor","container"]),se.event(t,e,"resize"),pDt(t,e)}const vDt=se.newInstance(Ibe),Nbe={newInstance:vDt,extend:Ibe},{BlendMode:gg,FilterMode:R5}=a2e;function yDt(t,e,n,r,i){let a=null;return i?(a=i,a.removeAllPoints()):a=l1.newInstance(),a.addPointLong(-1024,0,1,1),a.addPoint(t,e),a.addPoint(n,r),a}const xDt={createRadonTransferFunction:yDt};function wDt(t,e){e.classHierarchy.push("vtkVolumeMapper");const n={...t};t.getBounds=()=>{const r=t.getInputData();return r?(e.static||t.update(),e.bounds=r.getBounds()):e.bounds=op(),e.bounds},t.update=()=>{t.getInputData()},t.setBlendModeToComposite=()=>{t.setBlendMode(gg.COMPOSITE_BLEND)},t.setBlendModeToMaximumIntensity=()=>{t.setBlendMode(gg.MAXIMUM_INTENSITY_BLEND)},t.setBlendModeToMinimumIntensity=()=>{t.setBlendMode(gg.MINIMUM_INTENSITY_BLEND)},t.setBlendModeToAverageIntensity=()=>{t.setBlendMode(gg.AVERAGE_INTENSITY_BLEND)},t.setBlendModeToAdditiveIntensity=()=>{t.setBlendMode(gg.ADDITIVE_INTENSITY_BLEND)},t.setBlendModeToRadonTransform=()=>{t.setBlendMode(gg.RADON_TRANSFORM_BLEND)},t.getBlendModeAsString=()=>se.enumToString(gg,e.blendMode),t.setAverageIPScalarRange=(r,i)=>{console.warn("setAverageIPScalarRange is deprecated use setIpScalarRange"),t.setIpScalarRange(r,i)},t.getFilterModeAsString=()=>se.enumToString(R5,e.filterMode),t.setFilterModeToOff=()=>{t.setFilterMode(R5.OFF)},t.setFilterModeToNormalized=()=>{t.setFilterMode(R5.NORMALIZED)},t.setFilterModeToRaw=()=>{t.setFilterMode(R5.RAW)},t.setGlobalIlluminationReach=r=>n.setGlobalIlluminationReach(cf(r,0,1)),t.setVolumetricScatteringBlending=r=>n.setVolumetricScatteringBlending(cf(r,0,1)),t.setVolumeShadowSamplingDistFactor=r=>n.setVolumeShadowSamplingDistFactor(r>=1?r:1),t.setAnisotropy=r=>n.setAnisotropy(cf(r,-.99,.99)),t.setLAOKernelSize=r=>n.setLAOKernelSize(AU(cf(r,1,32))),t.setLAOKernelRadius=r=>n.setLAOKernelRadius(r>=1?r:1)}const bDt=t=>({bounds:[1,-1,1,-1,1,-1],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0,initialInteractionScale:1,interactionSampleDistanceFactor:1,blendMode:gg.COMPOSITE_BLEND,ipScalarRange:[-1e6,1e6],filterMode:R5.OFF,preferSizeOverAccuracy:!1,computeNormalFromOpacity:!1,volumetricScatteringBlending:0,globalIlluminationReach:0,volumeShadowSamplingDistFactor:5,anisotropy:0,localAmbientOcclusion:!1,LAOKernelSize:15,LAOKernelRadius:7,updatedExtents:[],...t});function Pbe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,bDt(n)),CF.extend(t,e,n),se.setGet(t,e,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances","initialInteractionScale","interactionSampleDistanceFactor","blendMode","filterMode","preferSizeOverAccuracy","computeNormalFromOpacity","volumetricScatteringBlending","globalIlluminationReach","volumeShadowSamplingDistFactor","anisotropy","localAmbientOcclusion","LAOKernelSize","LAOKernelRadius","updatedExtents"]),se.setGetArray(t,e,["ipScalarRange"],2),se.event(t,e,"lightingActivated"),wDt(t,e)}const SDt=se.newInstance(Pbe,"vtkVolumeMapper");var kbe={newInstance:SDt,extend:Pbe,...xDt};function CDt(t,e){e.classHierarchy.push("vtkSharedVolumeMapper");const n=t.delete;t.delete=()=>{e.scalarTexture=null,n()}}const _Dt={scalarTexture:null};function Abe(t,e,n={}){Object.assign(e,_Dt,n),kbe.extend(t,e,n),se.setGet(t,e,["scalarTexture"]),CDt(t,e)}const TDt=se.newInstance(Abe,"vtkSharedVolumeMapper"),EDt={newInstance:TDt,extend:Abe};function wte(t,e){const n=_F(e),r=new n(t.length);return r.set(t),r}function ODt(t,e){e.classHierarchy.push("vtkStreamingOpenGLTexture"),e.updatedFrames=[],e.volumeId=null;const n=t.create3DFilterableFromRaw;t.create3DFilterableFromRaw=(s,c,l,u,f,d,h)=>{e.inputDataType=f,e.inputNumComps=u,n(s,c,l,u,f,d,h)};const r=t.updateVolumeInfoForGL;t.updateVolumeInfoForGL=(s,c)=>{const l=r(s,c);return e.volumeInfo.dataComputedScale=[1],e.volumeInfo.dataComputedOffset=[0],l},t.update3DFromRaw=()=>{const{volumeId:s}=e;if(!s)return;const c=Ct.getVolume(s);if(e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind(),c.isDynamicVolume()){o();return}return t.hasUpdatedFrames()&&a()};const i=t.modified;t.setUpdatedFrame=s=>{e.updatedFrames[s]=!0,i()},t.modified=()=>{i();const s=Ct.getVolume(e.volumeId);if(!s)return;const c=s.imageIds;for(let l=0;l<c.length;l++)e.updatedFrames[l]=!0};function a(){const s=Ct.getVolume(e.volumeId),c=s.imageIds;for(let l=0;l<e.updatedFrames.length;l++)if(e.updatedFrames[l]){const u=Ct.getImage(c[l]);if(!u)continue;let f=u.voxelManager.getScalarData();const d=e.context;s.dataType!==f.constructor.name&&(f=wte(f,s.dataType));const[h]=t.updateArrayDataTypeForGL(s.dataType,[f]);t.bind();const m=l;d.texSubImage3D(e.target,0,0,0,m,e.width,e.height,1,e.format,e.openGLDataType,h),t.deactivate(),e.updatedFrames[l]=null}return e.generateMipmap&&e.context.generateMipmap(e.target),t.deactivate(),!0}function o(){const s=Ct.getVolume(e.volumeId),c=s.getCurrentDimensionGroupImageIds();if(!c.length)return!1;let l;for(let u=0;u<c.length;u++){const f=c[u],d=Ct.getImage(f);let h;d?(h=d.voxelManager.getScalarData(),l=h.constructor):(l=_F(s.dataType,!0),h=new l(e.width*e.height));const m=e.context;s.dataType!==h.constructor.name&&(h=wte(h,s.dataType));const[p]=t.updateArrayDataTypeForGL(s.dataType,[h]);t.bind();let y=u;m.texSubImage3D(e.target,0,0,0,y,e.width,e.height,1,e.format,e.openGLDataType,p),t.deactivate()}return e.generateMipmap&&e.context.generateMipmap(e.target),t.deactivate(),!0}t.hasUpdatedFrames=()=>!e.updatedFrames.length||e.updatedFrames.some(s=>s),t.getUpdatedFrames=()=>e.updatedFrames,t.setVolumeId=s=>{e.volumeId=s},t.getVolumeId=()=>e.volumeId,t.setTextureParameters=({width:s,height:c,depth:l,numberOfComponents:u,dataType:f})=>{e.width??=s,e.height??=c,e.depth??=l,e.inputNumComps??=u,e.inputDataType??=f},t.getTextureParameters=()=>({width:e.width,height:e.height,depth:e.depth,numberOfComponents:e.inputNumComps,dataType:e.inputDataType})}const DDt={updatedFrames:[]};function Lbe(t,e,n={}){Object.assign(e,DDt,n),mi.extend(t,e,n),ODt(t,e)}const MDt=se.newInstance(Lbe,"vtkStreamingOpenGLTexture"),RDt={newInstance:MDt,extend:Lbe},IDt={isPerformingCoordinateTransformation:!1};function Vbe(t,e,n={}){Object.assign(e,IDt,n),TF.extend(t,e,n),se.setGet(t,e,["isPerformingCoordinateTransformation"]),PDt(t,e)}const NDt=se.newInstance(Vbe,"vtkSlabCamera");function PDt(t,e){e.classHierarchy.push("vtkSlabCamera");const n=sn(new Float64Array(16)),r=new Float64Array(3);t.getProjectionMatrix=(i,a,o)=>{const s=Td();if(e.projectionMatrix){const d=1/e.physicalScale;return _r(r,d,d,d),pa(s,e.projectionMatrix),Ed(s,s,r),cr(s,s),s}sn(n);let c=e.clippingRange[0],l=e.clippingRange[1];e.isPerformingCoordinateTransformation&&(c=e.distance,l=e.distance+.1);const u=l-c,f=[c+(a+1)*u/2,c+(o+1)*u/2];if(e.parallelProjection){const d=e.parallelScale*i,h=e.parallelScale,m=(e.windowCenter[0]-1)*d,p=(e.windowCenter[0]+1)*d,y=(e.windowCenter[1]-1)*h,x=(e.windowCenter[1]+1)*h;XU(n,m,p,y,x,f[0],f[1]),cr(n,n)}else{if(e.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const d=Math.tan(hu.radiansFromDegrees(e.viewAngle)/2);let h,m;e.useHorizontalViewAngle===!0?(h=c*d,m=c*d/i):(h=c*d*i,m=c*d);const p=(e.windowCenter[0]-1)*h,y=(e.windowCenter[0]+1)*h,x=(e.windowCenter[1]-1)*m,S=(e.windowCenter[1]+1)*m,C=f[0],_=f[1];n[0]=2*C/(y-p),n[5]=2*C/(S-x),n[2]=(p+y)/(y-p),n[6]=(x+S)/(S-x),n[10]=-(C+_)/(_-C),n[14]=-1,n[11]=-2*C*_/(_-C),n[15]=0}}return pa(s,n),s}}const kDt={newInstance:NDt,extend:Vbe};class JE{constructor(e){this._imageIdsIndexMap=new Map,this._imageURIsIndexMap=new Map,this.cornerstoneImageMetaData=null,this.isPreScaled=!1,this.numTimePoints=null,this.numFrames=null;const{imageIds:n,scaling:r,dimensions:i,spacing:a,origin:o,direction:s,dataType:c,volumeId:l,referencedVolumeId:u,metadata:f,referencedImageIds:d,additionalDetails:h,voxelManager:m,numberOfComponents:p}=e;if(!c)throw new Error('Data type is required, please provide a data type as string such as "Uint8Array", "Float32Array", etc.');let{imageData:y}=e;this.suppressWarnings=!0,this.imageIds=n,this.volumeId=l,this.metadata=f,this.dimensions=i,this.spacing=a,this.origin=o,this.direction=s,this.dataType=c,this.vtkOpenGLTexture=RDt.newInstance(),this.vtkOpenGLTexture.setVolumeId(l),this.voxelManager=m??oi.createImageVolumeVoxelManager({dimensions:i,imageIds:n,numberOfComponents:p}),this.numVoxels=this.dimensions[0]*this.dimensions[1]*this.dimensions[2],y||(y=YE.newInstance(),y.setDimensions(i),y.setSpacing(a),y.setDirection(s),y.setOrigin(o)),y.set({dataType:c,voxelManager:this.voxelManager,id:l,numberOfComponents:p||1},this.suppressWarnings),y.set({hasScalarVolume:!1},this.suppressWarnings),this.imageData=y,this.numFrames=this._getNumFrames(),this._reprocessImageIds(),r&&(this.scaling=r),u&&(this.referencedVolumeId=u),d&&(this.referencedImageIds=d),h&&(this.additionalDetails=h)}get sizeInBytes(){return this.voxelManager.sizeInBytes}get imageIds(){return this._imageIds}set imageIds(e){this._imageIds=e,this._reprocessImageIds()}_reprocessImageIds(){this._imageIdsIndexMap.clear(),this._imageURIsIndexMap.clear(),this._imageIds.forEach((e,n)=>{const r=ma(e);this._imageIdsIndexMap.set(e,n),this._imageURIsIndexMap.set(r,n)})}isDynamicVolume(){return this.numTimePoints>1}getImageIdIndex(e){return this._imageIdsIndexMap.get(e)}getImageIdByIndex(e){return this._imageIds[e]}getImageURIIndex(e){return this._imageURIsIndexMap.get(e)}load(e){}destroy(){this.imageData.delete(),this.imageData=null,this.voxelManager.clear(),this.vtkOpenGLTexture.releaseGraphicsResources(),this.vtkOpenGLTexture.delete()}invalidate(){for(let e=0;e<this.imageIds.length;e++)this.vtkOpenGLTexture.setUpdatedFrame(e);this.imageData.modified()}modified(){this.imageData.modified(),this.vtkOpenGLTexture.modified(),this.numFrames=this._getNumFrames()}removeFromCache(){Ct.removeVolumeLoadObject(this.volumeId)}getScalarDataLength(){return this.voxelManager.getScalarDataLength()}_getNumFrames(){return this.isDynamicVolume()?this.numTimePoints:this.imageIds.length}imageIdIndexToFrameIndex(e){return e%this.numFrames}getCornerstoneImages(){const{imageIds:e}=this;return e.map(n=>Ct.getImage(n))}}const pd=[];function L2(t,e=0){let n;for(n=0;n<pd.length&&!(pd[n].priority<=e);n++);pd.splice(n,0,{priority:e,provider:t})}function ADt(t){for(let e=0;e<pd.length;e++)if(pd[e].provider===t){pd.splice(e,1);break}}function LDt(){for(;pd.length>0;)pd.pop()}function Ot(t,...e){for(let n=0;n<pd.length;n++){const r=pd[n].provider(t,...e);if(r!==void 0)return r}}const VDt=Object.freeze(Object.defineProperty({__proto__:null,addProvider:L2,get:Ot,removeAllProviders:LDt,removeProvider:ADt},Symbol.toStringTag,{value:"Module"}));let a5={};const e9={add:(t,e)=>{e9.addRaw(t,{...e,metadata:structuredClone(e.metadata)})},addRaw:(t,e)=>{const n=e.type;a5[t]||(a5[t]={}),a5[t][n]=e.metadata},get:(t,e)=>a5[e]?.[t],clear:()=>{a5={}}};L2(e9.get);const Dd=new SU("imageLoadPool");Dd.grabDelay=0;Dd.setMaxSimultaneousRequests(In.Interaction,1e3);Dd.setMaxSimultaneousRequests(In.Thumbnail,1e3);Dd.setMaxSimultaneousRequests(In.Prefetch,1e3);const $be={};let $Dt;function jbe(t,e){const n=Ct.getImageLoadObject(t);if(n)return bte(n.promise,t),n;const r=t.split(":")[0],i=$be[r]||$Dt;if(!i)throw new Error(`loadImageFromImageLoader: No image loader found for scheme '${r}'`);const a=i(t,e);return bte(a.promise,t),a}function bte(t,e){Promise.resolve(t).then(n=>{jDt(n),dt(pt,it.IMAGE_LOADED,{image:n})}).catch(n=>{const r={imageId:e,error:n};dt(pt,it.IMAGE_LOAD_FAILED,r)})}function jDt(t){if(!t.voxelManager){const{width:e,height:n,numberOfComponents:r}=t,i=oi.createImageVoxelManager({scalarData:t.getPixelData(),width:e,height:n,numberOfComponents:r});t.voxelManager=i,t.getPixelData=()=>i.getScalarData(),delete t.imageFrame.pixelData}}function UDt(t,e={priority:0,requestType:"prefetch"}){if(t===void 0)throw new Error("loadImage: parameter imageId must not be undefined");return jbe(t,e).promise}function d1(t,e={priority:0,requestType:"prefetch"}){if(t===void 0)throw new Error("loadAndCacheImage: parameter imageId must not be undefined");const n=jbe(t,e);return Ct.getImageLoadObject(t)||Ct.putImageLoadObject(t,n),n.promise}function FDt(t,e){const{scalarData:n,origin:r,direction:i,targetBuffer:a,skipCreateBuffer:o,onCacheAdd:s,frameOfReferenceUID:c,voxelRepresentation:l,referencedImageId:u}=e,f=e.dimensions,d=e.spacing;if(!f||!d)throw new Error("createAndCacheLocalImage: dimensions and spacing are required");const h=f[0],m=f[1],p=d[0],y=d[1],x={frameOfReferenceUID:c,rows:m,columns:h,imageOrientationPatient:i??[1,0,0,0,1,0],rowCosines:i?i.slice(0,3):[1,0,0],columnCosines:i?i.slice(3,6):[0,1,0],imagePositionPatient:r??[0,0,0],pixelSpacing:[y,p],rowPixelSpacing:y,columnPixelSpacing:p},S=h*m,C=n.length/S;let _;if(n){if(!(n instanceof Uint8Array||n instanceof Float32Array||n instanceof Uint16Array||n instanceof Int16Array))throw new Error("createAndCacheLocalImage: scalarData must be of type Uint8Array, Uint16Array, Int16Array or Float32Array");_=n}else if(!o){const{TypedArrayConstructor:oe}=wbe(a?.type,S);_=new oe(S)}let T,O,M;if(_ instanceof Uint8Array)T=8,O=8,M=7;else if(_ instanceof Uint16Array)T=16,O=16,M=15;else if(_ instanceof Int16Array)T=16,O=16,M=15;else if(_ instanceof Float32Array)T=32,O=32,M=31;else throw new Error("Unsupported scalarData type");const I={samplesPerPixel:1,photometricInterpretation:_.length>f[0]*f[1]?"RGB":"MONOCHROME2",rows:m,columns:h,bitsAllocated:T,bitsStored:O,highBit:M},V={imagePlaneModule:x,imagePixelModule:I};["imagePlaneModule","imagePixelModule"].forEach(oe=>{e9.add(t,{type:oe,metadata:V[oe]||{}})});const k=t,L=l===DT.RLE&&oi.createRLEImageVoxelManager({dimensions:f,id:k})||oi.createImageVoxelManager({height:m,width:h,numberOfComponents:C,scalarData:_,id:k});let $=_[0],W=_[0];for(let oe=1;oe<_.length;oe++)_[oe]<$&&($=_[oe]),_[oe]>W&&(W=_[oe]);const G={imageId:t,intercept:0,windowCenter:0,windowWidth:0,color:I.photometricInterpretation==="RGB",numberOfComponents:I.samplesPerPixel,dataType:a?.type,slope:1,minPixelValue:$,maxPixelValue:W,rows:I.rows,columns:I.columns,getCanvas:void 0,height:I.rows,width:I.columns,rgba:void 0,columnPixelSpacing:x.columnPixelSpacing,rowPixelSpacing:x.rowPixelSpacing,FrameOfReferenceUID:x.frameOfReferenceUID,invert:!1,getPixelData:()=>L.getScalarData(),voxelManager:L,sizeInBytes:n.byteLength,referencedImageId:u};return s?.(G),Ct.putImageSync(G.imageId,G),G}function BC(t,e){$be[t]=e}function Ube(t){const e=t[0],{pixelRepresentation:n,bitsAllocated:r,bitsStored:i,highBit:a,photometricInterpretation:o,samplesPerPixel:s}=Ot("imagePixelModule",e),c=[],l=Ot("voiLutModule",e);let u;if(l){const{windowWidth:S,windowCenter:C}=l;if(u=l?.voiLUTFunction,Array.isArray(S))for(let _=0;_<S.length;_++)c.push({windowWidth:S[_],windowCenter:C[_]});else c.push({windowWidth:S,windowCenter:C})}else c.push({windowWidth:void 0,windowCenter:void 0});const{modality:f,seriesInstanceUID:d}=Ot("generalSeriesModule",e),{imageOrientationPatient:h,pixelSpacing:m,frameOfReferenceUID:p,columns:y,rows:x}=Ot("imagePlaneModule",e);return{BitsAllocated:r,BitsStored:i,SamplesPerPixel:s,HighBit:a,PhotometricInterpretation:o,PixelRepresentation:n,Modality:f,ImageOrientationPatient:h,PixelSpacing:m,FrameOfReferenceUID:p,Columns:y,Rows:x,voiLut:c,VOILUTFunction:u,SeriesInstanceUID:d}}function Fbe(t){const{imagePositionPatient:e,imageOrientationPatient:n}=Ot("imagePlaneModule",t[0]),r=Zn(n[0],n[1],n[2]),i=Zn(n[3],n[4],n[5]),a=ut();Tr(a,r,i);const o=Zn(e[0],e[1],e[2]),s=t[0].split(":")[0]==="wadouri";let c;function l(h){const{imagePositionPatient:m}=Ot("imagePlaneModule",h),p=ut(),y=Zn(m[0],m[1],m[2]);return yr(p,o,y),Vt(p,a)}if(s){const h=[t[0],t[Math.floor(t.length/2)]];l(h[0]),l(h[1]);const m=Ot("imagePlaneModule",h[1]);if(!m)throw new Error("Incomplete metadata required for volume construction.");const p=ut(),y=Zn(m.imagePositionPatient[0],m.imagePositionPatient[1],m.imagePositionPatient[2]);yr(p,o,y);const x=Vt(p,a);c=Math.abs(x)/Math.floor(t.length/2)}else{const h=t.map(p=>({distance:l(p),imageId:p}));h.sort((p,y)=>y.distance-p.distance);const m=h.length;c=Math.abs(h[m-1].distance-h[0].distance)/(m-1)}const{sliceThickness:u,spacingBetweenSlices:f}=Ot("imagePlaneModule",t[0]),{strictZSpacingForVolumeViewport:d}=mf().rendering;return(c===0||isNaN(c))&&!d&&(f?(console.debug("Could not calculate spacing. Using spacingBetweenSlices"),c=f):u?(console.debug("Could not calculate spacing and no spacingBetweenSlices. Using sliceThickness"),c=u):(console.debug("Could not calculate spacing. The VolumeViewport visualization is compromised. Setting spacing to 1 to render"),c=1)),c}function Bbe(t,e){const{imagePositionPatient:n,imageOrientationPatient:r}=Ot("imagePlaneModule",t[0]);if(!e){const u=Zn(r[0],r[1],r[2]),f=Zn(r[3],r[4],r[5]);e=ut(),Tr(e,u,f)}const i=t[0].split(":")[0]==="wadouri",a=Fbe(t);let o;function s(u){const{imagePositionPatient:f}=Ot("imagePlaneModule",u),d=ut();return yr(d,n,f),Vt(d,e)}if(i){const u=[t[0],t[Math.floor(t.length/2)]];o=t;const f=s(u[0]),d=s(u[1]);f-d<0&&o.reverse()}else{const u=t.map(f=>({distance:s(f),imageId:f}));u.sort((f,d)=>d.distance-f.distance),o=u.map(f=>f.imageId)}const{imagePositionPatient:c}=Ot("imagePlaneModule",o[0]);return{zSpacing:a,origin:c,sortedImageIds:o}}function zbe(t){const e=Ot("modalityLutModule",t)||{},n=Ot("generalSeriesModule",t)||{},{modality:r}=n,i={rescaleSlope:e.rescaleSlope||1,rescaleIntercept:e.rescaleIntercept??0,modality:r},a=Ot("scalingModule",t)||{};return{...i,...r==="PT"&&{suvbw:a.suvbw,suvbsa:a.suvbsa,suvlbm:a.suvlbm},...r==="RTDOSE"&&{doseGridScaling:a.DoseGridScaling,doseSummation:a.DoseSummation,doseType:a.DoseType,doseUnit:a.DoseUnit}}}const OF=t=>Object.values(t).some(n=>typeof n=="number"&&!Number.isInteger(n)),Ste={Uint8Array:"Uint8Array",Int16Array:"Int16Array",Uint16Array:"Uint16Array",Float32Array:"Float32Array"};function DF(t,e){const n=Ube(t),{ImageOrientationPatient:r,PixelSpacing:i,Columns:a,Rows:o}=n,s=Zn(r[0],r[1],r[2]),c=Zn(r[3],r[4],r[5]),l=ut();Tr(l,s,c);const{zSpacing:u,origin:f,sortedImageIds:d}=Bbe(t,l),h=t.length,m=[i[1],i[0],u],p=[a,o,h].map(x=>Math.floor(x)),y=[...s,...c,...l];return{dimensions:p,spacing:m,origin:f,dataType:BDt(d,n),direction:y,metadata:n,imageIds:d,volumeId:e,voxelManager:null,numberOfComponents:n.PhotometricInterpretation==="RGB"?3:1}}function BDt(t,e){const{BitsAllocated:n,PixelRepresentation:r}=e,i=r===1,a=zDt(t);if(a)return a;const[o,s,c]=[0,Math.floor(t.length/2),t.length-1],l=[o,s,c].map(h=>zbe(t[h])),u=l.some(h=>h.rescaleIntercept<0||h.rescaleSlope<0),f=l.some(h=>OF(h)),d=CU();switch(n){case 8:return"Uint8Array";case 16:return d&&f?"Float32Array":i||u?"Int16Array":!i&&!u?"Uint16Array":"Float32Array";case 24:return"Uint8Array";case 32:return"Float32Array";case 64:return"Float64Array";default:throw new Error(`Bits allocated of ${n} is not defined to generate scalarData for the volume.`)}}function zDt(t){const n=[0,Math.floor(t.length/2),t.length-1].map(i=>Ct.getImage(t[i]));if(!n.every(Boolean))return null;const r=n[0].getPixelData().constructor.name;return n.every(i=>i.getPixelData().constructor.name===r)&&r in Ste?Ste[r]:null}let JT=class Gbe{constructor(e){this.name=e||"unknown"}static as(e){if(e.iterator)return e.iterator;const n=new Gbe("as iterator");return e.then(r=>{try{n.add(r,!0)}catch(i){n.reject(i)}},r=>{n.reject(r)}),n}add(e,n=!1){this.nextValue=e,this.done||=n,this.waiting&&(this.waiting.resolve(e),this.waiting=void 0)}resolve(){this.done=!0,this.waiting&&(this.waiting.resolve(this.nextValue),this.waiting=void 0)}reject(e){this.rejectReason=e,this.waiting?.reject(e)}getRecent(){if(this.rejectReason)throw this.rejectReason;return this.nextValue}async*[Symbol.asyncIterator](){for(;!this.done;){if(this.rejectReason)throw this.rejectReason;if(this.nextValue!==void 0&&(yield this.nextValue,this.done))break;this.waiting||(this.waiting={},this.waiting.promise=new Promise((e,n)=>{this.waiting.resolve=e,this.waiting.reject=n})),await this.waiting.promise}yield this.nextValue}async forEach(e,n){let r=0;try{for await(const i of this){const{done:a}=this;try{await e(i,a,r),r++}catch(o){if(!a){console.warn("Caught exception in intermediate value",o);continue}if(n)n(o,a);else throw o}}}catch(i){if(n)n(i,!0);else throw i}}generate(e,n){return e(this,this.reject.bind(this)).then(()=>{this.done||this.resolve()},r=>{this.reject(r),n?n(r):console.warn("Couldn't process because",r)})}async nextPromise(){for await(const e of this)if(e)return e;return this.nextValue}async donePromise(){for await(const e of this);return this.nextValue}getNextPromise(){const e=this.nextPromise();return e.iterator=this,e}getDonePromise(){const e=this.donePromise();return e.iterator=this,e}};const Sv=new Map,Cte="imageRetrieveConfiguration",Hy={IMAGE_RETRIEVE_CONFIGURATION:Cte,clear:()=>{Sv.clear()},add:(t,e)=>{Sv.set(t,e)},clone:()=>new Map(Sv),restore:t=>{Sv.clear(),t.forEach((e,n)=>{Sv.set(n,e)})},get:(t,...e)=>{if(t===Cte)return e.map(n=>Sv.get(n)).find(n=>n!==void 0)}};L2(Hy.get.bind(Hy));function t9(t){const e=Ld(),n=[];return e.forEach(r=>{const a=r.getVolumeViewports().filter(o=>o.hasVolumeId(t));n.push(...a)}),n}const yk=t=>{const e=GDt(t);e?.length&&e.forEach(({renderingEngine:n,viewportIds:r})=>{n.hasBeenDestroyed||n.renderViewports(r)})};function GDt(t){const e=Ld(),n=[];return e.forEach(r=>{const i=t9(t);i.length&&n.push({renderingEngine:r,viewportIds:i.map(a=>a.id)})}),n}const _te=[{id:"initialImages",retrieveType:"single"}],WDt=[{id:"lossySequential",retrieveType:"singleFast"},{id:"finalSequential",retrieveType:"singleFinal"}],zR=[{offset:-1,imageQualityStatus:yl.ADJACENT_REPLICATE},{offset:1,imageQualityStatus:yl.ADJACENT_REPLICATE},{offset:2,imageQualityStatus:yl.FAR_REPLICATE}],HDt=[{id:"initialImages",positions:[.5,0,-1],retrieveType:"default",requestType:In.Thumbnail,priority:5,nearbyFrames:zR},{id:"quarterThumb",decimate:4,offset:3,requestType:In.Thumbnail,retrieveType:"multipleFast",priority:6,nearbyFrames:zR},{id:"halfThumb",decimate:4,offset:1,priority:7,requestType:In.Thumbnail,retrieveType:"multipleFast",nearbyFrames:zR},{id:"quarterFull",decimate:4,offset:2,priority:8,requestType:In.Thumbnail,retrieveType:"multipleFinal"},{id:"halfFull",decimate:4,offset:0,priority:9,requestType:In.Thumbnail,retrieveType:"multipleFinal"},{id:"threeQuarterFull",decimate:4,offset:1,priority:10,requestType:In.Thumbnail,retrieveType:"multipleFinal"},{id:"finalFull",decimate:4,offset:3,priority:11,requestType:In.Thumbnail,retrieveType:"multipleFinal"},{id:"errorRetrieve"}];function Wbe(t,e,n=0){const r=[];for(let i=n;i<t.length;i+=e)r.push(i);return r}function qDt(t,e,n){if(e?.nearbyRequests?.length)for(const r of e.nearbyRequests)try{const{itemId:i,imageQualityStatus:a}=r,o=Ct.getImageQuality(i);if(o!==void 0&&o>=a)continue;const s={...n,imageId:i,imageQualityStatus:a};Ct.setPartialImage(i,s),t.successCallback(i,s)}catch(i){console.warn("Couldn't fill nearby item ",r.itemId,i)}}const Zv=class Zv{constructor(e){this.stages=e.stages||_te,this.retrieveOptions=e.retrieveOptions||{}}loadImages(e,n){return new KDt(this,e,n).loadImages()}};Zv.createProgressive=Hbe,Zv.interleavedRetrieveStages={stages:HDt},Zv.singleRetrieveStages={stages:_te},Zv.sequentialRetrieveStages={stages:WDt};let e6=Zv;class KDt{constructor(e,n,r){this.outstandingRequests=0,this.stageStatusMap=new Map,this.displayedIterator=new JT("displayed"),this.stages=e.stages,this.retrieveOptions=e.retrieveOptions,this.imageIds=n,this.listener=r}async loadImages(){const e=this.createStageRequests();this.outstandingRequests=e.length;for(const n of e)this.addRequest(n);return this.outstandingRequests===0?Promise.resolve(null):this.displayedIterator.getDonePromise()}sendRequest(e,n){const{imageId:r,next:i}=e,a=(u,f)=>{this.listener.errorCallback(r,c||!i,u),f&&this.updateStageStatus(e.stage,u)},o=(n.loader||d1)(r,n),s=JT.as(o);let c=!1;return s.forEach(async(u,f)=>{const d=Ct.getImageQuality(r);if(!u){console.warn("No image retrieved",r);return}const{imageQualityStatus:h}=u;if(c||=h===yl.FULL_RESOLUTION,d!==void 0&&d>h){this.updateStageStatus(e.stage,null,!0);return}this.listener.successCallback(r,u),this.displayedIterator.add(u),f&&this.updateStageStatus(e.stage),qDt(this.listener,e,u)},a).finally(()=>{if(!c&&i)Ct.setPartialImage(r),this.addRequest(i,n.streamingData);else{c||this.listener.errorCallback(r,!0,"Couldn't decode"),this.outstandingRequests--;for(let u=i;u;u=u.next)this.updateStageStatus(u.stage,null,!0)}this.outstandingRequests<=0&&this.displayedIterator.resolve()}),s.getDonePromise().catch(u=>null)}addRequest(e,n={}){const{imageId:r,stage:i}=e,a=this.listener.getLoaderImageOptions(r);if(!a)return;const{retrieveType:o="default"}=i,{retrieveOptions:s}=this,c=s[o]||s.default,l={...a,retrieveType:o,retrieveOptions:c,streamingData:n},u=i.priority??-5,f=i.requestType||In.Interaction,d={imageId:r};Dd.addRequest(this.sendRequest.bind(this,e,l),f,d,u)}updateStageStatus(e,n,r=!1){const{id:i}=e,a=this.stageStatusMap.get(i);if(a&&(a.imageLoadPendingCount--,n?a.imageLoadFailedCount++:r||a.totalImageCount++,!r&&!a.stageStartTime&&(a.stageStartTime=Date.now()),!a.imageLoadPendingCount)){const{imageLoadFailedCount:o,totalImageCount:s,stageStartTime:c=Date.now(),startTime:l}=a,u={stageId:i,numberOfFailures:o,numberOfImages:s,stageDurationInMS:c?Date.now()-c:null,startDurationInMS:Date.now()-l};dt(pt,it.IMAGE_RETRIEVAL_STAGE,u),this.stageStatusMap.delete(i)}}createStageRequests(){const e=new Array,n=new Map,r=(i,a)=>{const o=a<0?this.imageIds.length+a:a<1?Math.floor((this.imageIds.length-1)*a):a,s=this.imageIds[o];if(!s)throw new Error(`No value found to add to requests at ${a}`);const c={imageId:s,stage:i,index:o,nearbyRequests:this.findNearbyRequests(o,i)};this.addStageStatus(i);const l=n.get(s);l?l.next=c:e.push(c),n.set(s,c)};for(const i of this.stages)(i.positions||Wbe(this.imageIds,i.decimate||1,i.offset??0)).forEach(o=>{r(i,o)});return e}findNearbyRequests(e,n){const r=new Array;if(!n.nearbyFrames)return r;for(const i of n.nearbyFrames){const a=e+i.offset;a<0||a>=this.imageIds.length||r.push({itemId:this.imageIds[a],imageQualityStatus:i.imageQualityStatus,index:a})}return r}addStageStatus(e){const{id:n}=e,r=this.stageStatusMap.get(n)||{stageId:n,startTime:Date.now(),stageStartTime:null,totalImageCount:0,imageLoadFailedCount:0,imageLoadPendingCount:0};return r.imageLoadPendingCount++,this.stageStatusMap.set(n,r),r}}function Hbe(t){return new e6(t)}const Tte=In.Prefetch;class YDt extends JE{constructor(e,n){super(e),this.framesLoaded=0,this.framesProcessed=0,this.framesUpdated=0,this.autoRenderOnLoad=!0,this.cachedFrames=[],this.reRenderTarget=0,this.reRenderFraction=2,this.imagesLoader=this,this.cancelLoading=()=>{const{loadStatus:r}=this;if(!r||!r.loading)return;r.loading=!1,r.cancelled=!0,this.clearLoadCallbacks();const i=({additionalDetails:a})=>a.volumeId!==this.volumeId;Dd.filterRequests(i)},this.loadStatus=n.loadStatus}invalidateVolume(e){const{vtkOpenGLTexture:n}=this,{numFrames:r}=this;for(let i=0;i<r;i++)n.setUpdatedFrame(i);this.modified(),e&&yk(this.volumeId)}clearLoadCallbacks(){this.loadStatus.callbacks=[]}callLoadStatusCallback(e){const{framesUpdated:n,framesProcessed:r,totalNumFrames:i}=e,{volumeId:a,reRenderFraction:o,loadStatus:s,metadata:c}=this,{FrameOfReferenceUID:l}=c;if(this.autoRenderOnLoad&&(n>this.reRenderTarget||r===i)&&(this.reRenderTarget+=o,yk(a)),r===i){s.callbacks.forEach(f=>f(e));const u={FrameOfReferenceUID:l,volumeId:a};dt(pt,it.IMAGE_VOLUME_LOADING_COMPLETED,u)}}updateTextureAndTriggerEvents(e,n,r=yl.FULL_RESOLUTION){const i=this.imageIdIndexToFrameIndex(e),{cachedFrames:a,numFrames:o,totalNumFrames:s}=this,{FrameOfReferenceUID:c}=this.metadata;if(a[i]>r||a[i]===yl.FULL_RESOLUTION)return;const u=r===yl.FULL_RESOLUTION;a[e]=r,this.framesUpdated++,u&&(this.framesLoaded++,this.framesProcessed++);const f={FrameOfReferenceUID:c,volumeId:this.volumeId,numberOfFrames:o,framesProcessed:this.framesProcessed};dt(pt,it.IMAGE_VOLUME_MODIFIED,f),u&&this.framesProcessed===this.totalNumFrames&&(this.loadStatus.loaded=!0,this.loadStatus.loading=!1),this.callLoadStatusCallback({success:!0,imageIdIndex:e,imageId:n,framesLoaded:this.framesLoaded,framesProcessed:this.framesProcessed,framesUpdated:this.framesUpdated,numFrames:o,totalNumFrames:s,complete:u,imageQualityStatus:r}),this.vtkOpenGLTexture.setUpdatedFrame(i),this.loadStatus.loaded&&(this.loadStatus.callbacks=[])}successCallback(e,n){const r=this.getImageIdIndex(e),{imageQualityStatus:i}=n;if(this.loadStatus.cancelled){console.warn("volume load cancelled, returning for imageIdIndex: ",r);return}this.updateTextureAndTriggerEvents(r,e,i),this.isDynamicVolume()&&this.checkDimensionGroupCompletion(r)}errorCallback(e,n,r){if(!n)return;const{totalNumFrames:i,numFrames:a}=this,o=this.getImageIdIndex(e);this.framesProcessed++,this.framesProcessed===i&&(this.loadStatus.loaded=!0,this.loadStatus.loading=!1),this.callLoadStatusCallback({success:!1,imageId:e,imageIdIndex:o,error:r,framesLoaded:this.framesLoaded,framesProcessed:this.framesProcessed,framesUpdated:this.framesUpdated,numFrames:a,totalNumFrames:i}),this.loadStatus.loaded&&(this.loadStatus.callbacks=[]);const s={error:r,imageIdIndex:o,imageId:e};dt(pt,it.IMAGE_LOAD_ERROR,s)}load(e){const{imageIds:n,loadStatus:r,numFrames:i}=this,{transferSyntaxUID:a}=Ot("transferSyntax",n[0])||{},o=Ot(Hy.IMAGE_RETRIEVE_CONFIGURATION,this.volumeId,a,"volume");if(this.imagesLoader=this.isDynamicVolume()?this:o?(o.create||e6.createProgressive)(o):this,r.loading===!0)return;const{loaded:s}=this.loadStatus,c=n.length;if(s){e&&e({success:!0,framesLoaded:c,framesProcessed:c,numFrames:i,totalNumFrames:c});return}e&&this.loadStatus.callbacks.push(e),this._prefetchImageIds()}getLoaderImageOptions(e){const{transferSyntaxUID:n}=Ot("transferSyntax",e)||{},r=Ot("imagePlaneModule",e)||{},{rows:i,columns:a}=r,o=this.getImageIdIndex(e),s=Ot("modalityLutModule",e)||{},c=Ot("generalSeriesModule",e)||{},l={rescaleSlope:s.rescaleSlope,rescaleIntercept:s.rescaleIntercept,modality:c.modality},u=l.modality;if(u==="PT"||u==="RTDOSE"){const m=Ot("scalingModule",e);m&&(this._addScalingToVolume(m),Object.assign(l,m))}const f=OF(l),d=CU();if(this.isPreScaled=!0,l&&l.rescaleSlope!==void 0&&l.rescaleIntercept!==void 0){const{rescaleSlope:m,rescaleIntercept:p}=l;this.isPreScaled=typeof m=="number"&&typeof p=="number"}return!d&&f&&(this.isPreScaled=!1),{targetBuffer:{type:this.dataType,rows:i,columns:a},allowFloatRendering:d,preScale:{enabled:this.isPreScaled,scalingParameters:l},transferPixelData:!0,requestType:Tte,transferSyntaxUID:n,additionalDetails:{imageId:e,imageIdIndex:o,volumeId:this.volumeId},retrieveOptions:void 0}}callLoadImage(e,n,r){const{cachedFrames:i}=this;if(i[n]===yl.FULL_RESOLUTION)return;const a=s=>{const{image:c}=s.detail;c.imageId===e&&(this.vtkOpenGLTexture.setUpdatedFrame(n),pt.removeEventListener(it.IMAGE_CACHE_IMAGE_ADDED,a))};return pt.addEventListener(it.IMAGE_CACHE_IMAGE_ADDED,a),JT.as(d1(e,r)).forEach(s=>{this.successCallback(e,s)},this.errorCallback.bind(this,n,e))}getImageIdsRequests(e,n){this.totalNumFrames=this.imageIds.length;const r=2;return this.autoRenderOnLoad&&(this.reRenderFraction=this.totalNumFrames*(r/100),this.reRenderTarget=this.reRenderFraction),e.map(a=>{const o=this.getImageIdIndex(a),s=Tte,c=n,l=this.getLoaderImageOptions(a),{retrieveOptions:u={}}=Ot(Hy.IMAGE_RETRIEVE_CONFIGURATION,a,"volume")||{};return l.retrieveOptions={...l.retrieveOptions,...u.default||Object.values(u)?.[0]||{}},{callLoadImage:this.callLoadImage.bind(this),imageId:a,imageIdIndex:o,options:l,priority:c,requestType:s,additionalDetails:{volumeId:this.volumeId}}})}getImageLoadRequests(e){throw new Error("Abstract method")}getImageIdsToLoad(){throw new Error("Abstract method")}loadImages(){return this.loadStatus.loading=!0,this.getImageLoadRequests(5).reverse().forEach(n=>{if(!n)return;const{callLoadImage:r,imageId:i,imageIdIndex:a,options:o,priority:s,requestType:c,additionalDetails:l}=n;Dd.addRequest(r.bind(this,i,a,o),c,l,s)}),Promise.resolve(!0)}_prefetchImageIds(){this.loadStatus.loading=!0;const e=[...this.getImageIdsToLoad()];this.totalNumFrames=this.imageIds.length;const n=2;return this.autoRenderOnLoad&&(this.reRenderFraction=this.totalNumFrames*(n/100),this.reRenderTarget=this.reRenderFraction),this.imagesLoader.loadImages(e,this).catch(r=>{console.debug("progressive loading failed to complete",r)})}_addScalingToVolume(e){if(this.scaling)return;const{suvbw:n,suvlbm:r,suvbsa:i}=e,a={};r&&(a.suvbwToSuvlbm=r/n),i&&(a.suvbwToSuvbsa=i/n),n&&(a.suvbw=n),this.scaling={PT:a}}checkDimensionGroupCompletion(e){}}class XDt extends YDt{constructor(e,n){e.imageIds||(e.imageIds=n.imageIds),super(e,n),this.getImageIdsToLoad=()=>{const{imageIds:r}=this;return this.numFrames=r.length,r}}getScalarData(){return this.voxelManager.getScalarData()}getImageLoadRequests(e){const{imageIds:n}=this;return this.getImageIdsRequests(n,e)}}function ZDt(t,e){if(!e||!e.imageIds||!e.imageIds.length)throw new Error("ImageIds must be provided to create a streaming image volume");async function n(){if(e.imageIds[0].split(":")[0]==="wadouri"){const[m,p]=[Math.floor(e.imageIds.length/2),e.imageIds.length-1],y=[0,m,p];await Promise.all(y.map(x=>Ct.isLoaded(e.imageIds[x])?Promise.resolve(!0):new Promise((S,C)=>{const _=e.imageIds[x];Dd.addRequest(async()=>{UDt(_).then(()=>{console.log(`Prefetched imageId: ${_}`),S(!0)}).catch(T=>{C(T)})},In.Prefetch,{volumeId:t},1)}))).catch(console.error)}const i=DF(e.imageIds,t),{dimensions:a,spacing:o,origin:s,direction:c,metadata:l,imageIds:u,dataType:f,numberOfComponents:d}=i;return new XDt({volumeId:t,metadata:l,dimensions:a,spacing:o,origin:s,direction:c,imageIds:u,dataType:f,numberOfComponents:d},{imageIds:u,loadStatus:{loaded:!1,loading:!1,cancelled:!1,cachedFrames:[],callbacks:[]}})}const r=n();return{promise:r,decache:()=>{r.then(i=>{i.destroy(),i=null})},cancel:()=>{r.then(i=>{i.cancelLoading()})}}}const qbe={};let zC=ZDt;function Kbe(t,e){const n=t.indexOf(":"),r=t.substring(0,n);let i=qbe[r];if(i==null){if(zC==null||typeof zC!="function")throw new Error(`No volume loader for scheme ${r} has been registered`);i=zC}const a=i(t,e);return a.promise.then(function(o){dt(pt,it.VOLUME_LOADED,{volume:o})},function(o){const s={volumeId:t,error:o};dt(pt,it.VOLUME_LOADED_FAILED,s)}),a}function Ybe(t,e={imageIds:[]}){if(t===void 0)throw new Error("loadVolume: parameter volumeId must not be undefined");let n=Ct.getVolumeLoadObject(t);return n!==void 0?n.promise:(n=Kbe(t,e),n.promise.then(r=>r))}async function Xbe(t,e){if(t===void 0)throw new Error("createAndCacheVolume: parameter volumeId must not be undefined");let n=Ct.getVolumeLoadObject(t);return n!==void 0||(n=Kbe(t,e),Ct.putVolumeLoadObject(t,n)),n.promise}async function QDt(t,e){if(e===void 0)throw new Error("createAndCacheVolumeFromImages: parameter imageIds must not be undefined");if(t===void 0)throw new Error("createAndCacheVolumeFromImages: parameter volumeId must not be undefined");const n=Ct.getVolume(t);return n||(e.filter(a=>!Ct.getImage(a)).length===0?JDt(t,e):await Xbe(t,{imageIds:e}))}function JDt(t,e){if(e===void 0)throw new Error("createAndCacheVolumeFromImagesSync: parameter imageIds must not be undefined");if(t===void 0)throw new Error("createAndCacheVolumeFromImagesSync: parameter volumeId must not be undefined");const n=Ct.getVolume(t);if(n)return n;const r=DF(e,t),i=new JE({volumeId:t,dataType:r.dataType,metadata:structuredClone(r.metadata),dimensions:r.dimensions,spacing:r.spacing,origin:r.origin,direction:r.direction,referencedVolumeId:r.referencedVolumeId,imageIds:r.imageIds,referencedImageIds:r.referencedImageIds});return Ct.putVolumeSync(t,i),i}function eMt(t,e={}){const{metadata:n,dimensions:r,spacing:i,origin:a,direction:o,scalarData:s,targetBuffer:c,preventCache:l=!1}=e,u=Ct.getVolume(t);if(u)return u;const f=r[0]*r[1],d=s?s.constructor.name:c?.type??"Float32Array",h=f*r[2];let m;switch(d){case"Uint8Array":case"Int8Array":m=h;break;case"Uint16Array":case"Int16Array":m=h*2;break;case"Float32Array":m=h*4;break}if(!Ct.isCacheable(m))throw new Error(`Cannot created derived volume: Volume with id ${t} is not cacheable.`);const y=[];for(let C=0;C<r[2];C++){const _=`${t}_slice_${C}`;y.push(_);const T=s.subarray(C*f,(C+1)*f);FDt(_,{scalarData:T,dimensions:[r[0],r[1]],spacing:[i[0],i[1]],origin:a,direction:o,targetBuffer:{type:d}})}const x=new JE({volumeId:t,metadata:structuredClone(n),dimensions:[r[0],r[1],r[2]],spacing:i,origin:a,direction:o,imageIds:y,dataType:d}),S=oi.createImageVolumeVoxelManager({imageIds:y,dimensions:r,numberOfComponents:1,id:t});return x.voxelManager=S,l||Ct.putVolumeSync(t,x),x}function tMt(){return Object.keys(qbe)}function nMt(){return zC.name}function rMt(t,e){const n=EDt.newInstance();mf().rendering.preferSizeOverAccuracy&&n.setPreferSizeOverAccuracy(!0),n.setInputData(t);const r=t.getSpacing(),a=(mf().rendering?.volumeRendering?.sampleDistanceMultiplier||1)*(r[0]+r[1]+r[2])/6;return n.setMaximumSamplesPerRay(4e3),n.setSampleDistance(a),n.setScalarTexture(e),n}function iMt(t){const e=kbe.newInstance();e.setBlendMode(t.getBlendMode());const n=t.getInputData(),{voxelManager:r}=n.get("voxelManager"),i=r.getCompleteScalarDataArray(),a=On.newInstance({name:"Pixels",values:i});return n.getPointData().setScalars(a),e.setInputData(n),e.setMaximumSamplesPerRay(t.getMaximumSamplesPerRay()),e.setSampleDistance(t.getSampleDistance()),e}const aMt=0,oMt=In.Prefetch;async function MF(t,e){let n=cMt(e);!n&&e.imageIds.length&&(n=await lMt(e),n=sMt(e,n)),!(n.lower===0&&n.upper===0||n.lower===void 0||n.upper===void 0)&&t.getProperty().getRGBTransferFunction(0).setMappingRange(n.lower,n.upper)}function sMt(t,e){const n=t.imageIds,r=Math.floor(n.length/2),i=n[r],a=Ot("generalSeriesModule",i)||{};return uMt(a.modality,t)?{lower:0,upper:5}:e}function cMt(t){const{imageIds:e,metadata:n}=t;let r;if(e?.length){const i=Math.floor(e.length/2),a=e[i],o=Ot("voiLutModule",a);if(o&&o.windowWidth&&o.windowCenter){o?.voiLUTFunction&&(r={},r.voiLUTFunction=o?.voiLUTFunction);const{windowWidth:s,windowCenter:c}=o,l=Array.isArray(s)?s[0]:s,u=Array.isArray(c)?c[0]:c;l!==0&&(r={windowWidth:l,windowCenter:u})}}else r=n.voiLut[0];if(r&&(r.windowWidth!==0||r.windowCenter!==0)){const{lower:i,upper:a}=gy(Number(r.windowWidth),Number(r.windowCenter),r.voiLUTFunction);return isNaN(i)||isNaN(a)?void 0:{lower:i,upper:a}}}async function lMt(t){const{imageIds:e}=t,n=Math.floor(e.length/2),r=t.imageIds[n],i=Ot("generalSeriesModule",r)||{},{modality:a}=i,o=Ot("modalityLutModule",r)||{},s={rescaleSlope:o.rescaleSlope,rescaleIntercept:o.rescaleIntercept,modality:a};let c;if(a==="PT"){const h=Ot("scalingModule",r);h&&(c={...s,suvbw:h.suvbw})}const l={priority:aMt,requestType:oMt,preScale:{scalingParameters:c}};let u=Ct.getImage(r);t.referencedImageIds?.length||(u=await d1(r,{...l,ignoreCache:!0}));let{min:f,max:d}=u.voxelManager.getMinMax();return f?.length>1&&(f=Math.min(...f),d=Math.max(...d)),{lower:f,upper:d}}function uMt(t,e){return!(t!=="PT"||!e.isPreScaled||!e.scaling?.PT.suvbw)}async function xk(t,e,n,r=!1){const{volumeId:i,callback:a,blendMode:o}=t,s=await Ybe(i);if(!s)throw new Error(`imageVolume with id: ${s.volumeId} does not exist`);const{imageData:c,vtkOpenGLTexture:l}=s,u=rMt(c,l);o&&u.setBlendMode(o);const f=mCt.newInstance();f.setMapper(u);const{numberOfComponents:d}=c.get("numberOfComponents");return f.getProperty().set({viewportId:n},!0),d===3&&f.getProperty().setIndependentComponents(!1),await MF(f,s),a&&a({volumeActor:f,volumeId:i}),r||fMt(e,n,f,i),f}function fMt(t,e,n,r){const i=n.getProperty().getRGBTransferFunction(0).getRange(),a={viewportId:e,range:{lower:i[0],upper:i[1]},volumeId:r};dt(t,it.VOI_MODIFIED,a)}function Zbe(t){const e=t.getMapper().getInputData(),n=e.extentToBounds(e.getExtent());return[[n[0],n[2],n[4]],[n[0],n[2],n[5]],[n[0],n[3],n[4]],[n[0],n[3],n[5]],[n[1],n[2],n[4]],[n[1],n[2],n[5]],[n[1],n[3],n[4]],[n[1],n[3],n[5]]]}const dMt=_u*_u,GR=t=>Math.abs(Math.abs(t)-1)<dMt,WR=(t,e)=>GR(t[e])||GR(t[e+1])||GR(t[e+2]),hMt=t=>WR(t,0)&&WR(t,3)&&WR(t,6);function n9(t,e,n){const r=t.getMapper().getInputData();let i;const a=r.getDirection();if(hMt(a))i=Zbe(t);else{const[f,d,h]=r.getDimensions();i=[[0,0,0],[f-1,0,0],[0,d-1,0],[f-1,d-1,0],[0,0,h-1],[f-1,0,h-1],[0,d-1,h-1],[f-1,d-1,h-1]].map(p=>r.indexToWorld(p))}const o=Em.buildFromDegree().identity().rotateFromDirections(e,[1,0,0]);i.forEach(f=>o.apply(f));const s=[...n];o.apply(s);const c=s[0];let l=1/0,u=-1/0;for(let f=0;f<8;f++){const d=i[f][0];d>u&&(u=d),d<l&&(l=d)}return{min:l,max:u,current:c,actor:t,viewPlaneNormal:e,focalPoint:n}}function b3(t,e){const{direction:n,spacing:r}=t,i=n.slice(0,3),a=n.slice(3,6),o=n.slice(6,9),s=[Vt(i,e),Vt(a,e),Vt(o,e)],c=ut();return _r(c,s[0]*r[0],s[1]*r[1],s[2]*r[2]),ec(c)}const V2=t=>{const e="volumeId:",n=t.includes(e)?t.substring(e.length):t,r=n.indexOf("sliceIndex=");return r===-1?n:n.substring(0,r-1)},gMt=1+_u,pMt=(t,e)=>e===t.substring(0,Math.min(t.length,e.length)),Ete=t=>!!tMt().find(e=>pMt(t.volumeId,e));function S3(t,e,n,r=!1){const{viewPlaneNormal:i}=e,a=t.getActors();if(!a.length)return{spacingInNormalDirection:null,imageVolume:null,actorUID:null};const o=a.map(l=>{const u=l.referencedId??l.uid;return Ct.getVolume(u)}).filter(l=>!!l);if(n){const l=V2(n),u=o.findIndex(m=>l.includes(m.volumeId)),f=o[u],{uid:d}=a[u],h=Ote(f,i,t,r);return{imageVolume:f,spacingInNormalDirection:h,actorUID:d}}if(!o.length)return{spacingInNormalDirection:null,imageVolume:null,actorUID:null};const s={spacingInNormalDirection:1/0,imageVolume:null,actorUID:null},c=o.find(Ete);for(let l=0;l<o.length;l++){const u=o[l];if(c&&!Ete(u))continue;const f=Ote(u,i,t);f*gMt<s.spacingInNormalDirection&&(s.spacingInNormalDirection=f,s.imageVolume=u,s.actorUID=a[l].uid)}return s}function Ote(t,e,n,r=!1){const{slabThickness:i}=n.getProperties();let a=i;return(!i||!r)&&(a=b3(t,e)),a}function t6(t){const e=t.getCamera(),{spacingInNormalDirection:n,imageVolume:r}=S3(t,e);if(!r)return;const{viewPlaneNormal:i,focalPoint:a}=e,o=t.getActors().find(m=>m.referencedId===r.volumeId||m.uid===r.volumeId);o||console.warn("No actor found for with actorUID of",r.volumeId);const s=o.actor,c=n9(s,i,a),{min:l,max:u,current:f}=c,d=Math.round((u-l)/n)+1;let h=(f-l)/(u-l)*d;return h=Math.floor(h),h>d-1?h=d-1:h<0&&(h=0),{numberOfSlices:d,imageIndex:h}}const Hv={};function mMt(t){Hv[t]!==void 0&&delete Hv[t]}function vMt(t){const{renderingEngineId:e,viewportId:n}=t.detail,i=O1(e).getViewport(n);if(!("setVolumes"in i))throw new Error("volumeNewImageEventDispatcher: viewport does not have setVolumes method");Hv[i.id]===void 0&&(Hv[i.id]=0);const a=t6(i);if(!a){console.warn(`volumeNewImageEventDispatcher: sliceData is undefined for viewport ${i.id}`);return}const{numberOfSlices:o,imageIndex:s}=a;if(Hv[i.id]===s)return;Hv[i.id]=s;const c={imageIndex:s,viewportId:n,renderingEngineId:e,numberOfSlices:o};dt(i.element,it.VOLUME_NEW_IMAGE,c)}function Qbe(t,e,n){const[r,i,a]=t,[o,s,c]=e,[l,u,f,d]=n,h=o-r,m=s-i,p=c-a,y=-1*(l*r+u*i+f*a-d)/(l*h+u*m+f*p),x=h*y+r,S=m*y+i,C=p*y+a;return[x,S,C]}function Jbe(t,e,n=!1){const[r,i,a]=t,o=r*e[0]+i*e[1]+a*e[2];if(n){const s=Math.sqrt(r*r+i*i+a*a);return[r/s,i/s,a/s,o/s]}return[r,i,a,o]}function yMt(t,e,n){const[r,i,a,o]=t,[s,c,l,u]=e,[f,d,h,m]=n,p=T5(r,s,f,i,c,d,a,l,h),y=T5(o,u,m,i,c,d,a,l,h),x=T5(r,s,f,o,u,m,a,l,h),S=T5(r,s,f,i,c,d,o,u,m),C=am(y)/am(p),_=am(x)/am(p),T=am(S)/am(p);return[C,_,T]}function RF(t,e,n=!1){const[r,i,a,o]=t,[s,c,l]=e,u=r*s+i*c+a*l-o,f=Math.abs(u)/Math.sqrt(r*r+i*i+a*a);return(n?Math.sign(u):1)*f}function xMt(t,e,n=_u){return RF(e,t)<n}const wMt=Object.freeze(Object.defineProperty({__proto__:null,isPointOnPlane:xMt,linePlaneIntersection:Qbe,planeDistanceToPoint:RF,planeEquation:Jbe,threePlaneIntersection:yMt},Symbol.toStringTag,{value:"Module"}));function wk(t){return Array.isArray(t)?t.some(e=>Number.isNaN(e)):Number.isNaN(t)}function rf(t){if(t===null||typeof t!="object"||typeof t=="function"||typeof structuredClone=="function")return t;if(Array.isArray(t))return t.map(rf);{const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=rf(t[n]));return e}}const bMt=.95;function e3e(t,e){if(!t?.length||!e.FrameOfReferenceUID)return;e.planeRestriction||={FrameOfReferenceUID:e.FrameOfReferenceUID,point:t[0],inPlaneVector1:null,inPlaneVector2:null};const{planeRestriction:n}=e;if(t.length===1)return n.inPlaneVector1=null,n.inPlaneVector2=null,n;const r=yr(ut(),t[0],t[Math.floor(t.length/2)]);Vr(r,r),n.inPlaneVector1=r,n.inPlaneVector2=null;const i=t.length;if(i>2)for(let a=Math.floor(i/3);a<i;a++){const o=yr(ut(),t[a],t[0]),s=ec(o);if(!Lr(s,0)&&Vt(o,n.inPlaneVector1)<s*bMt)return Vr(o,o),n.inPlaneVector2=o,n}return n}var Gg;let r9=(Gg=class{constructor(e){this.insetImageMultiplier=mf().rendering?.useLegacyCameraFOV?1.1:1,this.flipHorizontal=!1,this.flipVertical=!1,this.viewportStatus=Ss.NO_DATA,this._suppressCameraModifiedEvents=!1,this.hasPixelSpacing=!0,this.getProperties=()=>({}),this.setRotation=n=>{},this.viewportWidgets=new Map,this.addWidget=(n,r)=>{this.viewportWidgets.set(n,r)},this.getWidget=n=>this.viewportWidgets.get(n),this.getWidgets=()=>Array.from(this.viewportWidgets.values()),this.getRenderPasses=()=>null,this.removeWidgets=()=>{this.getWidgets().forEach(r=>{if(r.getEnabled()&&r.setEnabled(!1),r.getActor&&r.getRenderer){const i=r.getActor(),a=r.getRenderer();a&&i&&a.removeActor(i)}})},this.id=e.id,this.renderingEngineId=e.renderingEngineId,this.type=e.type,this.element=e.element,this.canvas=e.canvas,this.sx=e.sx,this.sy=e.sy,this.sWidth=e.sWidth,this.sHeight=e.sHeight,this._actors=new Map,this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId),this.defaultOptions=rf(e.defaultOptions),this.suppressEvents=e.defaultOptions.suppressEvents?e.defaultOptions.suppressEvents:!1,this.options=rf(e.defaultOptions),this.isDisabled=!1}static get useCustomRenderingPipeline(){return!1}setRendered(){this.viewportStatus===Ss.NO_DATA||this.viewportStatus===Ss.LOADING||(this.viewportStatus=Ss.RENDERED)}setColorTransform(e,n){let r=null;if(!e&&!n)return;const i=n||[255,255,255],a=Math.max(...i),o=i.map(f=>a/f),{lower:s=0,upper:c=255}=e||{},l=(c-s+1)/255,u=s/255;return r=`url('data:image/svg+xml,      <svg xmlns="http://www.w3.org/2000/svg">        <filter id="colour" color-interpolation-filters="linearRGB">        <feColorMatrix type="matrix"         values="          ${o[0]*l} 0 0 0 ${u}           0 ${o[1]*l} 0 0 ${u}           0 0 ${o[2]*l} 0 ${u}           0 0 0 1 0" />        </filter>      </svg>#colour')`,r}getRenderingEngine(){return Ww.get(this.renderingEngineId)}getRenderer(){const e=this.getRenderingEngine();if(!e||e.hasBeenDestroyed)throw new Error("Rendering engine has been destroyed");return e.offscreenMultiRenderWindow?.getRenderer(this.id)}render(){this.getRenderingEngine().renderViewport(this.id)}setOptions(e,n=!1){this.options=structuredClone(e),this.options?.displayArea&&this.setDisplayArea(this.options?.displayArea),n&&this.render()}reset(e=!1){this.options=structuredClone(this.defaultOptions),e&&this.render()}getSliceViewInfo(){throw new Error("Method not implemented.")}flip({flipHorizontal:e,flipVertical:n}){const r=this.getDefaultImageData();if(!r)return;const i=this.getCamera(),{viewPlaneNormal:a,viewUp:o,focalPoint:s,position:c}=i,l=Tr(ut(),a,o);let u=vSt(ut(),o);const f=th(ut(),a),d=Gy(c,s),m=r.getDimensions().map(T=>Math.floor(T/2)),p=[m[0],m[1],m[2]],y=r.indexToWorld(p,ut()),x=this._getFocalPointForResetCamera(y,i,{resetPan:!0,resetToCenter:!1}),S=Xi(ut(),s,x),C=ec(S),_=T=>{const O=gd(ut(),T,2*Vt(S,T));return Xi(O,O,S),Vr(O,O),O};if(e){const T=_(u),O=Ro(ut(),x,T,C),M=Ro(ut(),O,f,d);this.setCamera({viewPlaneNormal:f,position:M,focalPoint:O}),this.flipHorizontal=!this.flipHorizontal}if(n){u=th(u,o);const T=_(l),O=Ro(ut(),x,T,C),M=Ro(ut(),O,f,d);this.setCamera({focalPoint:O,viewPlaneNormal:f,viewUp:u,position:M}),this.flipVertical=!this.flipVertical}this.render()}getDefaultImageData(){const e=this.getDefaultActor();if(e&&nf(e))return e.actor.getMapper().getInputData()}getDefaultActor(){return this.getActors()[0]}getActors(){return Array.from(this._actors.values())}getActorUIDs(){return Array.from(this._actors.keys())}getActor(e){return this._actors.get(e)}getImageActor(e){const n=this.getActors();let r=n[0];return e&&(r=n.find(a=>a.referencedId===e)),!r||!nf(r)?null:r.actor}getActorUIDByIndex(e){const n=this.getActors()[e];if(n)return n.uid}getActorByIndex(e){return this.getActors()[e]}setActors(e){const n=this.getActors();this.removeAllActors(),this.addActors(e,{resetCamera:!0}),dt(this.element,it.ACTORS_CHANGED,{viewportId:this.id,removedActors:n,addedActors:e,currentActors:e})}_removeActor(e){const n=this.getActor(e);if(!n){console.warn(`Actor ${e} does not exist in ${this.id}, can't remove`);return}return this.getRenderer().removeActor(n.actor),this._actors.delete(e),n}removeActors(e){const n=[];e.forEach(i=>{const a=this._removeActor(i);a&&n.push(a)});const r=this.getActors();dt(this.element,it.ACTORS_CHANGED,{viewportId:this.id,removedActors:n,addedActors:[],currentActors:r})}addActors(e,n={}){const{resetCamera:r=!1}=n,i=this.getRenderingEngine();if(!i||i.hasBeenDestroyed){console.warn("Viewport::addActors::Rendering engine has not been initialized or has been destroyed");return}if(e.forEach(a=>{this.addActor(a)}),r)this.resetCamera();else{const a=this.getViewPresentation(),o=this.getViewReference();this.resetCamera(),this.setViewReference(o),this.setViewPresentation(a)}dt(this.element,it.ACTORS_CHANGED,{viewportId:this.id,removedActors:[],addedActors:e,currentActors:this.getActors()})}addActor(e){const{uid:n,actor:r}=e,i=this.getRenderingEngine();if(!i||i.hasBeenDestroyed){console.warn(`Cannot add actor UID of ${n} Rendering Engine has been destroyed`);return}if(!n||!r)throw new Error("Actors should have uid and vtk Actor properties");if(this.getActor(n)){console.warn(`Actor ${n} already exists for this viewport`);return}this.getRenderer()?.addActor(r),this._actors.set(n,Object.assign({},e)),this.updateCameraClippingPlanesAndRange(),dt(this.element,it.ACTORS_CHANGED,{viewportId:this.id,removedActors:[],addedActors:[e],currentActors:this.getActors()})}removeAllActors(){const e=this.getActors();this.getRenderer()?.removeAllViewProps(),this._actors=new Map,dt(this.element,it.ACTORS_CHANGED,{viewportId:this.id,removedActors:e,addedActors:[],currentActors:[]})}resetCameraNoEvent(){const e=this._suppressCameraModifiedEvents;this._suppressCameraModifiedEvents=!0,this.resetCamera(),this._suppressCameraModifiedEvents=e}setCameraNoEvent(e){const n=this._suppressCameraModifiedEvents;this._suppressCameraModifiedEvents=!0,this.setCamera(e),this._suppressCameraModifiedEvents=n}_getViewImageDataIntersections(e,n,r){const i=r[0],a=r[1],o=r[2],s=i*n[0]+a*n[1]+o*n[2],c=e.getBounds(),l=this._getEdges(c),u=[];for(const f of l){const[[d,h,m],[p,y,x]]=f;if(i*(p-d)+a*(y-h)+o*(x-m)===0)continue;const S=Qbe([d,h,m],[p,y,x],[i,a,o,s]);this._isInBounds(S,c)&&u.push(S)}return u}setInterpolationType(e,n){}setDisplayArea(e,n=!1){if(!e)return;const{storeAsInitialCamera:r,type:i}=e;r&&(this.options.displayArea=e);const{_suppressCameraModifiedEvents:a}=this;if(this._suppressCameraModifiedEvents=!0,this.setCamera(this.fitToCanvasCamera),i==="SCALE"?this.setDisplayAreaScale(e):(this.setInterpolationType(this.getProperties()?.interpolationType??G0.LINEAR),this.setDisplayAreaFit(e)),r&&(this.initialCamera=this.getCamera()),this._suppressCameraModifiedEvents=a,!n&&!a){const o={viewportId:this.id,displayArea:e,storeAsInitialCamera:r};dt(this.element,it.DISPLAY_AREA_MODIFIED,o),this.setCamera(this.getCamera())}}setDisplayAreaScale(e){const{scale:n=1}=e,r=this.canvas,i=r.height,a=r.width;if(i<8||a<8)return;const c=this.getDefaultImageData().getSpacing()[1];this.setInterpolationType(G0.NEAREST),this.setCamera({parallelScale:i*c/(2*n)}),delete e.imageArea,this.setDisplayAreaFit(e);const{focalPoint:l,position:u,viewUp:f,viewPlaneNormal:d}=this.getCamera(),h=ut();if(r.height%2&&Ro(h,h,f,n*.5*c),r.width%2){const m=Tr(ut(),f,d);Ro(h,h,m,n*.5*c)}!h[0]&&!h[1]&&!h[2]||this.setCamera({focalPoint:eh(ut(),l,h),position:eh(ut(),u,h)})}setDisplayAreaFit(e){const{imageArea:n,imageCanvasPoint:r}=e,i=window?.devicePixelRatio||1,a=this.getDefaultImageData();if(!a)return;const o=this.sWidth/i,s=this.sHeight/i,c=a.getDimensions(),l=this.worldToCanvas(a.indexToWorld([0,0,0])),u=this.worldToCanvas(a.indexToWorld([c[0],c[1],c[2]])),f=[Math.abs(u[0]-l[0]),Math.abs(u[1]-l[1])],[d,h]=f;let m=this.getZoom()/this.insetImageMultiplier;if(n){const[p,y]=n,x=Math.max(Math.abs(d/o),Math.abs(h/s)),S=Math.abs(p*d/o),C=Math.abs(y*h/s),_=this.getZoom(),T=this.getZoom(this.fitToCanvasCamera);m=(S>C?x/S:x/C)*_/T,this.setZoom(this.insetImageMultiplier*m,!1)}if(r){const{imagePoint:p,canvasPoint:y=p||[.5,.5]}=r,[x,S]=y,C=o*(x-.5),_=s*(S-.5),[T,O]=p||y,M=m,I=this.insetImageMultiplier*M*d*(.5-T),V=this.insetImageMultiplier*M*h*(.5-O),k=I+C,L=V+_,$=[k,L];QU($,$,this.getPan()),this.setPan($,!1)}}getDisplayArea(){return this.options?.displayArea}resetCamera(e){const{resetPan:n=!0,resetZoom:r=!0,resetToCenter:i=!0,storeAsInitialCamera:a=!0}=e||{},o=this.getRenderer();this.setCameraNoEvent({flipHorizontal:!1,flipVertical:!1});const s=this.getCamera();let c;const l=this.getDefaultActor();l&&nf(l)?c=l.actor.getMapper().getInputData().getBounds():c=o.computeVisiblePropBounds();const u=[0,0,0],f=this.getDefaultImageData();if(f){const U=f.getSpacing();c[0]=c[0]+U[0]/2,c[1]=c[1]-U[0]/2,c[2]=c[2]+U[1]/2,c[3]=c[3]-U[1]/2,c[4]=c[4]+U[2]/2,c[5]=c[5]-U[2]/2}const d=this.getVtkActiveCamera(),h=d.getViewPlaneNormal(),m=d.getViewUp();if(u[0]=(c[0]+c[1])/2,u[1]=(c[2]+c[3])/2,u[2]=(c[4]+c[5])/2,f){const Y=f.getDimensions().map(ne=>Math.floor(ne/2)),J=[Y[0],Y[1],Y[2]];f.indexToWorld(J,u)}let p,y;const S=mf().rendering?.useLegacyCameraFOV??!1;if(f&&!S){const U=f.getExtent(),Y=f.getSpacing();p=(U[1]-U[0])*Y[0],y=(U[3]-U[2])*Y[1]}else({widthWorld:p,heightWorld:y}=this._getWorldDistanceViewUpAndViewRight(c,m,h));const C=[this.sWidth,this.sHeight],_=p/y,T=C[0]/C[1],O=_/T,M=O<1?this.insetImageMultiplier*y/2:this.insetImageMultiplier*y*O/2,I=Gg.boundsRadius(c)*(this.type===Rr.VOLUME_3D?10:1),V=this.insetImageMultiplier*I,k=Math.abs(hu.dot(m,h))>.999?[-m[2],m[0],m[1]]:m,L=this._getFocalPointForResetCamera(u,s,{resetPan:n,resetToCenter:i}),$=[L[0]+V*h[0],L[1]+V*h[1],L[2]+V*h[2]];o.resetCameraClippingRange(c);const W=[-Ki.MAXIMUM_RAY_DISTANCE,Ki.MAXIMUM_RAY_DISTANCE];d.setPhysicalScale(I),d.setPhysicalTranslation(-L[0],-L[1],-L[2]),this.setCamera({parallelScale:r?M:s.parallelScale,focalPoint:L,position:$,viewAngle:90,viewUp:k,clippingRange:W});const G=this.getCamera();this.setFitToCanvasCamera(this.getCamera()),a&&this.setInitialCamera(G),r&&this.setZoom(1,a);const oe={type:"ResetCameraEvent",renderer:o};return o.invokeEvent(oe),this.triggerCameraModifiedEventIfNecessary(s,G),f&&this.options.displayArea&&r&&n&&i&&this.setDisplayArea(this.options.displayArea),!0}setInitialCamera(e){this.initialCamera=e}setFitToCanvasCamera(e){this.fitToCanvasCamera=e}getPan(e=this.initialCamera){if(!e)return[0,0];const r=this.getVtkActiveCamera().getFocalPoint(),i=this.canvasToWorld([0,0]),a=this.worldToCanvas(Xi([0,0,0],e.focalPoint,i)),o=this.worldToCanvas(Xi([0,0,0],r,i));return Qo([0,0],a,o)}getCurrentImageIdIndex(){throw new Error("Not implemented")}getSliceIndex(){throw new Error("Not implemented")}getImageData(){throw new Error("Not implemented")}getViewReferenceId(e){return null}setPan(e,n=!1){const r=this.getCamera(),{focalPoint:i,position:a}=r,o=this.canvasToWorld([0,0]),s=Qo([0,0],e,this.getPan());if(Math.abs(s[0])<1&&Math.abs(s[1])<1&&!n)return;const c=Xi(ut(),this.canvasToWorld(s),o),l=Xi(ut(),i,c),u=Xi(ut(),a,c);this.setCamera({...r,focalPoint:l,position:u},n)}getZoom(e=this.initialCamera){if(!e)return 1;const n=this.getVtkActiveCamera(),{parallelScale:r}=e;return r/n.getParallelScale()}setZoom(e,n=!1){const r=this.getCamera(),{parallelScale:i}=this.initialCamera,a=i/e;r.parallelScale===a&&!n||this.setCamera({...r,parallelScale:a},n)}_getFocalPointForViewPlaneReset(e){const{focalPoint:n,viewPlaneNormal:r}=this.getCamera(),i=this._getViewImageDataIntersections(e,n,r);let a=0,o=0,s=0;return i.forEach(([l,u,f])=>{a+=l,o+=u,s+=f}),[a/i.length,o/i.length,s/i.length]}getCanvas(){return this.canvas}getVtkActiveCamera(){const e=this.getRenderer();return e?e.getActiveCamera():(console.warn("No renderer found for the viewport"),null)}getCameraNoRotation(){const e=this.getVtkActiveCamera(),n=(s,c)=>s.some(l=>isNaN(l))?c:s,r=n([...e.getViewUp()],[0,1,0]),i=n([...e.getViewPlaneNormal()],[0,0,-1]),a=n([...e.getPosition()],[0,0,1]),o=n([...e.getFocalPoint()],[0,0,0]);return{viewUp:r,viewPlaneNormal:i,position:a,focalPoint:o,parallelProjection:e.getParallelProjection(),parallelScale:e.getParallelScale(),viewAngle:e.getViewAngle(),flipHorizontal:this.flipHorizontal,flipVertical:this.flipVertical}}getCamera(){return{...this.getCameraNoRotation(),rotation:this.getRotation()}}setCamera(e,n=!1){const r=this.getVtkActiveCamera(),i=this.getCamera(),a=Object.assign({},i,e),{viewUp:o,viewPlaneNormal:s,position:c,focalPoint:l,parallelScale:u,viewAngle:f,flipHorizontal:d,flipVertical:h,clippingRange:m}=e;if(d!==void 0){const x=d&&!this.flipHorizontal||!d&&this.flipHorizontal;x&&this.flip({flipHorizontal:x})}if(h!==void 0){const x=h&&!this.flipVertical||!h&&this.flipVertical;x&&this.flip({flipVertical:x})}o!==void 0&&r.setViewUp(o),s!==void 0&&r.setDirectionOfProjection(-s[0],-s[1],-s[2]),c!==void 0&&r.setPosition(...c),l!==void 0&&r.setFocalPoint(...l),u!==void 0&&r.setParallelScale(u),f!==void 0&&r.setViewAngle(f),m!==void 0&&r.setClippingRange(m);const p=i.focalPoint,y=i.viewUp;if(p&&l||y&&o){const x=r.getViewPlaneNormal(),S=r.getViewUp();let C=!1,_=!1;if(l){const T=[l[0]-p[0],l[1]-p[1],l[2]-p[2]];C=Math.abs(hu.dot(T,x))>0}if(o&&(_=!Lr(S,y)),C||_){const T=this.getDefaultActor();if(!T?.actor)return;tc(T,"vtkActor")||this.updateClippingPlanesForActors(a),(tc(T,"vtkImageSlice")||this.type===Rr.VOLUME_3D)&&this.getRenderer().resetCameraClippingRange()}}n&&this.setInitialCamera(a),this.triggerCameraModifiedEventIfNecessary(i,this.getCamera())}triggerCameraModifiedEventIfNecessary(e,n){if(!this._suppressCameraModifiedEvents&&!this.suppressEvents){const r={previousCamera:e,camera:n,element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId};dt(this.element,it.CAMERA_MODIFIED,r)}}updateCameraClippingPlanesAndRange(){const e=this.getCamera();this.updateClippingPlanesForActors(e),this.getRenderer().resetCameraClippingRange()}async updateClippingPlanesForActors(e){this.getActors().map(r=>{if(!r.actor)return;const i=r.actor.getMapper();let a=r?.clippingFilter?r?.clippingFilter.getClippingPlanes():i.getClippingPlanes();a.length===0&&r?.clippingFilter&&(a=[Os.newInstance(),Os.newInstance()]);let o=Ki.MINIMUM_SLAB_THICKNESS;r.slabThickness&&(o=r.slabThickness);const{viewPlaneNormal:s,focalPoint:c}=e;this.setOrientationOfClippingPlanes(a,o,s,c),dt(this.element,it.CLIPPING_PLANES_UPDATED,{actorEntry:r,focalPoint:c,vtkPlanes:a,viewport:this})})}setOrientationOfClippingPlanes(e,n,r,i){if(e.length<2)return;const a=[r[0],r[1],r[2]];hu.multiplyScalar(a,n),e[0].setNormal(r);const o=[0,0,0];hu.subtract(i,a,o),e[0].setOrigin(o),e[1].setNormal(-r[0],-r[1],-r[2]);const s=[0,0,0];hu.add(i,a,s),e[1].setOrigin(s)}getClippingPlanesForActor(e){if(e||(e=this.getDefaultActor()),!e.actor)throw new Error("Invalid actor entry: Actor is undefined");const n=e.actor.getMapper();let r=e?.clippingFilter?e?.clippingFilter.getClippingPlanes():n.getClippingPlanes();return r.length===0&&e?.clippingFilter&&(r=[Os.newInstance(),Os.newInstance()]),r}_getWorldDistanceViewUpAndViewRight(e,n,r){const i=this._getCorners(e),a=this._getCorners(e),o=Tr(ut(),n,r);let s=Em.buildFromDegree().identity().rotateFromDirections(n,[1,0,0]);i.forEach(d=>s.apply(d));let c=1/0,l=-1/0;for(let d=0;d<8;d++){const h=i[d][0];h>l&&(l=h),h<c&&(c=h)}s=Em.buildFromDegree().identity().rotateFromDirections([o[0],o[1],o[2]],[1,0,0]),a.forEach(d=>s.apply(d));let u=1/0,f=-1/0;for(let d=0;d<8;d++){const h=a[d][0];h>f&&(f=h),h<u&&(u=h)}return{widthWorld:f-u,heightWorld:l-c}}getViewReference(e){const{focalPoint:n,viewPlaneNormal:r,viewUp:i}=this.getCamera(),a=this.getFrameOfReferenceUID(),o={FrameOfReferenceUID:a,cameraFocalPoint:n,viewPlaneNormal:r,viewUp:i,sliceIndex:e?.sliceIndex??this.getSliceIndex(),planeRestriction:{FrameOfReferenceUID:a,point:e?.points?.[0]||n,inPlaneVector1:i,inPlaneVector2:Tr(ut(),i,r)}};return e?.points&&e3e(e.points,o.planeRestriction),o}isPlaneViewable(e,n){if(e.FrameOfReferenceUID!==this.getFrameOfReferenceUID())return!1;const{focalPoint:r,viewPlaneNormal:i}=this.getCamera(),{point:a,inPlaneVector1:o,inPlaneVector2:s}=e;if(n?.withOrientation)return!0;if(o&&!Lr(0,Vt(i,o))||s&&!Lr(0,Vt(i,s)))return!1;if(n?.withNavigation)return!0;const c=yr(ut(),a,r);return Lr(0,Vt(c,i))}isReferenceViewable(e,n){if(e.planeRestriction)return this.isPlaneViewable(e.planeRestriction,n);if(e.FrameOfReferenceUID&&e.FrameOfReferenceUID!==this.getFrameOfReferenceUID())return!1;const{viewPlaneNormal:r}=e,i=this.getCamera();return r&&!Lr(r,i.viewPlaneNormal)&&!Lr(th(i.viewPlaneNormal,i.viewPlaneNormal),r)?n?.withOrientation:!0}getViewPresentation(e={rotation:!0,displayArea:!0,zoom:!0,pan:!0,flipHorizontal:!0,flipVertical:!0}){const n={},{rotation:r,displayArea:i,zoom:a,pan:o,flipHorizontal:s,flipVertical:c}=e;r&&(n.rotation=this.getRotation()),i&&(n.displayArea=this.getDisplayArea());const l=this.getZoom();return a&&(n.zoom=l),o&&(n.pan=this.getPan(),Nee(n.pan,n.pan,1/l)),s&&(n.flipHorizontal=this.flipHorizontal),c&&(n.flipVertical=this.flipVertical),n}setViewReference(e){}setViewPresentation(e){if(!e)return;const{displayArea:n,zoom:r=this.getZoom(),pan:i,rotation:a,flipHorizontal:o=this.flipHorizontal,flipVertical:s=this.flipVertical}=e;n!==this.getDisplayArea()&&this.setDisplayArea(n),this.setZoom(r),i&&this.setPan(Nee([0,0],i,r)),o!==void 0&&o!==this.flipHorizontal&&this.flip({flipHorizontal:o}),s!==void 0&&s!==this.flipVertical&&this.flip({flipVertical:s}),a>=0&&this.setRotation(a)}_getCorners(e){return[[e[0],e[2],e[4]],[e[0],e[2],e[5]],[e[0],e[3],e[4]],[e[0],e[3],e[5]],[e[1],e[2],e[4]],[e[1],e[2],e[5]],[e[1],e[3],e[4]],[e[1],e[3],e[5]]]}_getFocalPointForResetCamera(e,n,{resetPan:r=!0,resetToCenter:i=!0}){if(i&&r)return e;if(i&&!r)return wk(n.focalPoint)?e:n.focalPoint;if(!i&&r){const a=n,o=a.focalPoint,s=a.viewPlaneNormal,c=Xi(ut(),e,o),l=Vt(c,s),u=Ro(ut(),e,s,-1*l);return[u[0],u[1],u[2]]}if(!r&&!i)return wk(n.focalPoint)?e:n.focalPoint}_isInBounds(e,n){const[r,i,a,o,s,c]=n,[l,u,f]=e;return!(l<r||l>i||u<a||u>o||f<s||f>c)}_getEdges(e){const[n,r,i,a,o,s,c,l]=this._getCorners(e);return[[n,r],[n,o],[n,i],[r,a],[r,s],[i,a],[i,c],[a,l],[o,c],[o,s],[s,l],[c,l]]}static boundsRadius(e){const n=(e[1]-e[0])**2,r=(e[3]-e[2])**2,i=(e[5]-e[4])**2;return Math.sqrt(n+r+i||1)*.5}setDataIds(e,n){throw new Error("Unsupported operatoin setDataIds")}},Gg.CameraViewPresentation={rotation:!0,pan:!0,zoom:!0,displayArea:!0},Gg.TransferViewPresentation={windowLevel:!0,paletteLut:!0},Gg);function t3e(t,e,n=!1){const r=t.getCamera(),{focalPoint:i,viewPlaneNormal:a}=r,{spacingInNormalDirection:o,actorUID:s}=S3(t,r,e,n);if(!s)throw new Error(`Could not find image volume with id ${e} in the viewport`);const c=t.getActor(s);if(!c)return console.warn("No actor found for with actorUID of",s),null;const l=c.actor;return{sliceRange:n9(l,a,i),spacingInNormalDirection:o,camera:r}}function py(t,e,n=!1){const{sliceRange:r,spacingInNormalDirection:i,camera:a}=t3e(t,e,n),{min:o,max:s,current:c}=r,l=Math.round((s-o)/i),f=(c-o)/(s-o)*l,d=Math.round(f);return{numScrollSteps:l,currentStepIndex:d,sliceRangeInfo:{sliceRange:r,spacingInNormalDirection:i,camera:a}}}function my(t,e,n,r,i,a){const{min:o,max:s,current:c}=n,l=ut();yr(l,e,t);const u=Math.round((s-o)/i),d=(c-o)/(s-o)*u;let h=Math.round(d),m=[t[0]-r[0]*d*i,t[1]-r[1]*d*i,t[2]-r[2]*d*i];h+=a,h>u?h=u:h<0&&(h=0);const p=h*i;m=[m[0]+r[0]*p,m[1]+r[1]*p,m[2]+r[2]*p];const y=[m[0]+l[0],m[1]+l[1],m[2]+l[2]];return{newFocalPoint:m,newPosition:y}}function n3e(t){let e=[];const[n,r]=t.getRange();t.getTable(n,r,1024,e),e=e.filter((h,m)=>m%3===0);const i=[...Array(1024).keys()].map((h,m)=>n+(r-n)/1023*m),a=e[256],o=Math.log((1-a)/a),s=i[256],c=e[256*3],l=Math.log((1-c)/c),u=i[256*3],f=Math.round(4*(u-s)/(o-l)),d=Math.round(s+f*o/4);return[Math.round(d-f/2),Math.round(d+f/2)]}function r3e(t,e){const n=e.colorTransfer.split(" ").splice(1).map(parseFloat),{shiftRange:r}=SMt(n),i=r[0],a=r[1]-r[0],o=yh.newInstance(),s=[];for(let _=0;_<n.length;_+=4){let T=n[_];const O=n[_+1],M=n[_+2],I=n[_+3];T=(T-i)/a,s.push([T,O,M,I])}CMt(s,r,o),t.getProperty().setRGBTransferFunction(0,o);const c=e.scalarOpacity.split(" ").splice(1).map(parseFloat),l=l1.newInstance(),u=[];for(let _=0;_<c.length;_+=2){let T=c[_];const O=c[_+1];T=(T-i)/a,u.push([T,O])}_Mt(u,r,l);const f=t.getProperty();f.setScalarOpacity(0,l);const[d,h,m,p]=e.gradientOpacity.split(" ").splice(1).map(parseFloat);f.setUseGradientOpacity(0,!0),f.setGradientOpacityMinimumValue(0,d),f.setGradientOpacityMinimumOpacity(0,h),f.setGradientOpacityMaximumValue(0,m),f.setGradientOpacityMaximumOpacity(0,p),e.interpolation==="1"&&f.setInterpolationTypeToFastLinear(),f.setShade(e.shade==="1");const y=parseFloat(e.ambient),x=parseFloat(e.diffuse),S=parseFloat(e.specular),C=parseFloat(e.specularPower);f.setAmbient(y),f.setDiffuse(x),f.setSpecular(S),f.setSpecularPower(C)}function SMt(t){let e=1/0,n=-1/0;for(let i=0;i<t.length;i+=4)e=Math.min(e,t[i]),n=Math.max(n,t[i]);const r=(n-e)/2;return{shiftRange:[-r,r],min:e,max:n}}function CMt(t,e,n){const r=e[1]-e[0],i=t.map(([a,o,s,c])=>[a*r+e[0],o,s,c]);return n.removeAllPoints(),i.forEach(([a,o,s,c])=>n.addRGBPoint(a,o,s,c)),i}function _Mt(t,e,n){const r=e[1]-e[0],i=t.map(([a,o])=>[a*r+e[0],o]);return n.removeAllPoints(),i.forEach(([a,o])=>n.addPoint(a,o)),i}const{MPR_CAMERA_VALUES:cl}=wU,{OrientationAxis:C0}=Ad;function i3e(t,e,n,r){let i;switch(r){case C0.AXIAL:case C0.AXIAL_REFORMAT:i=cl.axial;break;case C0.SAGITTAL:case C0.SAGITTAL_REFORMAT:i=cl.sagittal;break;case C0.CORONAL:case C0.CORONAL_REFORMAT:i=cl.coronal;break;default:i=cl.axial;break}const a=Vr(ut(),t),o=Vr(ut(),e),s=Vr(ut(),n),c=[a,o,s],l=[Zn(i.viewRight[0],i.viewRight[1],i.viewRight[2]),Zn(i.viewUp[0],i.viewUp[1],i.viewUp[2]),Zn(i.viewPlaneNormal[0],i.viewPlaneNormal[1],i.viewPlaneNormal[2])],u=new Set,f=p=>{let y=0,x=-2,S=!1;c.forEach((_,T)=>{if(u.has(T))return;const O=Vt(p,_),M=Math.abs(O);M>x&&(x=M,y=T,S=O<0)}),u.add(y);const C=Ixe(c[y]);return S&&th(C,C),C},d=f(l[0]),h=f(l[1]),m=f(l[2]);return{viewPlaneNormal:[m[0],m[1],m[2]],viewUp:[h[0],h[1],h[2]],viewRight:[d[0],d[1],d[2]]}}function a3e(t,e){if(!t.getActors()?.length)return;t.type!==Rr.ORTHOGRAPHIC&&console.warn("Viewport should be a volume viewport");let n=t.getCurrentImageId();if(n||(n=t.getImageIds()?.[0]),!n)return;const{imageOrientationPatient:r}=Ot("imagePlaneModule",n),i=Zn(r[0],r[1],r[2]),a=Zn(r[3],r[4],r[5]),o=Tr(ut(),i,a);let{orientation:s}=e||{};const{useViewportNormal:c}=e||{};let l=o;return c&&(l=t.getCamera().viewPlaneNormal),s||(s=TMt(l)),i3e(i,a,o,s)}function TMt(t){const e=Vr(ut(),t),n=Zn(cl.axial.viewPlaneNormal[0],cl.axial.viewPlaneNormal[1],cl.axial.viewPlaneNormal[2]),r=Zn(cl.sagittal.viewPlaneNormal[0],cl.sagittal.viewPlaneNormal[1],cl.sagittal.viewPlaneNormal[2]),i=Zn(cl.coronal.viewPlaneNormal[0],cl.coronal.viewPlaneNormal[1],cl.coronal.viewPlaneNormal[2]),a=Math.abs(Vt(e,n)),o=Math.abs(Vt(e,r)),s=Math.abs(Vt(e,i));return a>=o&&a>=s?C0.AXIAL:o>=s?C0.SAGITTAL:C0.CORONAL}function o3e(){return mf()?.rendering?.renderingEngineMode===o1.ContextPool}const EMt=t=>!(typeof t=="number"&&Number.isFinite(t)),{vtkErrorMacro:$S}=se;function OMt(t,e){e.classHierarchy.push("vtkConvolution2DPass"),t.computeKernelWeight=function(r){const i=r.reduce((a,o)=>a+o);return i<=0?1:i},t.traverse=function(n){if(e.deleted)return;if(e.kernelDimension%2!==1){$S("Invalid kernel dimension! Kernel dimension must be odd (e.g. 3, 5, 7, ...).");return}e.kernel===null&&(e.kernel=new Float32Array(e.kernelDimension),e.kernel[Math.floor(e.kernelDimension/2)]=1);const r=e.kernelDimension*e.kernelDimension;if(e.kernel.length!==r){$S(`The given kernel is invalid. 2D convolution kernels have to be 1D arrays with ${r} components representing the ${e.kernelDimension}x${e.kernelDimension} kernel in row-major form.`);return}e.framebuffer===null&&(e.framebuffer=y3.newInstance());const i=n.getSize(),a=n.getContext();if(a===null){e.delegates.forEach(c=>{c.traverse(n,t)});return}e.VBOBuildTime.getMTime()<t.getMTime()&&(e.tris.setOpenGLRenderWindow(n),t.buildVertexBuffer()),e.framebuffer.setOpenGLRenderWindow(n),e.framebuffer.saveCurrentBindingsAndBuffers();const o=e.framebuffer.getSize();if((o===null||o[0]!==i[0]||o[1]!==i[1])&&(e.framebuffer.create(i[0],i[1]),e.framebuffer.populateFramebuffer()),e.framebuffer.bind(),e.delegates.forEach(c=>{c.traverse(n,t)}),e.framebuffer.restorePreviousBindingsAndBuffers(),e.convolutionShader!==null&&e.oldKernelDimension!==e.kernelDimension&&(e.convolutionShader=null,e.oldKernelDimension=e.kernelDimension),e.convolutionShader===null){e.convolutionShader=n.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join(`
`),t.getFragmentShaderCode(e.kernelDimension),"");const c=e.convolutionShader;e.copyVAO=WE.newInstance(),e.copyVAO.setOpenGLRenderWindow(n),e.tris.getCABO().bind(),e.copyVAO.addAttributeArray(c,e.tris.getCABO(),"vertexDC",e.tris.getCABO().getVertexOffset(),e.tris.getCABO().getStride(),a.FLOAT,3,a.FALSE)||$S("Error setting vertexDC in copy shader VAO."),e.copyVAO.addAttributeArray(c,e.tris.getCABO(),"tcoordTC",e.tris.getCABO().getTCoordOffset(),e.tris.getCABO().getStride(),a.FLOAT,2,a.FALSE)||$S("Error setting vertexDC in copy shader VAO.")}else n.getShaderCache().readyShaderProgram(e.convolutionShader);a.viewport(0,0,i[0],i[1]),a.scissor(0,0,i[0],i[1]);const s=e.framebuffer.getColorTexture();s.activate(),e.convolutionShader.setUniformi("u_image",s.getTextureUnit()),e.convolutionShader.setUniform2f("u_textureSize",s.getWidth(),s.getHeight()),e.convolutionShader.setUniformfv("u_kernel",e.kernel),e.convolutionShader.setUniformf("u_kernelWeight",t.computeKernelWeight(e.kernel)),a.drawArrays(a.TRIANGLES,0,e.tris.getCABO().getElementCount()),s.deactivate()},t.getFragmentShaderCode=n=>{const r=n*n;let i=["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D u_image;","uniform vec2 u_textureSize;",`uniform float u_kernel[${r}];`,"uniform float u_kernelWeight;","varying vec2 tcoord;","void main(){","    vec2 onePixel = vec2(1.0, 1.0) / u_textureSize;",`    vec4 colorSum =
`].join(`
`);const a=Math.floor(n/2);let o=0;for(let s=-a;s<=a;++s)for(let c=-a;c<=a;++c)i+=`        texture2D(u_image, tcoord + onePixel * vec2(${c}, ${s})) * u_kernel[${o}]`,++o,o!==r&&(i+=` +
`);return i+=[";","    gl_FragData[0] = vec4((colorSum / u_kernelWeight).rgb, texture2D(u_image, tcoord).a);","}"].join(`
`),i},t.buildVertexBuffer=()=>{const n=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),r=new Float32Array([0,0,1,0,0,1,1,1]),i=new Uint16Array([4,0,1,3,2]),a=On.newInstance({numberOfComponents:3,values:n});a.setName("points");const o=On.newInstance({numberOfComponents:2,values:r});o.setName("tcoords");const s=On.newInstance({numberOfComponents:1,values:i});e.tris.getCABO().createVBO(s,"polys",_l.SURFACE,{points:a,tcoords:o,cellOffset:0}),e.VBOBuildTime.modified()}}const DMt={framebuffer:null,convolutionShader:null,tris:null,kernel:[0,0,0,0,1,0,0,0,0],oldKernelDimension:3,kernelDimension:3};function s3e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,DMt,n),XE.extend(t,e,n),e.VBOBuildTime={},se.obj(e.VBOBuildTime,{mtime:0}),e.tris=Ph.newInstance(),se.setGet(t,e,["kernel","kernelDimension"]),se.get(t,e,["framebuffer"]),OMt(t,e)}const MMt=se.newInstance(s3e,"vtkConvolution2DPass");var RMt={newInstance:MMt,extend:s3e};function c3e(t){let e=Kwe.newInstance();if(t>0){const n=RMt.newInstance();n.setDelegates([e]);const r=Math.max(0,t);n.setKernelDimension(3),n.setKernel([-r,-r,-r,-r,1+8*r,-r,-r,-r,-r]),e=n}return e}class Tu extends r9{constructor(e){if(super(e),this.useCPURendering=!1,this.sharpening=0,this.perVolumeIdDefaultProperties=new Map,this.viewportProperties={},this.volumeIds=new Set,this.setRotation=i=>{const a=this.getPan(this.fitToCanvasCamera),o=this.getPan(),s=this.getCamera(),c=Wy([0,0],a,o);this.setPan(c,!1);const{flipVertical:l}=this.getCamera(),u=l?th([0,0,0],this.initialViewUp):this.initialViewUp;this.setCameraNoEvent({viewUp:u}),this.rotateCamera(i);const f=this.getPan(),d=this.getPan(this.fitToCanvasCamera),h=Wy([0,0],f,d),m=QU([0,0],a,h);if(this.setPan(m,!1),this._suppressCameraModifiedEvents)return;const p=this.getCamera(),y={previousCamera:s,camera:p,element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId};dt(this.element,it.CAMERA_MODIFIED,y)},this.setSharpening=i=>{this.sharpening=i,this.render()},this.getRenderPasses=()=>{if(!this.shouldUseCustomRenderPass())return null;try{return[c3e(this.sharpening)]}catch(i){return console.warn("Failed to create sharpening render passes:",i),null}},this.getDefaultProperties=i=>{let a;return i!==void 0&&(a=this.perVolumeIdDefaultProperties.get(i)),a!==void 0?a:{...this.globalDefaultProperties}},this.getProperties=i=>{if(!this._getApplicableVolumeActor(i))return;const{colormap:o,VOILUTFunction:s,interpolationType:c,invert:l,slabThickness:u,preset:f}=this.viewportProperties;if(i||=this.getVolumeId(),!Ct.getVolume(i))return null;const h=this.getActors().find(T=>T.referencedId===i);if(!h)return;const p=h.actor.getProperty().getRGBTransferFunction(0),[y,x]=this.viewportProperties?.VOILUTFunction==="SIGMOID"?n3e(p):p.getRange(),S={lower:y,upper:x},C=this.getColormap(i);return{colormap:i&&C?C:o,voiRange:S,VOILUTFunction:s,interpolationType:c,invert:l,slabThickness:u,preset:f,sharpening:this.sharpening}},this.getColormap=i=>{const a=this._getApplicableVolumeActor(i);if(!a)return;const{volumeActor:o}=a,s=this._getOrCreateColorTransferFunction(i),{nodes:c}=s.getState(),l=c.reduce((h,m)=>(h.push(m.x,m.r,m.g,m.b),h),[]),u=tF(l,o)||{},f=rF(o),d=iF(o);return u.threshold=f,u.opacity=d,u},this.getRotation=()=>{const{viewUp:i,viewPlaneNormal:a,flipVertical:o}=this.getCameraNoRotation(),s=o?th([0,0,0],this.initialViewUp):this.initialViewUp;if(!s)return 0;const c=Pxe(s,i)*180/Math.PI,l=Tr([0,0,0],s,i);return Vt(l,a)>=0?c:(360-c)%360},this.getFrameOfReferenceUID=()=>this._FrameOfReferenceUID,this.canvasToWorldTiled=i=>{const a=this.getVtkActiveCamera();a.setIsPerformingCoordinateTransformation?.(!0);const o=this.getRenderer(),s=this.getVtkDisplayCoordsTiled(i),u=this.getRenderingEngine().offscreenMultiRenderWindow.getOpenGLRenderWindow().displayToWorld(s[0],s[1],s[2],o);return a.setIsPerformingCoordinateTransformation?.(!1),[u[0],u[1],u[2]]},this.canvasToWorldContextPool=i=>{const a=this.getVtkActiveCamera();a.setIsPerformingCoordinateTransformation?.(!0);const o=this.getRenderer(),s=window.devicePixelRatio||1,{width:c,height:l}=this.canvas,u=c/l,[f,d,h,m]=o.getViewport(),p=h-f,y=m-d,x=[i[0]*s,i[1]*s],S=[f+x[0]/c*p,d+(1-x[1]/l)*y,0],C=o.normalizedDisplayToProjection(S[0],S[1],S[2]),_=o.projectionToView(C[0],C[1],C[2],u),T=o.viewToWorld(_[0],_[1],_[2]);return a.setIsPerformingCoordinateTransformation?.(!1),[T[0],T[1],T[2]]},this.getVtkDisplayCoordsTiled=i=>{const a=window.devicePixelRatio||1,o=[i[0]*a,i[1]*a],l=this.getRenderingEngine().offscreenMultiRenderWindow.getOpenGLRenderWindow().getSize(),u=[o[0]+this.sx,o[1]+this.sy];return u[1]=l[1]-u[1],[u[0],u[1],0]},this.getVtkDisplayCoordsContextPool=i=>{const a=window.devicePixelRatio||1,o=[i[0]*a,i[1]*a],s=this.getRenderer(),{width:c,height:l}=this.canvas,[u,f,d,h]=s.getViewport(),m=d-u,p=h-f,y=o[0]/c*m*c,x=o[1]/l*p*l,S=[y,p*l-x];return[S[0],S[1],0]},this.worldToCanvasTiled=i=>{const a=this.getVtkActiveCamera();a.setIsPerformingCoordinateTransformation?.(!0);const o=this.getRenderer(),c=this.getRenderingEngine().offscreenMultiRenderWindow.getOpenGLRenderWindow(),l=c.getSize(),u=c.worldToDisplay(...i,o);u[1]=l[1]-u[1];const f=[u[0]-this.sx,u[1]-this.sy],d=window.devicePixelRatio||1,h=[f[0]/d,f[1]/d];return a.setIsPerformingCoordinateTransformation(!1),h},this.worldToCanvasContextPool=i=>{const a=this.getVtkActiveCamera();a.setIsPerformingCoordinateTransformation?.(!0);const o=this.getRenderer(),{width:s,height:c}=this.canvas,l=s/c,[u,f,d,h]=o.getViewport(),m=d-u,p=h-f,y=o.worldToView(i[0],i[1],i[2]),x=o.viewToProjection(y[0],y[1],y[2],l),S=o.projectionToNormalizedDisplay(x[0],x[1],x[2]),C=(S[0]-u)/m,_=(S[1]-f)/p,T=C*s,O=(1-_)*c,M=window.devicePixelRatio||1,I=[T/M,O/M];return a.setIsPerformingCoordinateTransformation(!1),I},this.hasImageURI=i=>this.getActors().filter(o=>tc(o,"vtkVolume")).some(({uid:o,referencedId:s})=>{const c=Ct.getVolume(s||o);return c?.getImageIdIndex?c.getImageIdIndex(i)!==void 0||c.getImageURIIndex(i)!==void 0:!1}),this.getImageIds=i=>{const a=this._getApplicableVolumeActor(i);if(!a)throw new Error(`No actor found for the given volumeId: ${i}`);const o=a.volumeId,s=Ct.getVolume(o);if(!s)throw new Error(`imageVolume with id: ${o} does not exist in cache`);return s.imageIds},this.renderingPipelineFunctions={worldToCanvas:{tiled:this.worldToCanvasTiled,contextPool:this.worldToCanvasContextPool},canvasToWorld:{tiled:this.canvasToWorldTiled,contextPool:this.canvasToWorldContextPool},getVtkDisplayCoords:{tiled:this.getVtkDisplayCoordsTiled,contextPool:this.getVtkDisplayCoordsContextPool},getRenderer:{tiled:this.getRendererTiled,contextPool:this.getRendererContextPool}},this.useCPURendering=q5(),this.useCPURendering)throw new Error("VolumeViewports cannot be used whilst CPU Fallback Rendering is enabled.");this._configureRenderingPipeline();const n=this.getRenderer(),r=kDt.newInstance();switch(n.setActiveCamera(r),this.type){case Rr.ORTHOGRAPHIC:r.setParallelProjection(!0);break;case Rr.VOLUME_3D:r.setParallelProjection(!0);break;case Rr.PERSPECTIVE:r.setParallelProjection(!1);break;default:throw new Error(`Unrecognized viewport type: ${this.type}`)}this.initializeVolumeNewImageEventDispatcher()}static get useCustomRenderingPipeline(){return!1}getSliceViewInfo(){throw new Error("Method not implemented.")}applyViewOrientation(e,n=!0){const{viewPlaneNormal:r,viewUp:i}=this._getOrientationVectors(e)||{};if(!r||!i)return;const a=this.getVtkActiveCamera();a.setDirectionOfProjection(-r[0],-r[1],-r[2]),a.setViewUpFrom(i),this.initialViewUp=i,n&&this.resetCamera({resetOrientation:!1,resetRotation:!1})}initializeVolumeNewImageEventDispatcher(){const e=r.bind(this),n=i.bind(this);function r(a){const{viewportId:o}=a.detail;o!==this.id||this.isDisabled||!this.getImageData()||vMt(a)}function i(a){const{viewportId:o}=a.detail;o===this.id&&(this.element.removeEventListener(it.CAMERA_MODIFIED,e),pt.removeEventListener(it.ELEMENT_DISABLED,n),mMt(o))}this.element.removeEventListener(it.CAMERA_MODIFIED,e),this.element.addEventListener(it.CAMERA_MODIFIED,e),pt.addEventListener(it.ELEMENT_DISABLED,n)}setVOILUTFunction(e,n,r){Object.values(ns).includes(e)||(e=ns.LINEAR);const{voiRange:i}=this.getProperties();this.setVOI(i,n,r),this.viewportProperties.VOILUTFunction=e}setColormap(e,n,r){const i=this._getApplicableVolumeActor(n);if(!i)return;const{volumeActor:a}=i,o=yh.newInstance();let s=Kw(e.name);const{name:c}=e;if(s||(s=qw.getPresetByName(c)),!s)throw new Error(`Colormap ${e} not found`);const l=a.getProperty().getRGBTransferFunction(0).getRange();if(o.applyColorMap(s),o.setMappingRange(l[0],l[1]),a.getProperty().setRGBTransferFunction(0,o),this.viewportProperties.colormap=e,!r){const u=this.getColormap(n),f={viewportId:this.id,colormap:u,volumeId:n};dt(this.element,it.VOI_MODIFIED,f),dt(this.element,it.COLORMAP_MODIFIED,f)}}setOpacity(e,n){const r=this._getApplicableVolumeActor(n);if(!r)return;const{volumeActor:i}=r,a=l1.newInstance();typeof e.opacity=="number"?Fxe(i,e.opacity):(e.opacity.forEach(({opacity:c,value:l})=>{a.addPoint(l,c)}),i.getProperty().setScalarOpacity(0,a)),this.viewportProperties.colormap||(this.viewportProperties.colormap={}),this.viewportProperties.colormap.opacity=e.opacity;const o=this.getColormap(n),s={viewportId:this.id,colormap:o,volumeId:n};dt(this.element,it.COLORMAP_MODIFIED,s)}setInvert(e,n,r){const i=this._getApplicableVolumeActor(n);if(!i)return;const a=i.volumeId,o=this._getOrCreateColorTransferFunction(a);if(Y5(o),this.viewportProperties.invert=e,!r){const s={...this.getVOIModifiedEventDetail(a),invertStateChanged:!0};dt(this.element,it.VOI_MODIFIED,s)}}getVOIModifiedEventDetail(e){const n=this._getApplicableVolumeActor(e);if(!n)throw new Error(`No actor found for the given volumeId: ${e}`);const a=n.volumeActor.getProperty().getRGBTransferFunction(0).getMappingRange(),o=this.getColormap(e),{VOILUTFunction:s,invert:c}=this.getProperties(e);return{viewportId:this.id,range:{lower:a[0],upper:a[1]},volumeId:n.volumeId,VOILUTFunction:s,colormap:o,invert:c}}_getOrCreateColorTransferFunction(e){const n=this._getApplicableVolumeActor(e);if(!n)return null;const{volumeActor:r}=n,i=r.getProperty().getRGBTransferFunction(0);if(i)return i;const a=yh.newInstance();return r.getProperty().setRGBTransferFunction(0,a),a}setInterpolationType(e,n){const r=this._getApplicableVolumeActor(n);if(!r)return;const{volumeActor:i}=r;i.getProperty().setInterpolationType(e),this.viewportProperties.interpolationType=e}setVOI(e,n,r=!1){const i=this._getApplicableVolumeActor(n);if(!i)return;const{volumeActor:a}=i,o=i.volumeId,s=e;if(typeof s>"u")throw new Error("voiRangeToUse is undefined, need to implement this in the new volume model");if([s.lower,s.upper].some(EMt)){console.warn("VOI range contains invalid values, ignoring setVOI request",s);return}const{VOILUTFunction:c}=this.getProperties(o);if(c===ns.SAMPLED_SIGMOID){const l=aF(s);a.getProperty().setRGBTransferFunction(0,l)}else{const{lower:l,upper:u}=s;a.getProperty().getRGBTransferFunction(0).setRange(l,u)}if(!r){const l={...this.getVOIModifiedEventDetail(o)};dt(this.element,it.VOI_MODIFIED,l)}this.viewportProperties.voiRange=s}rotateCamera(e){const n=e-this.getRotation();this.getVtkActiveCamera().roll(-n)}setDefaultProperties(e,n){n==null?this.globalDefaultProperties=e:this.perVolumeIdDefaultProperties.set(n,e)}clearDefaultProperties(e){e==null?(this.globalDefaultProperties={},this.resetProperties()):(this.perVolumeIdDefaultProperties.delete(e),this.resetToDefaultProperties(e))}getViewReference(e={}){const n=super.getViewReference(e),r=this.getVolumeId(e);if(e?.forFrameOfReference!==!1&&(n.volumeId=r),typeof e?.sliceIndex!="number")return n;const{viewPlaneNormal:i}=n,a=e?.sliceIndex-this.getSliceIndex(),{sliceRangeInfo:o}=py(this,r,!0),{sliceRange:s,spacingInNormalDirection:c,camera:l}=o,{focalPoint:u,position:f}=l,{newFocalPoint:d}=my(u,f,s,i,c,a);return n.cameraFocalPoint=d,n}isReferenceViewable(e,n){if(!e.FrameOfReferenceUID||!super.isReferenceViewable(e,n))return!1;if(n?.withNavigation){const{referencedImageId:a}=e;return!a||this.hasImageURI(a)}const r=this.getSliceIndex(),{sliceIndex:i}=e;return Array.isArray(i)?i[0]<=r&&r<=i[1]:i===void 0||i===r}scroll(e=1){const n=this.getVolumeId(),{sliceRangeInfo:r}=py(this,n,!0);if(!r)return;const{sliceRange:i,spacingInNormalDirection:a,camera:o}=r,{focalPoint:s,viewPlaneNormal:c,position:l}=o,{newFocalPoint:u,newPosition:f}=my(s,l,i,c,a,e);this.setCamera({focalPoint:u,position:f}),this.render()}setBestOrentation(e,n){if(!e&&!n)return;const{viewPlaneNormal:r}=this.getCamera();if(Cv(r,n)&&Cv(r,e))return;const i=this._getAcquisitionPlaneOrientation();if(Cv(i.viewPlaneNormal,n)&&Cv(i.viewPlaneNormal,e)){this.setOrientation(i);return}for(const o of Object.values(W0))if(Cv(o.viewPlaneNormal,n)&&Cv(o.viewPlaneNormal,e)){this.setOrientation(o);return}const a=Tr(ut(),n||i.viewPlaneNormal,e);Vr(a,a),this.setOrientation({viewPlaneNormal:a})}setViewPlane(e){const{point:n,inPlaneVector1:r,inPlaneVector2:i,FrameOfReferenceUID:a}=e;this.setBestOrentation(r,i),this.setViewReference({FrameOfReferenceUID:a,cameraFocalPoint:n,viewPlaneNormal:this.getCamera().viewPlaneNormal})}setViewReference(e){if(!e)return;const n=this.getVolumeId(),{FrameOfReferenceUID:r,cameraFocalPoint:i,referencedImageId:a,planeRestriction:o,viewPlaneNormal:s,viewUp:c}=e;let{sliceIndex:l}=e;if(o&&!s)return this.setViewPlane(o);const{focalPoint:u,viewPlaneNormal:f,position:d}=this.getCamera(),h=jxe(f,s),m=Lr(f,s);if(typeof l=="number"&&n!==void 0&&e.volumeId===n&&(h||m)){const{currentStepIndex:p,sliceRangeInfo:y,numScrollSteps:x}=py(this,n,!0),{sliceRange:S,spacingInNormalDirection:C}=y;h&&(l=x-l-1);const _=l-p,{newFocalPoint:T,newPosition:O}=my(u,d,S,f,C,_);this.setCamera({focalPoint:T,position:O})}else if(r===this.getFrameOfReferenceUID()){if(s&&!h&&!m){this.setOrientation({viewPlaneNormal:s,viewUp:c}),this.setViewReference(e);return}if(a&&this.isInAcquisitionPlane()){const p=Ot(Js.IMAGE_PLANE,a),{imagePositionPatient:y}=p,{focalPoint:x}=this.getCamera(),S=Xi(ut(),x,y),C=Vt(S,f),_=Ro(ut(),x,[-f[0],-f[1],-f[2]],C),T=Xi(ut(),_,x),O=eh(ut(),d,T);this.setCamera({focalPoint:_,position:O}),this.render();return}if(i){const p=Xi([0,0,0],i,u),y=s??f,x=Vt(p,y);Lr(x,0)||gd(p,y,x);const S=eh([0,0,0],u,p),C=eh([0,0,0],d,p);this.setCamera({focalPoint:S,position:C})}}else throw new Error(`Incompatible view refs: ${r}!==${this.getFrameOfReferenceUID()}`)}setThreshold(e,n){const r=this._getApplicableVolumeActor(n);if(!r)return;const{volumeActor:i}=r;Bxe(i,e.threshold),this.viewportProperties.colormap||(this.viewportProperties.colormap={}),this.viewportProperties.colormap.threshold=e.threshold;const a=this.getColormap(n),o={viewportId:this.id,colormap:a,volumeId:n};dt(this.element,it.COLORMAP_MODIFIED,o)}setProperties({voiRange:e,VOILUTFunction:n,invert:r,colormap:i,preset:a,interpolationType:o,slabThickness:s,sampleDistanceMultiplier:c,sharpening:l}={},u,f=!1){this.globalDefaultProperties==null&&this.setDefaultProperties({voiRange:e,VOILUTFunction:n,invert:r,colormap:i,preset:a,slabThickness:s}),r!==void 0&&this.viewportProperties.invert!==r&&this.setInvert(r,u,f),i?.name&&this.setColormap(i,u,f),i?.opacity!=null&&this.setOpacity(i,u),i?.threshold!=null&&this.setThreshold(i,u),e!==void 0&&this.setVOI(e,u,f),typeof o<"u"&&this.setInterpolationType(o),n!==void 0&&this.setVOILUTFunction(n,u,f),a!==void 0&&this.setPreset(a,u,f),s!==void 0&&this.setSlabThickness(s),c!==void 0&&this.setSampleDistanceMultiplier(c),typeof l<"u"&&this.setSharpening(l)}shouldUseCustomRenderPass(){return this.sharpening>0&&!this.useCPURendering}resetToDefaultProperties(e){const n=this.globalDefaultProperties;n.colormap?.name&&this.setColormap(n.colormap,e),n.colormap?.opacity!=null&&this.setOpacity(n.colormap,e),n.voiRange!==void 0&&this.setVOI(n.voiRange,e),n.VOILUTFunction!==void 0&&this.setVOILUTFunction(n.VOILUTFunction,e),n.invert!==void 0&&this.setInvert(n.invert,e),n.slabThickness!==void 0&&(this.setSlabThickness(n.slabThickness),this.viewportProperties.slabThickness=n.slabThickness),n.sampleDistanceMultiplier!==void 0&&this.setSampleDistanceMultiplier(n.sampleDistanceMultiplier),n.preset!==void 0&&this.setPreset(n.preset,e,!1),this.render()}setPreset(e,n,r){const i=this._getApplicableVolumeActor(n);if(!i)return;const{volumeActor:a}=i;let o=e;typeof o=="string"&&(o=s2e.find(s=>s.name===e)),o&&(r3e(a,o),this.viewportProperties.preset=o,this.render(),r||dt(this.element,it.PRESET_MODIFIED,{viewportId:this.id,volumeId:i.volumeId,actor:a,presetName:o.name}))}setSampleDistanceMultiplier(e){}async setVolumes(e,n=!1,r=!1){const i=e[0].volumeId,a=Ct.getVolume(i);if(!a)throw new Error(`imageVolume with id: ${i} does not exist, you need to create/allocate the volume first`);const o=a.metadata.FrameOfReferenceUID;this._isValidVolumeInputArray(e,o),this._FrameOfReferenceUID=o,e.forEach(c=>{this._addVolumeId(c.volumeId)});const s=[];for(let c=0;c<e.length;c++){const{volumeId:l,actorUID:u,slabThickness:f,...d}=e[c],h=await xk(e[c],this.element,this.id,r),m=u||ya();s.push({uid:m,actor:h,slabThickness:f,referencedId:l,...d})}this._setVolumeActors(s),this.viewportStatus=Ss.PRE_RENDER,this.initializeColorTransferFunction(e),dt(this.element,it.VOLUME_VIEWPORT_NEW_VOLUME,{viewportId:this.id,volumeActors:s}),n&&this.render()}async addVolumes(e,n=!1,r=!1){const i=Ct.getVolume(e[0].volumeId);if(!i)throw new Error(`imageVolume with id: ${i.volumeId} does not exist`);const a=[];this._isValidVolumeInputArray(e,this._FrameOfReferenceUID),e.forEach(o=>{this._addVolumeId(o.volumeId)});for(let o=0;o<e.length;o++){const{volumeId:s,visibility:c,actorUID:l,slabThickness:u,...f}=e[o],d=await xk(e[o],this.element,this.id,r);c||d.setVisibility(!1);const h=l||ya();a.push({uid:h,actor:d,slabThickness:u,referencedId:s,...f})}this.addActors(a),this.initializeColorTransferFunction(e),n&&this.render()}removeVolumeActors(e,n=!1){this.removeActors(e),n&&this.render()}setOrientation(e,n=!0){console.warn('Method "setOrientation" needs implementation')}initializeColorTransferFunction(e){const n=e[0].volumeId,r=this._getOrCreateColorTransferFunction(n);!this.initialTransferFunctionNodes&&r&&(this.initialTransferFunctionNodes=GT(r))}_getApplicableVolumeActor(e){const n=this.getActors();if(!n?.length)return;if(e){const i=n.find(a=>a.referencedId===e);return i?{volumeActor:i.actor,volumeId:e,actorUID:i.uid}:void 0}const r=n[0];return{volumeActor:r.actor,volumeId:r.referencedId,actorUID:r.uid}}async _isValidVolumeInputArray(e,n){const r=e.length;for(let i=1;i<r;i++){const a=Ct.getVolume(e[i].volumeId);if(n!==a.metadata.FrameOfReferenceUID)throw new Error(`Volumes being added to viewport ${this.id} do not share the same FrameOfReferenceUID. This is not yet supported`)}return!0}getBounds(){return this.getRenderer().computeVisiblePropBounds()}flip(e){super.flip(e)}hasVolumeId(e){return this.volumeIds.has(e)}hasVolumeURI(e){for(const n of this.volumeIds)if(n.includes(e))return!0;return!1}getImageData(e){if(!this.getDefaultActor())return;e||=this.getVolumeId();const r=this.getActors()?.find(s=>s.referencedId===e);if(!tc(r,"vtkVolume"))return;const i=r.actor,a=Ct.getVolume(e),o=i.getMapper().getInputData();return{dimensions:o.getDimensions(),spacing:o.getSpacing(),origin:o.getOrigin(),direction:o.getDirection(),imageData:i.getMapper().getInputData(),metadata:{Modality:a?.metadata?.Modality,FrameOfReferenceUID:a?.metadata?.FrameOfReferenceUID},get scalarData(){return a?.voxelManager?.getScalarData()},scaling:a?.scaling,hasPixelSpacing:!0,voxelManager:a?.voxelManager}}setCameraClippingRange(){throw new Error("Method not implemented.")}getSliceIndex(){throw new Error("Method not implemented.")}setCamera(e,n){super.setCamera(e,n),this.setCameraClippingRange()}_setVolumeActors(e){for(let n=0;n<e.length;n++)this.viewportProperties.invert=!1;this.setActors(e)}getRendererContextPool(){return this.getRenderingEngine().getRenderer(this.id)}getRendererTiled(){const e=this.getRenderingEngine();if(!e||e.hasBeenDestroyed)throw new Error("Rendering engine has been destroyed");return e.offscreenMultiRenderWindow?.getRenderer(this.id)}_getViewUp(e){const{viewUp:n}=this.getCamera(),r=Vt(n,e);if(Lr(r,0))return n;if(kC(e[0],1))return[0,0,1];if(kC(e[1],1))return[0,0,1];if(kC(e[2],1))return[0,-1,0];const i=Ro(ut(),n,e,-r);return Vr(i,i),i}_getOrientationVectors(e){if(typeof e=="object"){if(e.viewPlaneNormal)return{...e,viewUp:e.viewUp||this._getViewUp(e.viewPlaneNormal)};throw new Error("Invalid orientation object. It must contain viewPlaneNormal")}else if(typeof e=="string"){if(e==="acquisition")return this._getAcquisitionPlaneOrientation();if(e==="reformat"||e.includes("_reformat"))return a3e(this,{useViewportNormal:!0});if(W0[e])return this.viewportProperties.orientation=e,W0[e]}throw new Error(`Invalid orientation: ${e}. Valid orientations are: ${Object.keys(W0).join(", ")}`)}_getAcquisitionPlaneOrientation(){if(!this.getDefaultActor())return;const n=this.getVolumeId(),r=Ct.getVolume(n);if(!r)throw new Error(`imageVolume with id: ${n} does not exist in cache`);const{direction:i}=r,a=i.slice(6,9).map(s=>-s),o=i.slice(3,6).map(s=>-s);return{viewPlaneNormal:a,viewUp:o}}getSlabThickness(){const e=this.getActors();let n=Ki.MINIMUM_SLAB_THICKNESS;return e.forEach(r=>{r.slabThickness>n&&(n=r.slabThickness)}),n}getIntensityFromWorld(e){const n=this.getDefaultActor();if(!tc(n,"vtkVolume"))return;const{actor:r}=n,i=r.getMapper().getInputData(),a=Ct.getVolume(this.getVolumeId()),o=nd(i,e);return a.voxelManager.getAtIJKPoint(o)}getVolumeId(e){const n=this.getActors();if(!n)return;if(!e?.volumeId){const i=n.find(a=>a.actor.getClassName()==="vtkVolume");return i?.referencedId||i?.uid}const r=n.find(i=>i.actor.getClassName()==="vtkVolume"&&i.referencedId===e?.volumeId);return r?.referencedId||r?.uid}getViewReferenceId(e={}){let{volumeId:n,sliceIndex:r}=e;if(!n){const l=this.getActors();if(!l)return;n=l.find(u=>u.actor.getClassName()==="vtkVolume")?.referencedId}const i=this.getSliceIndex();r??=i;const{viewPlaneNormal:a,focalPoint:o}=this.getCamera(),s=n.includes("?")?"&":"?",c=a.map(l=>l.toFixed(3)).join(",");return`volumeId:${n}${s}sliceIndex=${r}&viewPlaneNormal=${c}`}_addVolumeId(e){this.volumeIds.add(e)}getAllVolumeIds(){return Array.from(this.volumeIds)}_configureRenderingPipeline(){const e=o3e();for(const n in this.renderingPipelineFunctions)if(Object.prototype.hasOwnProperty.call(this.renderingPipelineFunctions,n)){const r=this.renderingPipelineFunctions[n];this[n]=e?r.contextPool:r.tiled}}}function Cv(t,e){return!e||Lr(Vt(t,e),0)}function IMt(t,e){e.classHierarchy.push("vtkAbstractImageMapper"),t.getIsOpaque=()=>!0,t.getCurrentImage=()=>null,t.getBoundsForSlice=()=>(se.vtkErrorMacro("vtkAbstractImageMapper.getBoundsForSlice - NOT IMPLEMENTED"),op())}const NMt={slice:0,customDisplayExtent:[0,0,0,0,0,0],useCustomExtents:!1,backgroundColor:[0,0,0,1]};function PMt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,NMt,n),CF.extend(t,e,n),se.setGet(t,e,["slice","useCustomExtents"]),se.setGetArray(t,e,["customDisplayExtent"],6),se.setGetArray(t,e,["backgroundColor"],4),IMt(t,e)}var kMt={extend:PMt};function l3e(t,e,n){const r=n.getCurrentImage(),i=r.getExtent(),a=[i[0],i[2],i[4]],{ijkMode:o}=n.getClosestIJKAxis();let s=n.isA("vtkImageArrayMapper")?n.getSubSlice():n.getSlice();o!==n.getSlicingMode()&&(s=n.getSliceAtPosition(s)),a[o]+=s;const c=[0,0,0];r.indexToWorld(a,c),a[o]+=1;const l=[0,0,0];r.indexToWorld(a,l),l[0]-=c[0],l[1]-=c[1],l[2]-=c[2],Vr(l,l);const u=Os.intersectWithLine(t,e,c,l);if(u.intersection){const f=u.x,d=[0,0,0];return r.worldToIndex(f,d),{t:u.t,absoluteIJK:d}}return null}function AMt(t,e,n){const r=l3e(t,e,n);if(r){const a=n.getCurrentImage().getExtent(),o=[Math.round(r.absoluteIJK[0]),Math.round(r.absoluteIJK[1]),Math.round(r.absoluteIJK[2])];return o[0]<a[0]||o[0]>a[1]||o[1]<a[2]||o[1]>a[3]||o[2]<a[4]||o[2]>a[5]?null:{t:r.t,ijk:o}}return null}function LMt(t,e,n){const r=l3e(t,e,n);if(r){const a=n.getCurrentImage().getExtent(),o=r.absoluteIJK,s=[Math.floor(o[0]),Math.floor(o[1]),Math.floor(o[2])];if(s[0]<a[0]||s[0]>a[1]-1||s[1]<a[2]||s[1]>a[3]-1||s[2]<a[4]||s[2]>(a[5]?a[5]-1:a[5]))return null;const c=[o[0]-s[0],o[1]-s[1],o[2]-s[2]];return{t:r.t,ijk:s,pCoords:c}}return null}const{staticOffsetAPI:VMt,otherStaticMethods:$Mt}=qE,{SlicingMode:dr}=KE;function jMt(t,e){e.classHierarchy.push("vtkImageMapper"),t.getSliceAtPosition=r=>{const i=t.getCurrentImage();let a;if(r.length===3)a=r;else if(Number.isFinite(r)){const u=i.getBounds();switch(e.slicingMode){case dr.X:a=[r,(u[3]+u[2])/2,(u[5]+u[4])/2];break;case dr.Y:a=[(u[1]+u[0])/2,r,(u[5]+u[4])/2];break;case dr.Z:a=[(u[1]+u[0])/2,(u[3]+u[2])/2,r];break}}const o=[0,0,0];i.worldToIndex(a,o);const s=i.getExtent(),{ijkMode:c}=t.getClosestIJKAxis();let l=0;switch(c){case dr.I:l=cf(o[0],s[0],s[1]);break;case dr.J:l=cf(o[1],s[2],s[3]);break;case dr.K:l=cf(o[2],s[4],s[5]);break;default:return 0}return l},t.setSliceFromCamera=r=>{const i=r.getFocalPoint();switch(e.slicingMode){case dr.I:case dr.J:case dr.K:{const a=t.getSliceAtPosition(i);t.setSlice(a)}break;case dr.X:t.setSlice(i[0]);break;case dr.Y:t.setSlice(i[1]);break;case dr.Z:t.setSlice(i[2]);break}},t.setXSlice=r=>{t.setSlicingMode(dr.X),t.setSlice(r)},t.setYSlice=r=>{t.setSlicingMode(dr.Y),t.setSlice(r)},t.setZSlice=r=>{t.setSlicingMode(dr.Z),t.setSlice(r)},t.setISlice=r=>{t.setSlicingMode(dr.I),t.setSlice(r)},t.setJSlice=r=>{t.setSlicingMode(dr.J),t.setSlice(r)},t.setKSlice=r=>{t.setSlicingMode(dr.K),t.setSlice(r)},t.getSlicingModeNormal=()=>{const r=[0,0,0],i=t.getCurrentImage().getDirection();switch(e.slicingMode){case dr.X:r[0]=1;break;case dr.Y:r[1]=1;break;case dr.Z:r[2]=1;break;case dr.I:MC(i,[1,0,0],r);break;case dr.J:MC(i,[0,1,0],r);break;case dr.K:MC(i,[0,0,1],r);break}return r};function n(){let r;switch(e.slicingMode){case dr.X:r=0;break;case dr.Y:r=1;break;case dr.Z:r=2;break;default:e.closestIJKAxis={ijkMode:e.slicingMode,flip:!1};return}const i=t.getCurrentImage().getDirection(),a=fxe(i);let o=0;for(;o<3&&a[r+3*o]===0;++o);const s=a[r+3*o]<0;e.closestIJKAxis={ijkMode:o,flip:s}}t.setSlicingMode=r=>{e.slicingMode!==r&&(e.slicingMode=r,t.getCurrentImage()&&n(),t.modified())},t.getClosestIJKAxis=()=>((e.closestIJKAxis===void 0||e.closestIJKAxis.ijkMode===dr.NONE)&&t.getCurrentImage()&&n(),e.closestIJKAxis),t.getBounds=()=>{const r=t.getCurrentImage();if(!r)return op();if(!e.useCustomExtents)return r.getBounds();const i=e.customDisplayExtent.slice(),{ijkMode:a}=t.getClosestIJKAxis();let o=e.slice;switch(a!==e.slicingMode&&(o=t.getSliceAtPosition(e.slice)),a){case dr.I:i[0]=o,i[1]=o;break;case dr.J:i[2]=o,i[3]=o;break;case dr.K:i[4]=o,i[5]=o;break}return r.extentToBounds(i)},t.getBoundsForSlice=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e.slice,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const a=t.getCurrentImage();if(!a)return op();const o=a.getSpatialExtent(),{ijkMode:s}=t.getClosestIJKAxis();let c=r;switch(s!==e.slicingMode&&(c=t.getSliceAtPosition(r)),s){case dr.I:o[0]=c-i,o[1]=c+i;break;case dr.J:o[2]=c-i,o[3]=c+i;break;case dr.K:o[4]=c-i,o[5]=c+i;break}return a.extentToBounds(o)},t.intersectWithLineForPointPicking=(r,i)=>AMt(r,i,t),t.intersectWithLineForCellPicking=(r,i)=>LMt(r,i,t),t.getCurrentImage=()=>t.getInputData()}const UMt={slicingMode:dr.NONE,closestIJKAxis:{ijkMode:dr.NONE,flip:!1},renderToRectangle:!1,sliceAtFocalPoint:!1,preferSizeOverAccuracy:!1};function u3e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,UMt,n),kMt.extend(t,e,n),se.get(t,e,["slicingMode"]),se.setGet(t,e,["closestIJKAxis","renderToRectangle","sliceAtFocalPoint","preferSizeOverAccuracy"]),qE.implementCoincidentTopologyMethods(t,e),jMt(t,e)}const FMt=se.newInstance(u3e,"vtkImageMapper");var BMt={newInstance:FMt,extend:u3e,...VMt,...$Mt,...KE};const{InterpolationType:GC}=o6t,{vtkErrorMacro:Dte}=se,WC=4;function zMt(t,e){e.classHierarchy.push("vtkImageProperty"),t.getMTime=()=>{let n=e.mtime,r;for(let i=0;i<WC;i++)e.componentData[i].rGBTransferFunction&&(r=e.componentData[i].rGBTransferFunction.getMTime(),n=n>r?n:r),e.componentData[i].piecewiseFunction&&(r=e.componentData[i].piecewiseFunction.getMTime(),n=n>r?n:r);return n},t.setRGBTransferFunction=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,i=n,a=r;return Number.isInteger(n)||(a=n,i=0),e.componentData[i].rGBTransferFunction!==a?(e.componentData[i].rGBTransferFunction=a,t.modified(),!0):!1},t.getRGBTransferFunction=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e.componentData[n].rGBTransferFunction},t.setPiecewiseFunction=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,i=n,a=r;return Number.isInteger(n)||(a=n,i=0),e.componentData[i].piecewiseFunction!==a?(e.componentData[i].piecewiseFunction=a,t.modified(),!0):!1},t.getPiecewiseFunction=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e.componentData[n].piecewiseFunction},t.setScalarOpacity=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,i=n,a=r;return Number.isInteger(n)||(a=n,i=0),t.setPiecewiseFunction(i,a)},t.getScalarOpacity=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return t.getPiecewiseFunction(n)},t.setComponentWeight=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;if(n<0||n>=WC)return Dte("Invalid index"),!1;const i=Math.min(1,Math.max(0,r));return e.componentData[n].componentWeight!==i?(e.componentData[n].componentWeight=i,t.modified(),!0):!1},t.getComponentWeight=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return n<0||n>=WC?(Dte("Invalid index"),0):e.componentData[n].componentWeight},t.setInterpolationTypeToNearest=()=>t.setInterpolationType(GC.NEAREST),t.setInterpolationTypeToLinear=()=>t.setInterpolationType(GC.LINEAR),t.getInterpolationTypeAsString=()=>se.enumToString(GC,e.interpolationType)}const GMt={independentComponents:!1,interpolationType:GC.LINEAR,colorWindow:255,colorLevel:127.5,ambient:1,diffuse:0,opacity:1,useLookupTableScalarRange:!1,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function WMt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Object.assign(e,GMt,n),se.obj(t,e),!e.componentData){e.componentData=[];for(let r=0;r<WC;r++)e.componentData.push({rGBTransferFunction:null,piecewiseFunction:null,componentWeight:1})}se.setGet(t,e,["independentComponents","interpolationType","colorWindow","colorLevel","ambient","diffuse","opacity","useLookupTableScalarRange","useLabelOutline","labelOutlineOpacity"]),se.setGetArray(t,e,["labelOutlineThickness"]),zMt(t,e)}const HMt=se.newInstance(WMt,"vtkImageProperty");var qMt={newInstance:HMt};const{vtkDebugMacro:KMt}=se;function YMt(t,e){e.classHierarchy.push("vtkImageSlice"),t.getActors=()=>t,t.getImages=()=>t,t.getIsOpaque=()=>{if(e.forceOpaque)return!0;if(e.forceTranslucent)return!1;e.property||t.getProperty();let n=e.property.getOpacity()>=1;return n=n&&(!e.mapper||e.mapper.getIsOpaque()),n},t.hasTranslucentPolygonalGeometry=()=>!1,t.makeProperty=qMt.newInstance,t.getProperty=()=>(e.property===null&&(e.property=t.makeProperty()),e.property),t.getBounds=()=>{if(e.mapper===null)return e.bounds;const n=e.mapper.getBounds();if(!n||n.length!==6)return n;if(n[0]>n[1])return e.mapperBounds=n.concat(),e.bounds=[1,-1,1,-1,1,-1],e.boundsMTime.modified(),n;const r=i=>i[0].map((a,o)=>i.map(s=>s[o]));if(!e.mapperBounds||!r([n,e.mapperBounds]).reduce((i,a)=>i&&a[0]===a[1],!0)||t.getMTime()>e.boundsMTime.getMTime()){KMt("Recomputing bounds..."),e.mapperBounds=n.map(a=>a),t.computeMatrix();const i=new Float64Array(16);cr(i,e.matrix),ci.transformBounds(n,i,e.bounds),e.boundsMTime.modified()}return e.bounds},t.getBoundsForSlice=(n,r)=>{const i=e.mapper.getBoundsForSlice(n,r);if(!ci.isValid(i))return i;t.computeMatrix();const a=new Float64Array(16);return cr(a,e.matrix),ci.transformBounds(i,a)},t.getMinXBound=()=>t.getBounds()[0],t.getMaxXBound=()=>t.getBounds()[1],t.getMinYBound=()=>t.getBounds()[2],t.getMaxYBound=()=>t.getBounds()[3],t.getMinZBound=()=>t.getBounds()[4],t.getMaxZBound=()=>t.getBounds()[5],t.getMTime=()=>{let n=e.mtime;if(e.property!==null){const r=e.property.getMTime();n=r>n?r:n}return n},t.getRedrawMTime=()=>{let n=e.mtime;if(e.mapper!==null){let r=e.mapper.getMTime();n=r>n?r:n,e.mapper.getInput()!==null&&(e.mapper.getInputAlgorithm().update(),r=e.mapper.getInput().getMTime(),n=r>n?r:n)}if(e.property!==null){let r=e.property.getMTime();n=r>n?r:n,e.property.getRGBTransferFunction()!==null&&(r=e.property.getRGBTransferFunction().getMTime(),n=r>n?r:n)}return n},t.getSupportsSelection=()=>e.mapper?e.mapper.getSupportsSelection():!1}const XMt={mapper:null,property:null,forceOpaque:!1,forceTranslucent:!1,bounds:[...ci.INIT_BOUNDS]};function f3e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(e,XMt,n),gF.extend(t,e,n),e.boundsMTime={},se.obj(e.boundsMTime),se.set(t,e,["property"]),se.setGet(t,e,["mapper","forceOpaque","forceTranslucent"]),se.getArray(t,e,["bounds"],6),YMt(t,e)}const ZMt=se.newInstance(f3e,"vtkImageSlice");var QMt={newInstance:ZMt,extend:f3e};function JMt(t){return Object.values(ns).includes(t)?t:ns.LINEAR}function d3e(t){const n={...Ot(Js.IMAGE_PLANE,t)};return n.columnPixelSpacing||(n.columnPixelSpacing=1),n.rowPixelSpacing||(n.rowPixelSpacing=1),n.columnCosines||(n.columnCosines=[0,1,0]),n.rowCosines||(n.rowCosines=[1,0,0]),n.imagePositionPatient||(n.imagePositionPatient=[0,0,0]),n.imageOrientationPatient||(n.imageOrientationPatient=new Float32Array([1,0,0,0,1,0])),n}function h3e(t){const e=t.imageId,{pixelRepresentation:n,bitsAllocated:r,bitsStored:i,highBit:a,photometricInterpretation:o,samplesPerPixel:s}=Ot("imagePixelModule",e),{windowWidth:c,windowCenter:l,voiLUTFunction:u}=t,{modality:f}=Ot("generalSeriesModule",e),d=Ot("scalingModule",e),h=Ot(Js.CALIBRATION,e),m=JMt(u),p=d3e(e);return{calibration:h,scalingFactor:d,voiLUTFunction:m,modality:f,imagePlaneModule:p,imagePixelModule:{bitsAllocated:r,bitsStored:i,samplesPerPixel:s,highBit:a,photometricInterpretation:o,pixelRepresentation:n,windowWidth:c,windowCenter:l,modality:f,voiLUTFunction:m}}}function g3e(t){const{imagePlaneModule:e,imagePixelModule:n,voiLUTFunction:r,modality:i,scalingFactor:a,calibration:o}=h3e(t);let{rowCosines:s,columnCosines:c}=e;(s==null||c==null)&&(s=[1,0,0],c=[0,1,0]);const l=Zn(s[0],s[1],s[2]),u=Zn(c[0],c[1],c[2]),f=ut();Tr(f,l,u);let d=e.imagePositionPatient;d==null&&(d=[0,0,0]);const h=e.columnPixelSpacing||t.columnPixelSpacing,m=e.rowPixelSpacing||t.rowPixelSpacing,p=t.columns,y=t.rows,x=_u,S=1;return!n.photometricInterpretation&&t.sizeInBytes===3*t.width*t.height&&(t.numberOfComponents=3),{numberOfComponents:t.numberOfComponents||eRt(n.photometricInterpretation),origin:d,direction:[...l,...u,...f],dimensions:[p,y,S],spacing:[h,m,x],numVoxels:p*y*S,imagePlaneModule:e,imagePixelModule:n,bitsAllocated:n.bitsAllocated,voiLUTFunction:r,modality:i,scalingFactor:a,calibration:o,scanAxisNormal:f}}function eRt(t){let e=1;return(t==="RGB"||t?.includes("YBR")||t==="PALETTE COLOR")&&(e=3),e}var HC={exports:{}},tRt=HC.exports,Mte;function nRt(){return Mte||(Mte=1,(function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(tRt,function(){var e=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],a={},o=null;function s(p,y){var x=p[y];if(typeof x.bind=="function")return x.bind(p);try{return Function.prototype.bind.call(x,p)}catch{return function(){return Function.prototype.apply.apply(x,[p,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(p){return p==="debug"&&(p="log"),typeof console===n?!1:p==="trace"&&r?c:console[p]!==void 0?s(console,p):console.log!==void 0?s(console,"log"):e}function u(){for(var p=this.getLevel(),y=0;y<i.length;y++){var x=i[y];this[x]=y<p?e:this.methodFactory(x,p,this.name)}if(this.log=this.debug,typeof console===n&&p<this.levels.SILENT)return"No console available for logging"}function f(p){return function(){typeof console!==n&&(u.call(this),this[p].apply(this,arguments))}}function d(p,y,x){return l(p)||f.apply(this,arguments)}function h(p,y){var x=this,S,C,_,T="loglevel";typeof p=="string"?T+=":"+p:typeof p=="symbol"&&(T=void 0);function O(L){var $=(i[L]||"silent").toUpperCase();if(!(typeof window===n||!T)){try{window.localStorage[T]=$;return}catch{}try{window.document.cookie=encodeURIComponent(T)+"="+$+";"}catch{}}}function M(){var L;if(!(typeof window===n||!T)){try{L=window.localStorage[T]}catch{}if(typeof L===n)try{var $=window.document.cookie,W=encodeURIComponent(T),G=$.indexOf(W+"=");G!==-1&&(L=/^([^;]+)/.exec($.slice(G+W.length+1))[1])}catch{}return x.levels[L]===void 0&&(L=void 0),L}}function I(){if(!(typeof window===n||!T)){try{window.localStorage.removeItem(T)}catch{}try{window.document.cookie=encodeURIComponent(T)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function V(L){var $=L;if(typeof $=="string"&&x.levels[$.toUpperCase()]!==void 0&&($=x.levels[$.toUpperCase()]),typeof $=="number"&&$>=0&&$<=x.levels.SILENT)return $;throw new TypeError("log.setLevel() called with invalid level: "+L)}x.name=p,x.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},x.methodFactory=y||d,x.getLevel=function(){return _??C??S},x.setLevel=function(L,$){return _=V(L),$!==!1&&O(_),u.call(x)},x.setDefaultLevel=function(L){C=V(L),M()||x.setLevel(L,!1)},x.resetLevel=function(){_=null,I(),u.call(x)},x.enableAll=function(L){x.setLevel(x.levels.TRACE,L)},x.disableAll=function(L){x.setLevel(x.levels.SILENT,L)},x.rebuild=function(){if(o!==x&&(S=V(o.getLevel())),u.call(x),o===x)for(var L in a)a[L].rebuild()},S=V(o?o.getLevel():"WARN");var k=M();k!=null&&(_=V(k)),u.call(x)}o=new h,o.getLogger=function(y){if(typeof y!="symbol"&&typeof y!="string"||y==="")throw new TypeError("You must supply a name when creating a logger.");var x=a[y];return x||(x=a[y]=new h(y,o.methodFactory)),x};var m=typeof window!==n?window.log:void 0;return o.noConflict=function(){return typeof window!==n&&window.log===o&&(window.log=m),o},o.getLoggers=function(){return a},o.default=o,o})})(HC)),HC.exports}var rRt=nRt();const iRt=ka(rRt),p3e=iRt.noConflict();typeof window<"u"&&(window.log=p3e);function i9(t){const e=p3e.getLogger(t[0]);return e.getLogger=(...n)=>i9(`${t}.${n.join(".")}`),e}function IF(...t){return i9(t.join("."))}const $2=i9("cs3d"),NF=$2.getLogger("core"),aRt=$2.getLogger("tools"),oRt=$2.getLogger("dicomImageLoader"),sRt=$2.getLogger("ai"),cRt=$2.getLogger("examples"),lRt=IF("consistency","dicom"),uRt=IF("consistency","image"),fRt=Object.freeze(Object.defineProperty({__proto__:null,aiLog:sRt,coreLog:NF,cs3dLog:$2,dicomConsistencyLog:lRt,examplesLog:cRt,getLogger:IF,getRootLogger:i9,imageConsistencyLog:uRt,loaderLog:oRt,toolsLog:aRt},Symbol.toStringTag,{value:"Module"}));function m3e(t){const e=yh.newInstance();let n=0,r=1024;return t.lower!==void 0&&t.upper!==void 0&&(n=t.lower,r=t.upper),e.addRGBPoint(n,0,0,0),e.addRGBPoint(r,1,1,1),e}function a9(t,e){const n=e.voxelManager.getScalarData();if(!t.getPointData)return;const r=t.getPointData().getScalars().getData();if(e.color&&e.rgba){const i=new Uint8Array(e.columns*e.rows*3);for(let a=0;a<e.columns*e.rows;a++)i[a*3]=n[a*4],i[a*3+1]=n[a*4+1],i[a*3+2]=n[a*4+2];e.rgba=!1,e.getPixelData=()=>i,r.set(i)}else r.set(n);t.modified()}function Wn(){return window.performance?performance.now():Date.now()}function dRt(t,e){return function(n){const r=((n-(e-.5))/(t-1)+.5)*255;return Math.min(Math.max(r,0),255)}}function hRt(t){const n=Math.max(...t.lut).toString(2).length-8,r=t.lut[0]>>n,i=t.lut[t.lut.length-1]>>n,a=t.firstValueMapped+t.lut.length-1;return function(o){return o<t.firstValueMapped?r:o>=a?i:t.lut[o-t.firstValueMapped]>>n}}function v3e(t,e,n){return n?hRt(n):dRt(t,e)}function gRt(t,e,n,r,i){const a=t.maxPixelValue,o=t.minPixelValue,s=Math.min(o,0);if(t.cachedLut===void 0){const u=a-s+1;t.cachedLut={},t.cachedLut.lutArray=new Uint8ClampedArray(u)}const c=t.cachedLut.lutArray,l=v3e(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n,i);if(r)for(let u=o;u<=a;u++)c[u+-s]=255-l(u);else for(let u=o;u<=a;u++)c[u+-s]=l(u);return c}function pRt(t,e,n){let r=Wn();const i=t.voxelManager.getScalarData();t.stats.lastGetPixelDataTime=Wn()-r;const a=t.minPixelValue;let o=0,s=0;const c=i.length;if(r=Wn(),a<0)for(;s<c;)n[o++]=e[i[s++]+-a],n[o++]=e[i[s++]+-a],n[o++]=e[i[s++]+-a],n[o++]=255;else for(;s<c;)n[o++]=e[i[s++]],n[o++]=e[i[s++]],n[o++]=e[i[s++]],n[o++]=255;t.stats.lastStoredPixelDataToCanvasImageDataTime=Wn()-r}function mRt(t,e,n){let r=Wn();const i=t.getPixelData();t.stats.lastGetPixelDataTime=Wn()-r;const a=t.minPixelValue;let o=0,s=0;const c=i.length;if(r=Wn(),a<0)for(;s<c;)n[o++]=e[i[s++]+-a],n[o++]=e[i[s++]+-a],n[o++]=e[i[s++]+-a],n[o++]=i[s++];else for(;s<c;)n[o++]=e[i[s++]],n[o++]=e[i[s++]],n[o++]=e[i[s++]],n[o++]=i[s++];t.stats.lastStoredPixelDataToCanvasImageDataTime=Wn()-r}class j2{constructor(){this.reset()}getMatrix(){return this.m}reset(){this.m=[1,0,0,1,0,0]}clone(){const e=new j2;return e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5],e}multiply(e){const n=this.m[0]*e[0]+this.m[2]*e[1],r=this.m[1]*e[0]+this.m[3]*e[1],i=this.m[0]*e[2]+this.m[2]*e[3],a=this.m[1]*e[2]+this.m[3]*e[3],o=this.m[0]*e[4]+this.m[2]*e[5]+this.m[4],s=this.m[1]*e[4]+this.m[3]*e[5]+this.m[5];this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=o,this.m[5]=s}invert(){const e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*e,r=-this.m[1]*e,i=-this.m[2]*e,a=this.m[0]*e,o=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),s=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=o,this.m[5]=s}rotate(e){const n=Math.cos(e),r=Math.sin(e),i=this.m[0]*n+this.m[2]*r,a=this.m[1]*n+this.m[3]*r,o=this.m[0]*-r+this.m[2]*n,s=this.m[1]*-r+this.m[3]*n;this.m[0]=i,this.m[1]=a,this.m[2]=o,this.m[3]=s}translate(e,n){this.m[4]+=this.m[0]*e+this.m[2]*n,this.m[5]+=this.m[1]*e+this.m[3]*n}scale(e,n){this.m[0]*=e,this.m[1]*=e,this.m[2]*=n,this.m[3]*=n}transformPoint(e){const n=e[0],r=e[1];return[n*this.m[0]+r*this.m[2]+this.m[4],n*this.m[1]+r*this.m[3]+this.m[5]]}}function Xw(t,e){const n=new j2;if(!t.viewport.displayedArea)return n;n.translate(t.canvas.width/2,t.canvas.height/2);const r=t.viewport.rotation;r!==0&&n.rotate(r*Math.PI/180);let i=t.viewport.scale,a=t.viewport.scale;const o=t.viewport.displayedArea.brhc.x-(t.viewport.displayedArea.tlhc.x-1),s=t.viewport.displayedArea.brhc.y-(t.viewport.displayedArea.tlhc.y-1);if(t.viewport.displayedArea.presentationSizeMode==="NONE")t.image.rowPixelSpacing<t.image.columnPixelSpacing?i*=t.image.columnPixelSpacing/t.image.rowPixelSpacing:t.image.columnPixelSpacing<t.image.rowPixelSpacing&&(a*=t.image.rowPixelSpacing/t.image.columnPixelSpacing);else if(i=t.viewport.displayedArea.columnPixelSpacing,a=t.viewport.displayedArea.rowPixelSpacing,t.viewport.displayedArea.presentationSizeMode==="SCALE TO FIT"){const c=t.canvas.height/(s*a),l=t.canvas.width/(o*i);i=a=Math.min(l,c),t.viewport.displayedArea.rowPixelSpacing<t.viewport.displayedArea.columnPixelSpacing?i*=t.viewport.displayedArea.columnPixelSpacing/t.viewport.displayedArea.rowPixelSpacing:t.viewport.displayedArea.columnPixelSpacing<t.viewport.displayedArea.rowPixelSpacing&&(a*=t.viewport.displayedArea.rowPixelSpacing/t.viewport.displayedArea.columnPixelSpacing)}return n.scale(i,a),r!==0&&n.rotate(-r*Math.PI/180),n.translate(t.viewport.translation.x,t.viewport.translation.y),r!==0&&n.rotate(r*Math.PI/180),t.viewport.hflip&&n.scale(-1,1),t.viewport.vflip&&n.scale(1,-1),n.translate(-o/2,-s/2),n}function PF(t,e,n){if(t===void 0)throw new Error("setToPixelCoordinateSystem: parameter enabledElement must not be undefined");if(e===void 0)throw new Error("setToPixelCoordinateSystem: parameter context must not be undefined");const i=Xw(t).getMatrix();e.setTransform(i[0],i[1],i[2],i[3],i[4],i[5])}function kF(t,e){const n=t.renderingTools.lastRenderedImageId,r=t.renderingTools.lastRenderedViewport;return e.imageId!==n||!r||r.windowCenter!==t.viewport.voi.windowCenter||r.windowWidth!==t.viewport.voi.windowWidth||r.invert!==t.viewport.invert||r.rotation!==t.viewport.rotation||r.hflip!==t.viewport.hflip||r.vflip!==t.viewport.vflip||r.modalityLUT!==t.viewport.modalityLUT||r.voiLUT!==t.viewport.voiLUT||r.colormap!==t.viewport.colormap}function n6(t,e){const n=t.renderingTools.renderCanvas;n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.fillStyle="white",r.fillRect(0,0,n.width,n.height);const i=r.getImageData(0,0,e.width,e.height);t.renderingTools.renderCanvasContext=r,t.renderingTools.renderCanvasData=i}function AF(t){const e=t.image.imageId,n=t.viewport,r=t.image.color;return t.renderingTools.lastRenderedImageId=e,t.renderingTools.lastRenderedIsColor=r,t.renderingTools.lastRenderedViewport={windowCenter:n.voi.windowCenter,windowWidth:n.voi.windowWidth,invert:n.invert,rotation:n.rotation,hflip:n.hflip,vflip:n.vflip,modalityLUT:n.modalityLUT,voiLUT:n.voiLUT,colormap:n.colormap},t.renderingTools}const y3e="viewport-element",x3e="cornerstone-canvas",Rte=1e-4;function o9(t,e=512,n=512){const r=document.createElement("canvas");return t&&(r.style.position="absolute",r.style.width="100%",r.style.height="100%",r.style.imageRendering="pixelated",r.classList.add(x3e),t.appendChild(r)),r}function vRt(t){const e=document.createElement("div");return e.style.position="relative",e.style.width="100%",e.style.height="100%",e.style.overflow="hidden",e.classList.add(y3e),t.appendChild(e),e}function xu(t){const e=`canvas.${x3e}`,n=`div.${y3e}`,r=t.querySelector(n)||vRt(t),i=r.querySelector(e);if(i)return i;const a=o9(r),o=r.getBoundingClientRect(),s=window.devicePixelRatio||1,c=Math.ceil(o.width*s),l=Math.ceil(o.height*s);return a.width=c,a.height=l,a}function yRt(t,e){return t.cachedLut!==void 0&&t.cachedLut.windowCenter===e.voi.windowCenter&&t.cachedLut.windowWidth===e.voi.windowWidth&&t.cachedLut.invert===e.invert||(gRt(t,e.voi.windowWidth,e.voi.windowCenter,e.invert),t.cachedLut.windowWidth=e.voi.windowWidth,t.cachedLut.windowCenter=e.voi.windowCenter,t.cachedLut.invert=e.invert),t.cachedLut.lutArray}function xRt(t,e,n){const r=t.renderingTools.lastRenderedIsColor;(!t.renderingTools.renderCanvas||!r)&&(t.renderingTools.renderCanvas=o9(null,e.width,e.height));const i=t.renderingTools.renderCanvas,{windowWidth:a,windowCenter:o}=t.viewport.voi;if((a===256||a===255)&&(o===128||o===127)&&!t.viewport.invert&&e.getCanvas&&e.getCanvas())return e.getCanvas();if(!kF(t,e)&&!n)return i;(!t.renderingTools.renderCanvasContext||i.width!==e.width||i.height!==e.height)&&n6(t,e);let s=Wn();const c=yRt(e,t.viewport);e.stats=e.stats||{},e.stats.lastLutGenerateTime=Wn()-s;const l=t.renderingTools.renderCanvasData,u=t.renderingTools.renderCanvasContext;return e.rgba?mRt(e,c,l.data):pRt(e,c,l.data),s=Wn(),u.putImageData(l,0,0),e.stats.lastPutImageDataTime=Wn()-s,i}function wRt(t,e){if(t===void 0)throw new Error("renderColorImage: enabledElement parameter must not be undefined");const n=t.image;if(n===void 0)throw new Error("renderColorImage: image must be loaded before it can be drawn");const r=t.canvas.getContext("2d");r.setTransform(1,0,0,1,0,0),r.fillStyle="black",r.fillRect(0,0,t.canvas.width,t.canvas.height),r.imageSmoothingEnabled=!t.viewport.pixelReplication,PF(t,r);const i=xRt(t,n,e),a=t.viewport.displayedArea.tlhc.x-1,o=t.viewport.displayedArea.tlhc.y-1,s=t.viewport.displayedArea.brhc.x-a,c=t.viewport.displayedArea.brhc.y-o;r.drawImage(i,a,o,s,c,0,0,s,c),t.renderingTools=AF(t)}function bRt(t,e,n){let r=Wn();const i=t.voxelManager.getScalarData();t.stats.lastGetPixelDataTime=Wn()-r;const a=i.length,o=t.minPixelValue;let s=3,c=0;if(r=Wn(),i instanceof Int16Array)if(o<0)for(;c<a;)n[s]=e[i[c++]+-o],s+=4;else for(;c<a;)n[s]=e[i[c++]],s+=4;else if(i instanceof Uint16Array)for(;c<a;)n[s]=e[i[c++]],s+=4;else if(o<0)for(;c<a;)n[s]=e[i[c++]+-o],s+=4;else for(;c<a;)n[s]=e[i[c++]],s+=4;t.stats.lastStoredPixelDataToCanvasImageDataTime=Wn()-r}function SRt(t,e,n){let r=Wn();const i=t.voxelManager.getScalarData();t.stats.lastGetPixelDataTime=Wn()-r;const a=i.length;let o=3,s=0;for(r=Wn();s<a;)n[o]=e(i[s++]),o+=4;t.stats.lastStoredPixelDataToCanvasImageDataTime=Wn()-r}function CRt(t,e,n){let r=Wn();const i=t.voxelManager.getScalarData();t.stats.lastGetPixelDataTime=Wn()-r;const a=i.length,o=t.minPixelValue;let s=0,c=0,l;if(r=Wn(),i instanceof Int16Array)if(o<0)for(;c<a;)l=e[i[c++]+-o],n[s++]=l,n[s++]=l,n[s++]=l,n[s++]=255;else for(;c<a;)l=e[i[c++]],n[s++]=l,n[s++]=l,n[s++]=l,n[s++]=255;else if(i instanceof Uint16Array)for(;c<a;)l=e[i[c++]],n[s++]=l,n[s++]=l,n[s++]=l,n[s++]=255;else if(o<0)for(;c<a;)l=e[i[c++]+-o],n[s++]=l,n[s++]=l,n[s++]=l,n[s++]=255;else for(;c<a;)l=e[i[c++]],n[s++]=l,n[s++]=l,n[s++]=l,n[s++]=255;t.stats.lastStoredPixelDataToCanvasImageDataTime=Wn()-r}function _Rt(t,e){if(TRt(t))return;const n=e.maxPixelValue*e.slope+e.intercept,r=e.minPixelValue*e.slope+e.intercept,i=n-r,a=(n+r)/2;t.voi===void 0?t.voi={windowWidth:i,windowCenter:a,voiLUTFunction:e.voiLUTFunction}:(t.voi.windowWidth=i,t.voi.windowCenter=a)}function TRt(t){return t.voiLUT&&t.voiLUT.lut&&t.voiLUT.lut.length>0||t.voi.windowWidth!==void 0&&t.voi.windowCenter!==void 0}function Ite(t,e){return!t&&!e?!0:!t||!e?!1:t.id===e.id}function ERt(t,e){return n=>n*t+e}function ORt(t){const e=t.lut[0],n=t.lut[t.lut.length-1],r=t.firstValueMapped+t.lut.length;return i=>i<t.firstValueMapped?e:i>=r?n:t.lut[i]}function DRt(t,e,n){return n?ORt(n):ERt(t,e)}function MRt(t,e,n,r,i,a){const o=t.maxPixelValue,s=t.minPixelValue,c=Math.min(s,0);if(t.cachedLut===void 0){const d=o-c+1;t.cachedLut={},t.cachedLut.lutArray=new Uint8ClampedArray(d)}const l=t.cachedLut.lutArray,u=DRt(t.slope,t.intercept,i),f=v3e(e,n,a);if(t.isPreScaled)if(r)for(let d=s;d<=o;d++)l[d+-c]=255-f(d);else for(let d=s;d<=o;d++)l[d+-c]=f(d);else if(r)for(let d=s;d<=o;d++)l[d+-c]=255-f(u(d));else for(let d=s;d<=o;d++)l[d+-c]=f(u(d));return l}function w3e(t,e,n){return t.cachedLut!==void 0&&t.cachedLut.windowCenter===e.voi.windowCenter&&t.cachedLut.windowWidth===e.voi.windowWidth&&Ite(t.cachedLut.modalityLUT,e.modalityLUT)&&Ite(t.cachedLut.voiLUT,e.voiLUT)&&t.cachedLut.invert===e.invert&&!n||(_Rt(e,t),MRt(t,e.voi.windowWidth,e.voi.windowCenter,e.invert,e.modalityLUT,e.voiLUT),t.cachedLut.windowWidth=e.voi.windowWidth,t.cachedLut.windowCenter=e.voi.windowCenter,t.cachedLut.invert=e.invert,t.cachedLut.voiLUT=e.voiLUT,t.cachedLut.modalityLUT=e.modalityLUT),t.cachedLut.lutArray}function RRt(t,e,n,r=!0){const i=t.renderingTools.lastRenderedIsColor;(!t.renderingTools.renderCanvas||i)&&(t.renderingTools.renderCanvas=o9(null,e.width,e.height),n6(t,e));const a=t.renderingTools.renderCanvas;if(!kF(t,e)&&!n)return a;(a.width!==e.width||a.height!==e.height)&&n6(t,e),e.stats=e.stats||{};const o=t.renderingTools.renderCanvasData,s=t.renderingTools.renderCanvasContext;let c=Wn();e.stats.lastLutGenerateTime=Wn()-c;const{viewport:l}=t;if(l.modality==="PT"&&e.isPreScaled){const{windowWidth:u,windowCenter:f}=l.voi,d=f-u/2,p=255/(f+u/2-d);let y;l.invert?y=x=>255-(x-d)*p:y=x=>(x-d)*p,SRt(e,y,o.data)}else{const u=w3e(e,l,n);r?bRt(e,u,o.data):CRt(e,u,o.data)}return c=Wn(),s.putImageData(o,0,0),e.stats.lastPutImageDataTime=Wn()-c,a}function IRt(t,e){if(t===void 0)throw new Error("drawImage: enabledElement parameter must not be undefined");const n=t.image;if(n===void 0)throw new Error("drawImage: image must be loaded before it can be drawn");const r=t.canvas.getContext("2d");r.setTransform(1,0,0,1,0,0),r.fillStyle="black",r.fillRect(0,0,t.canvas.width,t.canvas.height),r.imageSmoothingEnabled=!t.viewport.pixelReplication,PF(t,r);const i=RRt(t,n,e),a=t.viewport.displayedArea.tlhc.x-1,o=t.viewport.displayedArea.tlhc.y-1,s=t.viewport.displayedArea.brhc.x-a,c=t.viewport.displayedArea.brhc.y-o;r.drawImage(i,a,o,s,c,0,0,s,c),t.renderingTools=AF(t)}const bk=0,Sk=1,NRt=2;function PRt(t,e,n){if(t>1)throw new Error("HSVToRGB expects hue < 1");const r=[];if(e===0)return r[0]=n,r[1]=n,r[2]=n,r;const i=Math.floor(t*6),a=6*t-i,o=n*(1-e),s=n*(1-e*a),c=n*(1-e*(1-a));switch(i){case 0:case 6:r[0]=n,r[1]=c,r[2]=o;break;case 1:r[0]=s,r[1]=n,r[2]=o;break;case 2:r[0]=o,r[1]=n,r[2]=c;break;case 3:r[0]=o,r[1]=s,r[2]=n;break;case 4:r[0]=c,r[1]=o,r[2]=n;break;case 5:r[0]=n,r[1]=o,r[2]=s;break}return r}function kRt(t,e){let n;return t<e.Range[0]?n=e.MaxIndex+bk+1.5:t>e.Range[1]?n=e.MaxIndex+Sk+1.5:n=(t+e.Shift)*e.Scale,Math.floor(n)}class LF{constructor(){this.NumberOfColors=256,this.Ramp="linear",this.TableRange=[0,255],this.HueRange=[0,.66667],this.SaturationRange=[1,1],this.ValueRange=[1,1],this.AlphaRange=[1,1],this.NaNColor=[128,0,0,255],this.BelowRangeColor=[0,0,0,255],this.UseBelowRangeColor=!0,this.AboveRangeColor=[255,255,255,255],this.UseAboveRangeColor=!0,this.InputRange=[0,255],this.Table=[]}setNumberOfTableValues(e){this.NumberOfColors=e}setRamp(e){this.Ramp=e}setTableRange(e,n){this.TableRange[0]=e,this.TableRange[1]=n}setHueRange(e,n){this.HueRange[0]=e,this.HueRange[1]=n}setSaturationRange(e,n){this.SaturationRange[0]=e,this.SaturationRange[1]=n}setValueRange(e,n){this.ValueRange[0]=e,this.ValueRange[1]=n}setRange(e,n){this.InputRange[0]=e,this.InputRange[1]=n}setAlphaRange(e,n){this.AlphaRange[0]=e,this.AlphaRange[1]=n}getColor(e){return this.mapValue(e)}build(e){if(this.Table.length>1&&!e)return;this.Table=[];const n=this.NumberOfColors-1;let r,i,a,o;n?(r=(this.HueRange[1]-this.HueRange[0])/n,i=(this.SaturationRange[1]-this.SaturationRange[0])/n,a=(this.ValueRange[1]-this.ValueRange[0])/n,o=(this.AlphaRange[1]-this.AlphaRange[0])/n):r=i=a=o=0;for(let s=0;s<=n;s++){const c=this.HueRange[0]+s*r,l=this.SaturationRange[0]+s*i,u=this.ValueRange[0]+s*a,f=this.AlphaRange[0]+s*o,d=PRt(c,l,u),h=[0,0,0,0];switch(this.Ramp){case"scurve":h[0]=Math.floor(127.5*(1+Math.cos((1-d[0])*Math.PI))),h[1]=Math.floor(127.5*(1+Math.cos((1-d[1])*Math.PI))),h[2]=Math.floor(127.5*(1+Math.cos((1-d[2])*Math.PI))),h[3]=Math.floor(f*255);break;case"linear":h[0]=Math.floor(d[0]*255+.5),h[1]=Math.floor(d[1]*255+.5),h[2]=Math.floor(d[2]*255+.5),h[3]=Math.floor(f*255+.5);break;case"sqrt":h[0]=Math.floor(Math.sqrt(d[0])*255+.5),h[1]=Math.floor(Math.sqrt(d[1])*255+.5),h[2]=Math.floor(Math.sqrt(d[2])*255+.5),h[3]=Math.floor(Math.sqrt(f)*255+.5);break;default:throw new Error(`Invalid Ramp value (${this.Ramp})`)}this.Table.push(h)}this.buildSpecialColors()}buildSpecialColors(){const e=this.NumberOfColors,n=e+bk,r=e+Sk,i=e+NRt;this.UseBelowRangeColor||e===0?this.Table[n]=this.BelowRangeColor:this.Table[n]=this.Table[0],this.UseAboveRangeColor||e===0?this.Table[r]=this.AboveRangeColor:this.Table[r]=this.Table[e-1],this.Table[i]=this.NaNColor}mapValue(e){const n=this.getIndex(e);if(n<0)return this.NaNColor;if(n===0){if(this.UseBelowRangeColor&&e<this.TableRange[0])return this.BelowRangeColor}else if(n===this.NumberOfColors-1&&this.UseAboveRangeColor&&e>this.TableRange[1])return this.AboveRangeColor;return this.Table[n]}getIndex(e){const n={Range:[],MaxIndex:this.NumberOfColors-1,Shift:-this.TableRange[0],Scale:1};if(this.TableRange[1]<=this.TableRange[0]?n.Scale=Number.MAX_VALUE:n.Scale=n.MaxIndex/(this.TableRange[1]-this.TableRange[0]),n.Range[0]=this.TableRange[0],n.Range[1]=this.TableRange[1],isNaN(e))return-1;let r=kRt(e,n);return r===this.NumberOfColors+bk?r=0:r===this.NumberOfColors+Sk&&(r=this.NumberOfColors-1),r}setTableValue(e,n,r,i,a){let o;if(typeof n=="number"&&r!==void 0&&i!==void 0&&a!==void 0)o=[n,r,i,a];else if(Array.isArray(n))o=n;else throw new Error("Invalid arguments for setTableValue");if(e<0)throw new Error(`Can't set the table value for negative index (${e})`);if(e>=this.NumberOfColors)throw new Error(`Index ${e} is greater than the number of colors ${this.NumberOfColors}`);this.Table[e]=o,(e===0||e===this.NumberOfColors-1)&&this.buildSpecialColors()}}const Nte=[0,0,0,0];function ARt(t,e,n){n=n===null?100:n;const r=(e-t)/(n-1),i=[];for(;n-- >0;)i.push(t),t+=r;return i[i.length-1]=e,i}function LRt(t,e){let n=0,r=t.length-1;for(;n<=r;){const i=n+Math.floor((r-n)/2),a=t[i];if(a===e)return i;e<a?r=i-1:n=i+1}return n}function VRt(t,e){let n;const r=[],i=e.length;for(t.sort(function(a,o){return a-o}),n=0;n<i;n++)r[n]=LRt(t,e[n]);return r}function HR(t,e,n){let r;const i=[],a=[],o=[],s=[];for(n=n===null?1:n,r=0;r<e.length;r++){const u=e[r];i.push((t-1)*u[0]),a.push(u[1]),o.push(u[1])}const c=ARt(0,1,t);for(r=0;r<t;r++)c[r]=(t-1)*Math.pow(c[r],n);const l=VRt(i,c);for(r=1;r<t-1;r++){const u=l[r],f=(c[r]-i[u-1])/(i[u]-i[u-1]),d=a[u]-o[u-1];s[r]=f*d+o[u-1]}return s[0]=o[0],s[t-1]=a[e.length-1],s}function $Rt(t,e,n){let r;const i=[];e=e===null?256:e,n=n===null?1:n;const a=HR(e,t.red,n),o=HR(e,t.green,n),s=HR(e,t.blue,n);for(r=0;r<e;r++){const c=Math.round(a[r]*255),l=Math.round(o[r]*255),u=Math.round(s[r]*255),f=[c,l,u,255];i.push(f)}return i}function jRt(t,e){let n=GP[t];return n||(n=GP[t]={name:"",colors:[]}),!n.colors&&n.segmentedData&&(n.colors=$Rt(n.segmentedData,n.numColors,n.gamma)),{getId(){return t},getColorSchemeName(){return n.name},setColorSchemeName(i){n.name=i},getNumberOfColors(){return n.colors.length},setNumberOfColors(i){for(;n.colors.length<i;)n.colors.push(Nte);n.colors.length=i},getColor(i){return this.isValidIndex(i)?n.colors[i]:Nte},getColorRepeating(i){const a=n.colors.length;return i=a?i%a:0,this.getColor(i)},setColor(i,a){this.isValidIndex(i)&&(n.colors[i]=a)},addColor(i){n.colors.push(i)},insertColor(i,a){this.isValidIndex(i)&&n.colors.splice(i,1,a)},removeColor(i){this.isValidIndex(i)&&n.colors.splice(i,1)},clearColors(){n.colors=[]},buildLookupTable(i){if(!i)return;const a=n.colors.length;i.setNumberOfTableValues(a);for(let o=0;o<a;o++)i.setTableValue(o,n.colors[o])},createLookupTable(){const i=new LF;return this.buildLookupTable(i),i},isValidIndex(i){return i>=0&&i<n.colors.length}}}function URt(t,e,n,r){let i=Wn();const a=t.voxelManager.getScalarData();t.stats.lastGetPixelDataTime=Wn()-i;const o=a.length,s=t.minPixelValue;let c=0,l=0,u,f,d;if(i=Wn(),n instanceof LF?d=n.Table:d=n,s<0)for(;l<o;)u=e[a[l++]+-s],f=d[u],r[c++]=f[0],r[c++]=f[1],r[c++]=f[2],r[c++]=f[3];else for(;l<o;)u=e[a[l++]],f=d[u],r[c++]=f[0],r[c++]=f[1],r[c++]=f[2],r[c++]=f[3];t.stats.lastStoredPixelDataToCanvasImageDataTime=Wn()-i}function FRt(t,e,n,r){let i=Wn();const a=t.voxelManager.getScalarData();t.stats.lastGetPixelDataTime=Wn()-i;const o=a.length,s=t.minPixelValue;let c=0,l=0,u,f,d;if(i=Wn(),n instanceof LF?d=n.Table:d=n,s<0)for(;l<o;)u=e(a[l++]+-s),f=d[u],r[c++]=f[0],r[c++]=f[1],r[c++]=f[2],r[c++]=f[3];else for(;l<o;)u=e(a[l++]),f=d[u],r[c++]=f[0],r[c++]=f[1],r[c++]=f[2],r[c++]=f[3];t.stats.lastStoredPixelDataToCanvasImageDataTime=Wn()-i}function Ck(t,e,n){return Math.max(e,Math.min(n,t))}function BRt(t,e,n){t.renderingTools.renderCanvas||(t.renderingTools.renderCanvas=o9(null,e.width,e.height));const r=t.renderingTools.renderCanvas;let i=t.viewport.colormap||t.options.colormap;if(t.options&&t.options.colormap&&console.warn("enabledElement.options.colormap is deprecated. Use enabledElement.viewport.colormap instead"),i&&typeof i=="string"&&(i=jRt(i)),!i)throw new Error("renderPseudoColorImage: colormap not found.");const a=i.getId();if(!kF(t,e)&&!n&&t.renderingTools.colormapId===a)return r;(!t.renderingTools.renderCanvasContext||r.width!==e.width||r.height!==e.height)&&n6(t,e);let o=Wn();(!t.renderingTools.colorLUT||n||t.renderingTools.colormapId!==a)&&(i.setNumberOfColors(256),t.renderingTools.colorLUT=i.createLookupTable(),t.renderingTools.colormapId=a);const s=t.renderingTools.renderCanvasData,c=t.renderingTools.renderCanvasContext,{viewport:l}=t,u=t.renderingTools.colorLUT;if(l.modality==="PT"){const{windowWidth:f,windowCenter:d}=l.voi,h=d-f/2,y=255/(d+f/2-h);let x;l.invert?x=S=>Ck(Math.floor(255-(S-h)*y),0,255):x=S=>Ck(Math.floor((S-h)*y),0,255),FRt(e,x,u,s.data)}else{const f=w3e(e,t.viewport,n);e.stats=e.stats||{},e.stats.lastLutGenerateTime=Wn()-o,URt(e,f,u,s.data)}return o=Wn(),c.putImageData(s,0,0),e.stats.lastPutImageDataTime=Wn()-o,r}function zRt(t,e){if(t===void 0)throw new Error("drawImage: enabledElement parameter must not be undefined");const n=t.image;if(n===void 0)throw new Error("drawImage: image must be loaded before it can be drawn");const r=t.canvas.getContext("2d");r.setTransform(1,0,0,1,0,0),r.fillStyle="black",r.fillRect(0,0,t.canvas.width,t.canvas.height),r.imageSmoothingEnabled=!t.viewport.pixelReplication,PF(t,r);const i=BRt(t,n,e),a=t.viewport.displayedArea.tlhc.x-1,o=t.viewport.displayedArea.tlhc.y-1,s=t.viewport.displayedArea.brhc.x-a,c=t.viewport.displayedArea.brhc.y-o;r.drawImage(i,a,o,s,c,0,0,s,c),t.renderingTools=AF(t)}function b3e(t,e){const n=t.image;if(!t.canvas||!t.image)return;const r=Wn();if(n.stats={lastGetPixelDataTime:-1,lastStoredPixelDataToCanvasImageDataTime:-1,lastPutImageDataTime:-1,lastRenderTime:-1,lastLutGenerateTime:-1},n){let a=n.render;a||(t.viewport.colormap?a=zRt:n.color?a=wRt:a=IRt),a(t,e)}const i=Wn()-r;n.stats.lastRenderTime=i,t.invalid=!1,t.needsRedraw=!1}function S3e(t){return Xw(t)}function jS(t,e){const n=S3e(t);return n.invert(),n.transformPoint(e)}const GRt={viewport:{}};function WRt(){return{tlhc:{x:1,y:1},brhc:{x:1,y:1},rowPixelSpacing:1,columnPixelSpacing:1,presentationSizeMode:"NONE"}}function HRt(){const t=WRt(),e={scale:1,translation:{x:0,y:0},voi:{windowWidth:void 0,windowCenter:void 0,voiLUTFunction:ns.LINEAR},invert:!1,pixelReplication:!1,rotation:0,hflip:!1,vflip:!1,modalityLUT:void 0,voiLUT:void 0,colormap:void 0,labelmap:!1,displayedArea:t};return Object.assign({},e,GRt.viewport)}function J5(t,e){if(t==null)throw new Error(e)}function qRt(t){return!(t==null||t===0||t===180)}function C3e(t,e=null){return J5(t,"getImageSize: parameter image must not be undefined"),J5(t.width,"getImageSize: parameter image must have width"),J5(t.height,"getImageSize: parameter image must have height"),qRt(e)?{height:t.width,width:t.height}:{width:t.width,height:t.height}}function VF(t,e,n=null){J5(t,"getImageScale: parameter canvas must not be undefined"),J5(e,"getImageScale: parameter image must not be undefined");const r=C3e(e,n),i=e.rowPixelSpacing||1,a=e.columnPixelSpacing||1;let o=1,s=1;i<a?s=a/i:o=i/a;const c=t.height/r.height/o,l=t.width/r.width/s;return{verticalScale:c,horizontalScale:l,scaleFactor:Math.min(l,c)}}function _3e(t,e,n,r){if(t===void 0)throw new Error("getDefaultViewport: parameter canvas must not be undefined");if(e===void 0)return HRt();const i=VF(t,e,0).scaleFactor;let a;return n==="PT"&&e.isPreScaled?a={windowWidth:5,windowCenter:2.5}:e.windowWidth!==void 0&&e.windowCenter!==void 0&&(a={windowWidth:Array.isArray(e.windowWidth)?e.windowWidth[0]:e.windowWidth,windowCenter:Array.isArray(e.windowCenter)?e.windowCenter[0]:e.windowCenter}),{scale:i,translation:{x:0,y:0},voi:a,invert:e.invert,pixelReplication:!1,rotation:0,hflip:!1,vflip:!1,modalityLUT:e.modalityLUT,modality:n,voiLUT:e.voiLUT,colormap:r!==void 0?r:e.colormap,displayedArea:{tlhc:{x:1,y:1},brhc:{x:e.columns,y:e.rows},rowPixelSpacing:e.rowPixelSpacing===void 0?1:e.rowPixelSpacing,columnPixelSpacing:e.columnPixelSpacing===void 0?1:e.columnPixelSpacing,presentationSizeMode:"NONE"}}}function Pte(t,e){return S3e(t).transformPoint(e)}function KRt(t){const{image:e}=t;t.viewport.scale=VF(t.canvas,e,t.viewport.rotation).scaleFactor,t.viewport.translation.x=0,t.viewport.translation.y=0}function YRt(t){const{canvas:e}=t,{clientWidth:n,clientHeight:r}=e;(e.width!==n||e.height!==r)&&(e.width=n,e.height=r)}function XRt(t,e,n){const r=t.viewport.scale,i=C3e(t.image,t.viewport.rotation),a=Math.round(i.width*r),o=Math.round(i.height*r),s=t.viewport.translation.x,c=t.viewport.translation.y;return a===e&&o<=n||a<=e&&o===n&&s===0&&c===0}function ZRt(t,e,n){const r=t.viewport.scale,i=t.canvas.width,a=t.canvas.height,o=i/e,s=a/n,c=Math.sqrt(o*s);t.viewport.scale=c*r}function QRt(t,e=!1){const n=t.canvas.width,r=t.canvas.height;YRt(t),t.image!==void 0&&(e||XRt(t,n,r)?KRt(t):ZRt(t,n,r))}function JRt(t,e){const{hflip:n,vflip:r,rotation:i}=e;if(t.x*=n?-1:1,t.y*=r?-1:1,i!==0){const a=i*Math.PI/180,o=Math.cos(a),s=Math.sin(a),c=t.x*o-t.y*s,l=t.x*s+t.y*o;t.x=c,t.y=l}return t}function eIt(t,e=!0,n=!0){const{canvas:r,image:i,viewport:a}=t,o=VF(r,i,0).scaleFactor;a.vflip=!1,a.hflip=!1,e&&(a.translation.x=0,a.translation.y=0),n&&(a.displayedArea.tlhc.x=1,a.displayedArea.tlhc.y=1,a.displayedArea.brhc.x=i.columns,a.displayedArea.brhc.y=i.rows,a.scale=o)}const kte=NF.getLogger("utilities","getClosestImageId");function Zw(t,e,n,r){const{direction:i,spacing:a,imageIds:o}=t,{ignoreSpacing:s=!1}=r||{};if(!o?.length)return;const c=i.slice(6,9),l=Vt(c,n);if(Math.abs(l)<1-_u)return;let u;s||(u=b3({direction:i,spacing:a},n)/2);let f,d=1/0;for(let h=0;h<o.length;h++){const m=o[h],p=Ot("imagePlaneModule",m);if(!p?.imagePositionPatient){kte.warn(`Missing imagePositionPatient for imageId: ${m}`);continue}const{imagePositionPatient:y}=p,x=ut();yr(x,e,y);const S=Math.abs(Vt(x,n));s?S<d&&(d=S,f=m):S<u&&S<d&&(d=S,f=m)}return f===void 0&&kte.warn("No imageId found within the specified criteria (half spacing or absolute closest)."),f}function tIt(t,e){const n=Vt(t,e),r=gd(ut(),e,2*n);return yr(ut(),t,r)}function Ate(t,e,n,r){let i=Ixe(t);if(n&&th(i,i),e){const a=Tr(ut(),r,i);Vr(a,a),i=tIt(i,a)}return i}const Lte=NF.getLogger("RenderingEngine","StackViewport");class Ms extends r9{constructor(e){super(e),this.imageIds=[],this.imageKeyToIndexMap=new Map,this.currentImageIdIndex=0,this.targetImageIdIndex=0,this.imagesLoader=this,this.globalDefaultProperties={},this.perImageIdDefaultProperties=new Map,this.voiUpdatedWithSetProperties=!1,this.sharpening=0,this.invert=!1,this.initialInvert=!1,this.initialTransferFunctionNodes=null,this.stackInvalidated=!1,this._publishCalibratedEvent=!1,this.updateRenderingPipeline=()=>{this._configureRenderingPipeline()},this.setSharpening=n=>{this.sharpening=n,this.render()},this.getRenderPasses=()=>{if(!this.shouldUseCustomRenderPass())return null;try{return[c3e(this.sharpening)]}catch(n){return console.warn("Failed to create sharpening render passes:",n),null}},this.resize=()=>{this.useCPURendering&&this._resizeCPU()},this._resizeCPU=()=>{this._cpuFallbackEnabledElement.viewport&&QRt(this._cpuFallbackEnabledElement)},this.getFrameOfReferenceUID=n=>this.getImagePlaneReferenceData(n)?.FrameOfReferenceUID,this.getCornerstoneImage=()=>this.csImage,this.createActorMapper=n=>{const r=BMt.newInstance();r.setInputData(n);const i=QMt.newInstance();i.setMapper(r);const{preferSizeOverAccuracy:a}=mf().rendering;return a&&r.setPreferSizeOverAccuracy(!0),n.getPointData().getScalars().getNumberOfComponents()>1&&i.getProperty().setIndependentComponents(!1),i},this.getNumberOfSlices=()=>this.imageIds.length,this.getDefaultProperties=n=>{let r;return n!==void 0&&(r=this.perImageIdDefaultProperties.get(n)),r!==void 0?r:{...this.globalDefaultProperties}},this.getProperties=()=>{const{colormap:n,voiRange:r,VOILUTFunction:i,interpolationType:a,invert:o,voiUpdatedWithSetProperties:s}=this;return{colormap:n,voiRange:r,VOILUTFunction:i,interpolationType:a,invert:o,isComputedVOI:!s,sharpening:this.sharpening}},this.resetCameraForResize=()=>this.resetCamera({resetPan:!0,resetZoom:!0,resetToCenter:!0,suppressEvents:!0}),this.getRotationCPU=()=>{const{viewport:n}=this._cpuFallbackEnabledElement;return n.rotation},this.getRotationGPU=()=>{const{viewUp:n,viewPlaneNormal:r,flipVertical:i,flipHorizontal:a}=this.getCameraNoRotation(),o=Ate(this.initialViewUp,a,i,r),c=Pxe(o,n)*180/Math.PI,l=Tr(ut(),o,n);return Vt(l,r)>=0?c:(360-c)%360},this.setRotation=n=>{const r=this.getCamera();if(this.useCPURendering?this.setRotationCPU(n):this.setRotationGPU(n),this._suppressCameraModifiedEvents)return;const i=this.getCamera(),a={previousCamera:r,camera:i,element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId};dt(this.element,it.CAMERA_MODIFIED,a)},this.renderImageObject=n=>{this._setCSImage(n),(this.useCPURendering?this._updateToDisplayImageCPU:this._updateActorToDisplayImageId).call(this,n)},this._setCSImage=n=>{n.isPreScaled=n.preScale?.scaled,this.csImage=n},this.canvasToWorldCPU=(n,r=[0,0,0])=>{if(!this._cpuFallbackEnabledElement.image)return;const[i,a]=jS(this._cpuFallbackEnabledElement,n),{origin:o,spacing:s,direction:c}=this.getImageData(),l=c.slice(0,3),u=c.slice(3,6);return Ro(r,o,l,i*s[0]),Ro(r,r,u,a*s[1]),r},this.worldToCanvasCPU=n=>{const{spacing:r,direction:i,origin:a}=this.getImageData(),o=i.slice(0,3),s=i.slice(3,6),c=Xi(ut(),n,a),l=[Vt(c,o)/r[0],Vt(c,s)/r[1]];return Pte(this._cpuFallbackEnabledElement,l)},this.canvasToWorldGPUContextPool=n=>{const r=this.getRenderer(),i=this.getVtkActiveCamera(),a=i.getClippingRange(),o=i.getDistance();i.setClippingRange(o,o+.1);const s=window.devicePixelRatio||1,{width:c,height:l}=this.canvas,u=c/l,f=[n[0]*s,n[1]*s],d=r.getViewport(),[h,m,p,y]=d,x=p-h,S=y-m,C=[h+f[0]/c*x,m+(1-f[1]/l)*S,0],_=r.normalizedDisplayToProjection(C[0],C[1],C[2]),T=r.projectionToView(_[0],_[1],_[2],u),O=r.viewToWorld(T[0],T[1],T[2]);return i.setClippingRange(a[0],a[1]),[O[0],O[1],O[2]]},this.canvasToWorldGPUTiled=n=>{const r=this.getRenderer(),i=this.getVtkActiveCamera(),a=i.getClippingRange(),o=i.getDistance();i.setClippingRange(o,o+.1);const c=this.getRenderingEngine().offscreenMultiRenderWindow.getOpenGLRenderWindow(),l=c.getSize(),u=window.devicePixelRatio||1,f=[n[0]*u,n[1]*u],d=[f[0]+this.sx,f[1]+this.sy];d[1]=l[1]-d[1];const h=c.displayToWorld(d[0],d[1],0,r);return i.setClippingRange(a[0],a[1]),[h[0],h[1],h[2]]},this.worldToCanvasGPUContextPool=n=>{const r=this.getRenderer(),i=this.getVtkActiveCamera(),a=i.getClippingRange(),o=i.getDistance();i.setClippingRange(o,o+.1);const s=window.devicePixelRatio||1,{width:c,height:l}=this.canvas,u=c/l,f=r.worldToView(n[0],n[1],n[2]),d=r.viewToProjection(f[0],f[1],f[2],u),h=r.projectionToNormalizedDisplay(d[0],d[1],d[2]),m=r.getViewport(),[p,y,x,S]=m,C=x-p,_=S-y,T=(h[0]-p)/C*c,O=(1-(h[1]-y)/_)*l;return i.setClippingRange(a[0],a[1]),[T/s,O/s]},this.worldToCanvasGPUTiled=n=>{const r=this.getRenderer(),i=this.getVtkActiveCamera(),a=i.getClippingRange(),o=i.getDistance();i.setClippingRange(o,o+.1);const c=this.getRenderingEngine().offscreenMultiRenderWindow.getOpenGLRenderWindow(),l=c.getSize(),u=c.worldToDisplay(...n,r);u[1]=l[1]-u[1];const f=[u[0]-this.sx,u[1]-this.sy];i.setClippingRange(a[0],a[1]);const d=window.devicePixelRatio||1;return[f[0]/d,f[1]/d]},this.getCurrentImageIdIndex=()=>this.currentImageIdIndex,this.getSliceIndex=()=>this.currentImageIdIndex,this.getTargetImageIdIndex=()=>this.targetImageIdIndex,this.getImageIds=()=>this.imageIds,this.getCurrentImageId=(n=this.getCurrentImageIdIndex())=>this.imageIds[n],this.hasImageId=n=>this.imageKeyToIndexMap.has(n),this.hasImageURI=n=>this.imageKeyToIndexMap.has(n),this.customRenderViewportToCanvas=()=>{if(!this.useCPURendering)throw new Error("Custom cpu rendering pipeline should only be hit in CPU rendering mode");return this._cpuFallbackEnabledElement.image?(b3e(this._cpuFallbackEnabledElement,this.cpuRenderingInvalidated),this.cpuRenderingInvalidated=!1):this.fillWithBackgroundColor(),{canvas:this.canvas,element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId,viewportStatus:this.viewportStatus}},this.renderingPipelineFunctions={getImageData:{cpu:this.getImageDataCPU,gpu:this.getImageDataGPU},setColormap:{cpu:this.setColormapCPU,gpu:this.setColormapGPU},getCamera:{cpu:this.getCameraCPU,gpu:super.getCamera},setCamera:{cpu:this.setCameraCPU,gpu:super.setCamera},getPan:{cpu:this.getPanCPU,gpu:super.getPan},setPan:{cpu:this.setPanCPU,gpu:super.setPan},getZoom:{cpu:this.getZoomCPU,gpu:super.getZoom},setZoom:{cpu:this.setZoomCPU,gpu:super.setZoom},setVOI:{cpu:this.setVOICPU,gpu:this.setVOIGPU},getRotation:{cpu:this.getRotationCPU,gpu:this.getRotationGPU},setInterpolationType:{cpu:this.setInterpolationTypeCPU,gpu:this.setInterpolationTypeGPU},setInvertColor:{cpu:this.setInvertColorCPU,gpu:this.setInvertColorGPU},resetCamera:{cpu:(n={})=>{const{resetPan:r=!0,resetZoom:i=!0}=n;return this.resetCameraCPU({resetPan:r,resetZoom:i}),!0},gpu:(n={})=>{const{resetPan:r=!0,resetZoom:i=!0}=n;return this.resetCameraGPU({resetPan:r,resetZoom:i}),!0}},canvasToWorld:{cpu:this.canvasToWorldCPU,gpu:{tiled:this.canvasToWorldGPUTiled,contextPool:this.canvasToWorldGPUContextPool}},worldToCanvas:{cpu:this.worldToCanvasCPU,gpu:{tiled:this.worldToCanvasGPUTiled,contextPool:this.worldToCanvasGPUContextPool}},getRenderer:{cpu:()=>this.getCPUFallbackError("getRenderer"),gpu:{tiled:this.getRendererTiled,contextPool:this.getRendererContextPool}},getDefaultActor:{cpu:()=>this.getCPUFallbackError("getDefaultActor"),gpu:super.getDefaultActor},getActors:{cpu:()=>this.getCPUFallbackError("getActors"),gpu:super.getActors},getActor:{cpu:()=>this.getCPUFallbackError("getActor"),gpu:super.getActor},setActors:{cpu:()=>this.getCPUFallbackError("setActors"),gpu:super.setActors},addActors:{cpu:()=>this.getCPUFallbackError("addActors"),gpu:super.addActors},addActor:{cpu:()=>this.getCPUFallbackError("addActor"),gpu:super.addActor},removeAllActors:{cpu:()=>this.getCPUFallbackError("removeAllActors"),gpu:super.removeAllActors},unsetColormap:{cpu:this.unsetColormapCPU,gpu:this.unsetColormapGPU}},this.scaling={},this.modality=null,this.useCPURendering=q5(),this._configureRenderingPipeline(),this.useCPURendering?this._resetCPUFallbackElement():this._resetGPUViewport(),this.currentImageIdIndex=0,this.targetImageIdIndex=0,this.resetCamera(),this.initializeElementDisabledHandler()}setUseCPURendering(e){this.useCPURendering=e,this._configureRenderingPipeline(e)}static get useCustomRenderingPipeline(){return q5()}_configureRenderingPipeline(e){const n=o3e();this.useCPURendering=e??q5();for(const r in this.renderingPipelineFunctions)if(Object.prototype.hasOwnProperty.call(this.renderingPipelineFunctions,r)){const i=this.renderingPipelineFunctions[r];this.useCPURendering?this[r]=i.cpu:typeof i.gpu=="object"&&i.gpu.tiled&&i.gpu.contextPool?this[r]=n?i.gpu.contextPool:i.gpu.tiled:this[r]=i.gpu}this.useCPURendering?this._resetCPUFallbackElement():this._resetGPUViewport()}_resetCPUFallbackElement(){this._cpuFallbackEnabledElement={canvas:this.canvas,renderingTools:{},transform:new j2,viewport:{rotation:0}}}_resetGPUViewport(){const e=this.getRenderer(),n=TF.newInstance();e.setActiveCamera(n),this.initialViewUp=[0,-1,0],n.setDirectionOfProjection(-0,-0,1),n.setViewUp(...this.initialViewUp),n.setParallelProjection(!0),n.setThicknessFromFocalPoint(.1),n.setFreezeFocalPoint(!0)}shouldUseCustomRenderPass(){return this.sharpening>0&&!this.useCPURendering}initializeElementDisabledHandler(){pt.addEventListener(it.ELEMENT_DISABLED,function e(){clearTimeout(this.debouncedTimeout),pt.removeEventListener(it.ELEMENT_DISABLED,e)})}getImageDataGPU(){const e=this.getDefaultActor();if(!e||!nf(e))return;const{actor:n}=e,r=n.getMapper().getInputData(),i=this.csImage;return{dimensions:r.getDimensions(),spacing:r.getSpacing(),origin:r.getOrigin(),direction:r.getDirection(),get scalarData(){return i?.voxelManager.getScalarData()},imageData:n.getMapper().getInputData(),metadata:{Modality:this.modality,FrameOfReferenceUID:this.getFrameOfReferenceUID()},scaling:this.scaling,hasPixelSpacing:this.hasPixelSpacing,calibration:{...i?.calibration,...this.calibration},preScale:{...i?.preScale},voxelManager:i?.voxelManager}}getImageDataCPU(){const{metadata:e}=this._cpuFallbackEnabledElement;if(!e)return;const n=e.spacing,r=this.csImage;return{dimensions:e.dimensions,spacing:n,origin:e.origin,direction:e.direction,metadata:{Modality:this.modality,FrameOfReferenceUID:this.getFrameOfReferenceUID()},scaling:this.scaling,imageData:{getDirection:()=>e.direction,getDimensions:()=>e.dimensions,getScalarData:()=>this.cpuImagePixelData,getSpacing:()=>n,worldToIndex:i=>{const a=this.worldToCanvasCPU(i),o=jS(this._cpuFallbackEnabledElement,a);return[o[0],o[1],0]},indexToWorld:(i,a)=>{const o=Pte(this._cpuFallbackEnabledElement,[i[0],i[1]]);return this.canvasToWorldCPU(o,a)}},scalarData:this.cpuImagePixelData,hasPixelSpacing:this.hasPixelSpacing,calibration:{...r?.calibration,...this.calibration},preScale:{...r?.preScale},voxelManager:r?.voxelManager}}calibrateIfNecessary(e,n){const r=Ot("calibratedPixelSpacing",e),i=this.calibration!==r,{scale:a}=r||{};return this.hasPixelSpacing=a>0||n.rowPixelSpacing>0,n.calibration=r,i&&(this.calibration=r,this._publishCalibratedEvent=!0,this._calibrationEvent={scale:a,calibration:r}),n}setDefaultProperties(e,n){n==null?this.globalDefaultProperties=e:(this.perImageIdDefaultProperties.set(n,e),this.getCurrentImageId()===n&&this.setProperties(e))}clearDefaultProperties(e){e==null?(this.globalDefaultProperties={},this.resetProperties()):(this.perImageIdDefaultProperties.delete(e),this.resetToDefaultProperties())}setProperties({colormap:e,voiRange:n,VOILUTFunction:r,invert:i,interpolationType:a,sharpening:o}={},s=!1){this.viewportStatus=this.csImage?Ss.PRE_RENDER:Ss.LOADING,this.globalDefaultProperties={colormap:this.globalDefaultProperties.colormap??e,voiRange:this.globalDefaultProperties.voiRange??n,VOILUTFunction:this.globalDefaultProperties.VOILUTFunction??r,invert:this.globalDefaultProperties.invert??i,interpolationType:this.globalDefaultProperties.interpolationType??a,sharpening:this.globalDefaultProperties.sharpening??o},typeof e<"u"&&this.setColormap(e),typeof n<"u"&&this.setVOI(n,{suppressEvents:s,voiUpdatedWithSetProperties:!0}),typeof r<"u"&&this.setVOILUTFunction(r,s),typeof i<"u"&&this.setInvertColor(i),typeof a<"u"&&this.setInterpolationType(a),typeof o<"u"&&this.setSharpening(o)}resetProperties(){this.cpuRenderingInvalidated=!0,this.voiUpdatedWithSetProperties=!1,this.viewportStatus=Ss.PRE_RENDER,this.fillWithBackgroundColor(),this.useCPURendering&&(this._cpuFallbackEnabledElement.renderingTools={}),this._resetProperties(),this.render()}_resetProperties(){let e;if(this._isCurrentImagePTPrescaled()?e=this._getDefaultPTPrescaledVOIRange():e=this._getVOIRangeForCurrentImage(),this.setVOI(e),this.setInvertColor(this.initialInvert),this.setInterpolationType(G0.LINEAR),!this.useCPURendering){const n=this.getTransferFunction();BE(n,this.initialTransferFunctionNodes);const i=GT(n).reduce((s,c)=>(s.push(c[0],c[1],c[2],c[3]),s),[]),a=this.getDefaultActor(),o=tF(i,a.actor);this.setColormap(o)}}resetToDefaultProperties(){this.cpuRenderingInvalidated=!0,this.viewportStatus=Ss.PRE_RENDER,this.fillWithBackgroundColor(),this.useCPURendering&&(this._cpuFallbackEnabledElement.renderingTools={});const e=this.getCurrentImageId(),n=this.perImageIdDefaultProperties.get(e)||this.globalDefaultProperties;n.colormap?.name&&this.setColormap(n.colormap);let r;n.voiRange==null?r=this._getVOIRangeForCurrentImage():r=n.voiRange,this.setVOI(r),this.setInterpolationType(G0.LINEAR),this.setInvertColor(!1),this.render()}_getVOIFromCache(){let e;return this.voiUpdatedWithSetProperties?e=this.voiRange:this._isCurrentImagePTPrescaled()?e=this._getDefaultPTPrescaledVOIRange():e=this._getVOIRangeForCurrentImage()??this.voiRange,e}_setPropertiesFromCache(){const e=this._getVOIFromCache(),{interpolationType:n,invert:r}=this;this.setVOI(e),this.setInterpolationType(n),this.setInvertColor(r)}getCameraCPU(){const{metadata:e,viewport:n}=this._cpuFallbackEnabledElement;if(!e)return{};const{direction:r}=e,i=r.slice(6,9).map(f=>-f);let a=r.slice(3,6).map(f=>-f);if(n.rotation){const f=YU(Td(),n.rotation*Math.PI/180,i);a=gr(ut(),a,f)}const o=[this.element.clientWidth/2,this.element.clientHeight/2],s=this.canvasToWorld(o),c=this.canvasToWorld([0,0]),l=this.canvasToWorld([0,this.element.clientHeight]),u=Gy(c,l)/2;return{parallelProjection:!0,focalPoint:s,position:[0,0,0],parallelScale:u,scale:n.scale,viewPlaneNormal:[i[0],i[1],i[2]],viewUp:[a[0],a[1],a[2]],flipHorizontal:this.flipHorizontal,flipVertical:this.flipVertical}}setCameraCPU(e){const{viewport:n,image:r}=this._cpuFallbackEnabledElement,i=this.getCameraCPU(),{focalPoint:a,parallelScale:o,scale:s,flipHorizontal:c,flipVertical:l}=e,{clientHeight:u}=this.element;if(a){const d=this.worldToCanvasCPU(a),h=jS(this._cpuFallbackEnabledElement,d),m=this.worldToCanvasCPU(i.focalPoint),p=jS(this._cpuFallbackEnabledElement,m),y=si();Qo(y,Iee(h[0],h[1]),Iee(p[0],p[1]));const x=JRt({x:y[0],y:y[1]},n);n.translation.x-=x.x,n.translation.y-=x.y}if(o){const{rowPixelSpacing:d}=r,h=u*d*.5/o;n.scale=h,n.parallelScale=o}if(s){const{rowPixelSpacing:d}=r;n.scale=s,n.parallelScale=u*d*.5/s}(c!==void 0||l!==void 0)&&this.setFlipCPU({flipHorizontal:c,flipVertical:l}),this._cpuFallbackEnabledElement.transform=Xw(this._cpuFallbackEnabledElement);const f={previousCamera:i,camera:this.getCamera(),element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId};dt(this.element,it.CAMERA_MODIFIED,f)}getPanCPU(){const{viewport:e}=this._cpuFallbackEnabledElement;return[e.translation?.x??0,e.translation?.y??0]}setPanCPU(e){const n=this.getCameraCPU();this.setCameraCPU({...n,focalPoint:[...e.map(r=>-r),0]})}getZoomCPU(){const{viewport:e}=this._cpuFallbackEnabledElement;return e.scale}setZoomCPU(e){const n=this.getCameraCPU();this.setCameraCPU({...n,scale:e})}setFlipCPU({flipHorizontal:e,flipVertical:n}){const{viewport:r}=this._cpuFallbackEnabledElement;e!==void 0&&(r.hflip=e,this.flipHorizontal=r.hflip),n!==void 0&&(r.vflip=n,this.flipVertical=r.vflip)}setVOILUTFunction(e,n){if(this.useCPURendering)throw new Error("VOI LUT function is not supported in CPU rendering");const r=this._getValidVOILUTFunction(e);let i=!1;this.VOILUTFunction!==r&&(i=!0),this.VOILUTFunction=r;const{voiRange:a}=this.getProperties();this.setVOI(a,{suppressEvents:n,forceRecreateLUTFunction:i})}setRotationCPU(e){const{viewport:n}=this._cpuFallbackEnabledElement;n.rotation=e}setRotationGPU(e){const n=this.getPan(this.fitToCanvasCamera),r=this.getPan(),i=Wy([0,0],n,r);this.setPan(i,!1);const{flipVertical:a,flipHorizontal:o,viewPlaneNormal:s}=this.getCamera(),c=Ate(this.initialViewUp,o,a,s);this.setCameraNoEvent({viewUp:c}),this.getVtkActiveCamera().roll(-e);const l=this.getPan(),u=this.getPan(this.fitToCanvasCamera),f=Wy([0,0],l,u),d=QU([0,0],n,f);this.setPan(d,!1)}setInterpolationTypeGPU(e){const n=this.getDefaultActor();if(!n||!nf(n))return;const{actor:r}=n;r.getProperty().setInterpolationType(e),this.interpolationType=e}setInterpolationTypeCPU(e){const{viewport:n}=this._cpuFallbackEnabledElement;n.pixelReplication=e!==G0.LINEAR,this.interpolationType=e}setInvertColorCPU(e){const{viewport:n}=this._cpuFallbackEnabledElement;n&&(n.invert=e,this.invert=e)}setInvertColorGPU(e){const n=this.getDefaultActor();if(n&&nf(n)){if(tc(n,"vtkVolume")){const i=n.actor.getProperty().getRGBTransferFunction(0);(!this.invert&&e||this.invert&&!e)&&Y5(i),this.invert=e}else if(tc(n,"vtkImageSlice")){const i=n.actor.getProperty().getRGBTransferFunction(0);(!this.invert&&e||this.invert&&!e)&&Y5(i),this.invert=e}}}setVOICPU(e,n={}){const{suppressEvents:r=!1}=n,{viewport:i,image:a}=this._cpuFallbackEnabledElement;if(!i||!a)return;if(typeof e>"u"){const{windowWidth:s,windowCenter:c}=a,l=Array.isArray(s)?s[0]:s,u=Array.isArray(c)?c[0]:c;i.voi={windowWidth:l,windowCenter:u,voiLUTFunction:a.voiLUTFunction};const{lower:f,upper:d}=gy(l,u,a.voiLUTFunction);e={lower:f,upper:d}}else{const{lower:s,upper:c}=e,{windowCenter:l,windowWidth:u}=m3(s,c);i.voi||(i.voi={windowWidth:0,windowCenter:0,voiLUTFunction:a.voiLUTFunction}),i.voi.windowWidth=u,i.voi.windowCenter=l}this.voiRange=e;const o={viewportId:this.id,range:e};r||dt(this.element,it.VOI_MODIFIED,o)}getTransferFunction(){const e=this.getDefaultActor();return!e||!nf(e)?void 0:e.actor.getProperty().getRGBTransferFunction(0)}setVOIGPU(e,n={}){const{suppressEvents:r=!1,forceRecreateLUTFunction:i=!1,voiUpdatedWithSetProperties:a=!1}=n;if(e&&this.voiRange&&this.voiRange.lower===e.lower&&this.voiRange.upper===e.upper&&!i&&!this.stackInvalidated)return;const o=this.getDefaultActor();if(!o||!nf(o))return;const s=o.actor;let c=e;if(typeof c>"u"){const h=s.getMapper().getInputData().getPointData().getScalars().getRange();c={lower:h[0],upper:h[1]}}s.getProperty().setUseLookupTableScalarRange(!0);let l=s.getProperty().getRGBTransferFunction(0);const u=this.VOILUTFunction===ns.SAMPLED_SIGMOID;if((u||!l||i)&&(l=(u?aF:m3e)(c),this.invert&&Y5(l),s.getProperty().setRGBTransferFunction(0,l),this.initialTransferFunctionNodes=GT(l)),u||l.setRange(c.lower,c.upper),this.voiRange=c,this.voiUpdatedWithSetProperties||(this.voiUpdatedWithSetProperties=a),r)return;const f={viewportId:this.id,range:c,VOILUTFunction:this.VOILUTFunction};dt(this.element,it.VOI_MODIFIED,f)}_addScalingToViewport(e){if(this.scaling.PT)return;const{suvbw:n,suvlbm:r,suvbsa:i}=e,a={};r&&(a.suvbwToSuvlbm=r/n),i&&(a.suvbwToSuvbsa=i/n),this.scaling.PT=a}getImageDataMetadata(e){const n=e.imageId,r=g3e(e),{numberOfComponents:i,origin:a,direction:o,dimensions:s,spacing:c,numVoxels:l,imagePixelModule:u,voiLUTFunction:f,modality:d,scalingFactor:h,calibration:m}=r;d==="PT"&&h&&this._addScalingToViewport(h),this.modality=d;const p=this._getValidVOILUTFunction(f);this.VOILUTFunction=p,this.calibration=m;let y=this._getImagePlaneModule(n);return this.useCPURendering||(y=this.calibrateIfNecessary(n,y)),{bitsAllocated:u.bitsAllocated,numberOfComponents:i,origin:a,direction:o,dimensions:s,spacing:c,numVoxels:l,imagePlaneModule:y,imagePixelModule:u}}matchImagesForOverlay(e,n){return(i=>{const a=Ot(Js.IMAGE_PLANE,n),o=Ot(Js.IMAGE_PLANE,i),s=a.imageOrientationPatient,c=o.imageOrientationPatient;if(s&&c){if(Lr(a.imageOrientationPatient,o.imageOrientationPatient)){const u=a.imagePositionPatient,f=o.imagePositionPatient;if(u&&f&&Lr(u,f)){const h=a.rows,m=a.columns,p=o.rows,y=o.columns;if(h===p&&m===y)return i}}}else{const l=a.rows,u=a.columns,f=o.rows,d=o.columns;if(l===f&&u===d)return i}})(e)}getImagePlaneReferenceData(e=this.getCurrentImageIdIndex()){const n=this.imageIds[e];if(!n)return;const r=Ot(Js.IMAGE_PLANE,n);if(!r)return;const{imagePositionPatient:i,frameOfReferenceUID:a}=r;let{rowCosines:o,columnCosines:s}=r;o||=[1,0,0],s||=[0,1,0];const c=Tr([0,0,0],s,o);return{FrameOfReferenceUID:a,viewPlaneNormal:c,cameraFocalPoint:i,referencedImageId:n,sliceIndex:e}}_getCameraOrientation(e){const n=e.slice(6,9).map(i=>-i),r=e.slice(3,6).map(i=>-i);return{viewPlaneNormal:[n[0],n[1],n[2]],viewUp:[r[0],r[1],r[2]]}}createVTKImageData({origin:e,direction:n,dimensions:r,spacing:i,numberOfComponents:a,pixelArray:o}){const s=new o.constructor(o.length),c=On.newInstance({name:"Pixels",numberOfComponents:a,values:s}),l=YE.newInstance();return l.setDimensions(r),l.setSpacing(i),l.setDirection(n),l.setOrigin(e),l.getPointData().setScalars(c),l}_createVTKImageData({origin:e,direction:n,dimensions:r,spacing:i,numberOfComponents:a,pixelArray:o}){try{this._imageData=this.createVTKImageData({origin:e,direction:n,dimensions:r,spacing:i,numberOfComponents:a,pixelArray:o})}catch(s){Lte.error(s)}}async setStack(e,n=0){if(this._throwIfDestroyed(),this.imageIds=e,n>e.length)throw new Error("Current image index is greater than the number of images in the stack");this.imageKeyToIndexMap.clear(),e.forEach((o,s)=>{this.imageKeyToIndexMap.set(o,s),this.imageKeyToIndexMap.set(ma(o),s)}),this.currentImageIdIndex=n,this.targetImageIdIndex=n;const r=Ot(Hy.IMAGE_RETRIEVE_CONFIGURATION,e[n],"stack");this.imagesLoader=r?(r.create||Hbe)(r):this,this.stackInvalidated=!0,this.flipVertical=!1,this.flipHorizontal=!1,this.voiRange=null,this.interpolationType=G0.LINEAR,this.invert=!1,this.viewportStatus=Ss.LOADING,this.fillWithBackgroundColor(),this.useCPURendering&&(this._cpuFallbackEnabledElement.renderingTools={},delete this._cpuFallbackEnabledElement.viewport.colormap);const i=await this._setImageIdIndex(n),a={imageIds:e,viewportId:this.id,element:this.element,currentImageIdIndex:n};return dt(this.element,it.VIEWPORT_NEW_IMAGE_SET,a),i}_throwIfDestroyed(){if(this.isDisabled)throw new Error("The stack viewport has been destroyed and is no longer usable. Renderings will not be performed. If you are using the same viewportId and have re-enabled the viewport, you need to grab the new viewport instance using renderingEngine.getViewport(viewportId), instead of using your lexical scoped reference to the viewport instance.")}_checkVTKImageDataMatchesCornerstoneImage(e,n){if(!n)return!1;const[r,i]=n.getSpacing(),[a,o]=n.getDimensions(),s=this._getImagePlaneModule(e.imageId),c=n.getDirection(),l=c.slice(0,3),u=c.slice(3,6),f=n.getPointData().getScalars().getDataType(),d=Lr(r,e.columnPixelSpacing),h=Lr(i,e.rowPixelSpacing),m=d||e.columnPixelSpacing===null&&r===1,p=h||e.rowPixelSpacing===null&&i===1,y=a===e.columns,x=o===e.rows,S=Lr(s.rowCosines,l),C=Lr(s.columnCosines,u),_=f===e.voxelManager.getScalarData().constructor.name;return m&&p&&y&&x&&S&&C&&_}_updateVTKImageDataFromCornerstoneImage(e){let r=this._getImagePlaneModule(e.imageId).imagePositionPatient;r==null&&(r=[0,0,0]),this._imageData.setOrigin(r);const i=this.getActor(this.id);i&&(i.referencedId=e.imageId),a9(this._imageData,e)}_loadAndDisplayImage(e,n){return this.useCPURendering?this._loadAndDisplayImageCPU(e,n):this._loadAndDisplayImageGPU(e,n)}_loadAndDisplayImageCPU(e,n){return new Promise((r,i)=>{function a(h,m,p){if(this.currentImageIdIndex!==m)return;const y=h.voxelManager.getScalarData(),x=h.preScale,S=x?.scalingParameters,C=x?.scaled&&S?.rescaleIntercept%1!==0||S?.rescaleSlope%1!==0;if(y instanceof Float32Array&&C){const T={min:h.minPixelValue,max:h.maxPixelValue},I=Math.abs(T.max-T.min)/65535,V=T.min,k=y.length,L=new Uint16Array(k);let $=65535,W=0;for(let G=0;G<k;G++){const oe=Math.floor((y[G]-V)/I);L[G]=oe,$=Math.min($,oe),W=Math.max(W,oe)}h.minPixelValue=$,h.maxPixelValue=W,h.slope=I,h.intercept=V,h.voxelManager?h.voxelManager.getScalarData=()=>L:h.getPixelData=()=>L,h.preScale={...h.preScale,scaled:!1}}this._setCSImage(h),this.viewportStatus=Ss.PRE_RENDER;const _={image:h,imageId:p,imageIdIndex:m,viewportId:this.id,renderingEngineId:this.renderingEngineId};dt(this.element,it.STACK_NEW_IMAGE,_),this._updateToDisplayImageCPU(h),this.render(),this.currentImageIdIndex=m,r(p)}function o(h,m,p){const y={error:h,imageIdIndex:m,imageId:p};this.suppressEvents||dt(pt,it.IMAGE_LOAD_ERROR,y),i(h)}function s(h,m,p){return d1(h,p).then(y=>{a.call(this,y,m,h)},y=>{o.call(this,y,m,h)})}const c=-5,l=In.Interaction,u={imageId:e,imageIdIndex:n},f={useRGBA:!0,requestType:l},d={imageId:e,imageIdIndex:n,viewportId:this.id,renderingEngineId:this.renderingEngineId};dt(this.element,it.PRE_STACK_NEW_IMAGE,d),Dd.addRequest(s.bind(this,e,n,f),l,u,c)})}successCallback(e,n){const r=this.imageIds.indexOf(e);if(this.currentImageIdIndex!==r)return;const i=this.csImage?.imageFrame,a=n?.imageFrame,o=i?.photometricInterpretation||this.csImage?.photometricInterpretation,s=a?.photometricInterpretation||n?.photometricInterpretation;o!==s&&(this.stackInvalidated=!0),this._setCSImage(n);const c={image:n,imageId:e,imageIdIndex:r,viewportId:this.id,renderingEngineId:this.renderingEngineId};this._updateActorToDisplayImageId(n),dt(this.element,it.STACK_NEW_IMAGE,c),this.render(),this.currentImageIdIndex=r}errorCallback(e,n,r){if(!n)return;const i=this.imageIds.indexOf(e),a={error:r,imageIdIndex:i,imageId:e};dt(pt,it.IMAGE_LOAD_ERROR,a)}getLoaderImageOptions(e){const n=this.imageIds.indexOf(e),{transferSyntaxUID:r}=Ot("transferSyntax",e)||{};return{useRGBA:!1,transferSyntaxUID:r,priority:5,requestType:In.Interaction,additionalDetails:{imageId:e,imageIdIndex:n}}}async loadImages(e,n){const r=await Promise.allSettled(e.map(a=>{const o=this.getLoaderImageOptions(a);return d1(a,o).then(s=>(n.successCallback(a,s),a),s=>(n.errorCallback(a,!0,s),a))})),i=r.filter(a=>a.status==="rejected");if(i&&i.length){const a=new CustomEvent(it.IMAGE_LOAD_ERROR,{detail:i,cancelable:!0});pt.dispatchEvent(a)}return r}_loadAndDisplayImageGPU(e,n){if(!e){console.warn("No image id set yet to load");return}const r={imageId:e,imageIdIndex:n,viewportId:this.id,renderingEngineId:this.renderingEngineId};return dt(this.element,it.PRE_STACK_NEW_IMAGE,r),this.imagesLoader.loadImages([e],this).then(()=>e)}_updateToDisplayImageCPU(e){const n=this.getImageDataMetadata(e),r=_3e(this.canvas,e,this.modality,this._cpuFallbackEnabledElement.viewport.colormap),{windowCenter:i,windowWidth:a,voiLUTFunction:o}=r.voi;this.voiRange=gy(a,i,o),this._cpuFallbackEnabledElement.image=e,this._cpuFallbackEnabledElement.metadata={...n},this.cpuImagePixelData=e.voxelManager.getScalarData();const s=Object.assign({},r,this._cpuFallbackEnabledElement.viewport);this._cpuFallbackEnabledElement.viewport=this.stackInvalidated?r:s,this.stackInvalidated=!1,this.cpuRenderingInvalidated=!0,this._cpuFallbackEnabledElement.transform=Xw(this._cpuFallbackEnabledElement)}getSliceViewInfo(){throw new Error("Method not implemented.")}addImages(e){const n=[];e.forEach(r=>{const{imageId:i,...a}=r,o=Ct.getImage(i),{origin:s,dimensions:c,direction:l,spacing:u,numberOfComponents:f}=this.getImageDataMetadata(o),d=this.createVTKImageData({origin:s,dimensions:c,direction:l,spacing:u,numberOfComponents:f,pixelArray:o.voxelManager.getScalarData()}),h=this.createActorMapper(d);h&&(n.push({uid:r.actorUID??ya(),actor:h,referencedId:i,...a}),r.callback&&r.callback({imageActor:h,imageId:r.imageId}))}),this.addActors(n)}_updateActorToDisplayImageId(e){const n=this._checkVTKImageDataMatchesCornerstoneImage(e,this._imageData),r=this.getViewPresentation();if(n&&!this.stackInvalidated){this._updateVTKImageDataFromCornerstoneImage(e),this.resetCameraNoEvent(),this.setViewPresentation(r),this._setPropertiesFromCache(),this.stackActorReInitialized=!1;return}const{origin:i,direction:a,dimensions:o,spacing:s,numberOfComponents:c,imagePixelModule:l}=this.getImageDataMetadata(e),u=e.voxelManager.getScalarData();this._createVTKImageData({origin:i,direction:a,dimensions:o,spacing:s,numberOfComponents:c,pixelArray:u}),this._updateVTKImageDataFromCornerstoneImage(e);const f=this.createActorMapper(this._imageData),d=this.getActors();d.length&&d[0].uid===this.id?d[0].actor=f:d.unshift({uid:this.id,actor:f,referencedId:e.imageId}),this.setActors(d);const{viewPlaneNormal:h,viewUp:m}=this._getCameraOrientation(a),p=this.getCamera();this.setCameraNoEvent({viewUp:m,viewPlaneNormal:h}),this.initialViewUp=m,this.resetCameraNoEvent(),this.setViewPresentation(r),this.triggerCameraEvent(this.getCamera(),p);const y=l.photometricInterpretation==="MONOCHROME1";this.stackInvalidated=!0;const x=this._getInitialVOIRange(e);this.setVOI(x,{forceRecreateLUTFunction:!!y}),this.initialInvert=!!y,this.setInvertColor(this.invert||this.initialInvert),this.stackInvalidated=!1,this.stackActorReInitialized=!0,this._publishCalibratedEvent&&this.triggerCalibrationEvent()}_getInitialVOIRange(e){if(this.voiRange&&this.voiUpdatedWithSetProperties)return this.voiRange;const{windowCenter:n,windowWidth:r,voiLUTFunction:i}=e;let a=this._getVOIRangeFromWindowLevel(r,n,i);return a=this._getPTPreScaledRange()||a,a}_getPTPreScaledRange(){if(this._isCurrentImagePTPrescaled())return this._getDefaultPTPrescaledVOIRange()}_isCurrentImagePTPrescaled(){return!(this.modality!=="PT"||!this.csImage.isPreScaled||!this.csImage.preScale?.scalingParameters.suvbw)}_getDefaultPTPrescaledVOIRange(){return{lower:0,upper:5}}_getVOIRangeFromWindowLevel(e,n,r=ns.LINEAR){let i,a;if(typeof n=="number"&&typeof e=="number"?(i=n,a=e):Array.isArray(n)&&Array.isArray(e)&&(i=n[0],a=e[0]),i!==void 0&&a!==void 0)return gy(a,i,r)}async _setImageIdIndex(e){if(e>=this.imageIds.length)throw new Error(`ImageIdIndex provided ${e} is invalid, the stack only has ${this.imageIds.length} elements`);this.currentImageIdIndex=e,this.hasPixelSpacing=!0,this.viewportStatus=Ss.PRE_RENDER;const n=await this._loadAndDisplayImage(this.imageIds[e],e);if(this.perImageIdDefaultProperties.size>=1){const r=this.perImageIdDefaultProperties.get(n);r!==void 0?this.setProperties(r):this.globalDefaultProperties!==void 0&&this.setProperties(this.globalDefaultProperties)}return n}resetCameraCPU({resetPan:e=!0,resetZoom:n=!0}){const{image:r}=this._cpuFallbackEnabledElement;if(!r)return;eIt(this._cpuFallbackEnabledElement,e,n);const{scale:i}=this._cpuFallbackEnabledElement.viewport,{clientWidth:a,clientHeight:o}=this.element,s=[a/2,o/2],c=this.canvasToWorldCPU(s);this.setCameraCPU({focalPoint:c,scale:i})}resetCameraGPU({resetPan:e,resetZoom:n}){return this.setCamera({flipHorizontal:!1,flipVertical:!1,viewUp:this.initialViewUp}),super.resetCamera({resetPan:e,resetZoom:n,resetToCenter:!0})}scroll(e,n=!0,r=!1){const i=this.imageIds;if(isNaN(this.targetImageIdIndex))return;const a=this.targetImageIdIndex,o=i.length;let s=a+e;r?s=(s+o)%o:s=Math.max(0,Math.min(o-1,s)),this.targetImageIdIndex=s;const c=i[s];Ct.isLoaded(c)||!n?this.setImageIdIndex(s):(clearTimeout(this.debouncedTimeout),this.debouncedTimeout=window.setTimeout(()=>{this.setImageIdIndex(s)},40));const u={newImageIdIndex:s,imageId:c,direction:e};s!==a&&dt(this.element,it.STACK_VIEWPORT_SCROLL,u)}setImageIdIndex(e){if(this._throwIfDestroyed(),this.currentImageIdIndex===e)return Promise.resolve(this.getCurrentImageId());const n=this._setImageIdIndex(e);return this.targetImageIdIndex=e,n}calibrateSpacing(e){const n=this.getImageIds().indexOf(e);this.stackInvalidated=!0,this._loadAndDisplayImage(e,n)}triggerCameraEvent(e,n){const r={previousCamera:n,camera:e,element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId};this.suppressEvents||dt(this.element,it.CAMERA_MODIFIED,r)}triggerCalibrationEvent(){const{imageData:e}=this.getImageData(),n={element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId,imageId:this.getCurrentImageId(),imageData:e,worldToIndex:e.getWorldToIndex(),...this._calibrationEvent};this.suppressEvents||dt(this.element,it.IMAGE_SPACING_CALIBRATED,n),this._publishCalibratedEvent=!1}jumpToWorld(e){const n=this.getImageIds(),r=this.getImageData(),{direction:i,spacing:a}=r,o=Zw({direction:i,spacing:a,imageIds:n},e,this.getCamera().viewPlaneNormal,{ignoreSpacing:!0}),s=n.indexOf(o);return s===-1?!1:(this.setImageIdIndex(s),this.render(),!0)}getRendererContextPool(){return this.getRenderingEngine().getRenderer(this.id)}getRendererTiled(){const e=this.getRenderingEngine();if(!e||e.hasBeenDestroyed)throw new Error("Rendering engine has been destroyed");return e.offscreenMultiRenderWindow?.getRenderer(this.id)}_getVOIRangeForCurrentImage(){const{windowCenter:e,windowWidth:n,voiLUTFunction:r}=this.csImage;return this._getVOIRangeFromWindowLevel(n,e,r)}_getValidVOILUTFunction(e){return Object.values(ns).includes(e)?e:ns.LINEAR}getSliceInfo(){const e=this.getSliceIndex(),{dimensions:n}=this.getImageData();return{width:n[0],height:n[1],sliceIndex:e,slicePlane:2}}isReferenceViewable(e,n={}){const r=this.getCurrentImageIdIndex(),i=this.imageIds[r];if(!i||!e)return!1;const{referencedImageId:a,multiSliceReference:o}=e;if(a){if(a===i)return!0;e.referencedImageURI||=ma(a);const{referencedImageURI:c}=e,l=this.imageKeyToIndexMap.get(c);if(n.asOverlay&&this.matchImagesForOverlay(i,a))return!0;if(l===void 0)return!1;if(n.withNavigation)return!0;const u=o&&this.imageKeyToIndexMap.get(o.referencedImageId);return r<=u&&r>=l}if(!super.isReferenceViewable(e,{...n,withOrientation:n?.asVolume}))return!1;if(e.volumeId||e.FrameOfReferenceUID)return n.asVolume;const{cameraFocalPoint:s}=e;if(n.asNearbyProjection&&s){const{spacing:c,direction:l,origin:u}=this.getImageData(),f=l.slice(6,9),d=b3({direction:l,spacing:c},f),h=Xi(ut(),s,u),m=Vt(h,f),p=d/2;if(Math.abs(m)<=p)return!0}return!1}getViewReference(e={}){const{sliceIndex:n=this.getCurrentImageIdIndex()}=e,r=super.getViewReference(e),i=this.getCurrentImageId(n);if(i){if(r.referencedImageId=i,this.getCurrentImageIdIndex()!==n){const a=this.getImagePlaneReferenceData(n);if(!a)return;Object.assign(r,a)}return r}}setViewReference(e){if(!e?.referencedImageId){e?.sliceIndex!==void 0&&this.scroll(e.sliceIndex-this.targetImageIdIndex);return}const{referencedImageId:n}=e;e.referencedImageURI||=ma(n);const{referencedImageURI:r}=e,i=this.imageKeyToIndexMap.get(r);if(i===void 0){Lte.error(`No image URI found for ${r}`);return}this.scroll(i-this.targetImageIdIndex)}getViewReferenceId(e={}){const{sliceIndex:n=this.currentImageIdIndex}=e;return`imageId:${this.imageIds[n]}`}getSliceIndexForImage(e){if(e){if(typeof e=="string")return this.imageKeyToIndexMap.get(e);if(e.referencedImageId)return this.imageKeyToIndexMap.get(e.referencedImageId)}}getCPUFallbackError(e){return new Error(`method ${e} cannot be used during CPU Fallback mode`)}fillWithBackgroundColor(){const e=this.getRenderingEngine();e&&e.fillCanvasWithBackgroundColor(this.canvas,this.options.background)}unsetColormapCPU(){delete this._cpuFallbackEnabledElement.viewport.colormap,this._cpuFallbackEnabledElement.renderingTools={},this.cpuRenderingInvalidated=!0,this.fillWithBackgroundColor(),this.render()}setColormapCPU(e){this.colormap=e;const n=Kw(e.name);this._cpuFallbackEnabledElement.viewport.colormap=n,this._cpuFallbackEnabledElement.renderingTools={},this.fillWithBackgroundColor(),this.cpuRenderingInvalidated=!0,this.render();const r={viewportId:this.id,colormap:e};dt(this.element,it.COLORMAP_MODIFIED,r)}setColormapGPU(e){const i=this.getDefaultActor().actor.getProperty(),a=i.getRGBTransferFunction(),o=Kw(e.name)||qw.getPresetByName(e.name);if(a)a.applyColorMap(o),a.setMappingRange(this.voiRange.lower,this.voiRange.upper),i.setRGBTransferFunction(0,a);else{const c=yh.newInstance();c.applyColorMap(o),c.setMappingRange(this.voiRange.lower,this.voiRange.upper),i.setRGBTransferFunction(0,c)}this.colormap=e,this.render();const s={viewportId:this.id,colormap:e};dt(this.element,it.COLORMAP_MODIFIED,s)}unsetColormapGPU(){throw new Error("unsetColormapGPU not implemented.")}_getImagePlaneModule(e){const n=d3e(e);return this.hasPixelSpacing=!n.usingDefaultValues||this.calibration?.scale>0||this.calibration?.rowPixelSpacing>0,this.calibration||=n.calibration,n}isInAcquisitionPlane(){return!0}}function Tg(t,e){const{imageData:n}=t.getImageData(),r=t.canvasToWorld(e);return nd(n,r)}function r6(t,e){return t.indexToWorld(e)}function nIt(t,e){const{imageData:n}=t.getImageData(),r=r6(n,e);return t.worldToCanvas(r)}class is extends Tu{constructor(e){super(e),this._useAcquisitionPlaneForViewPlane=!1,this.getNumberOfSlices=()=>{const{numberOfSlices:r}=t6(this)||{};return r},this.resetCameraForResize=()=>this.resetCamera({resetPan:!0,resetZoom:!0,resetToCenter:!0,resetRotation:!1,suppressEvents:!0}),this.getCurrentImageIdIndex=(r,i=!0)=>{const{currentStepIndex:a}=py(this,r||this.getVolumeId(),i);return a},this.getSliceIndex=()=>{const{imageIndex:r}=t6(this)||{};return r},this.getCurrentImageId=()=>{const r=this.getDefaultActor();if(!r||!tc(r,"vtkVolume"))return;const i=Ct.getVolume(this.getVolumeId());if(!i)return;const{viewPlaneNormal:a,focalPoint:o}=this.getCamera();return Zw(i,o,a)},this.getSlicePlaneCoordinates=()=>{const r=this.getDefaultActor();if(!r?.actor)return console.warn("No image data found for calculating vtkPlanes."),[];const i=this.getVolumeId(),a=Ct.getVolume(i),o=this.getCamera(),{focalPoint:s,position:c,viewPlaneNormal:l}=o,u=b3(a,l),f=n9(r.actor,l,s),d=Math.round((f.current-f.min)/u),h=Math.round((f.max-f.current)/u),m=this.getSliceIndex(),p=[];for(let y=-d;y<=h;y++){const{newFocalPoint:x}=my(s,c,f,l,u,y);p.push({sliceIndex:m+y,point:x})}return p};const{orientation:n}=this.options;if(n&&n!==Fg.ACQUISITION){this.applyViewOrientation(n);return}this._useAcquisitionPlaneForViewPlane=!0}async setVolumes(e,n=!1,r=!1){const i=e[0].volumeId,a=Ct.getVolume(i);if(!a)throw new Error(`imageVolume with id: ${i} does not exist`);return this._useAcquisitionPlaneForViewPlane?(this._setViewPlaneToAcquisitionPlane(a),this._useAcquisitionPlaneForViewPlane=!1):this.options.orientation&&typeof this.options.orientation=="string"&&this.options.orientation.includes("_reformat")&&this._setViewPlaneToReformatOrientation(this.options.orientation,a),super.setVolumes(e,n,r)}async addVolumes(e,n=!1,r=!1){const i=Ct.getVolume(e[0].volumeId);if(!i)throw new Error(`imageVolume with id: ${i.volumeId} does not exist`);return this._useAcquisitionPlaneForViewPlane?(this._setViewPlaneToAcquisitionPlane(i),this._useAcquisitionPlaneForViewPlane=!1):this.options.orientation&&typeof this.options.orientation=="string"&&this.options.orientation.includes("_reformat")&&this._setViewPlaneToReformatOrientation(this.options.orientation,i),super.addVolumes(e,n,r)}jumpToWorld(e){const{focalPoint:n}=this.getCamera(),r=[0,0,0];yr(r,e,n);const i=this.getCamera(),a=i.viewPlaneNormal,o=Vt(r,a),s=Zn(a[0],a[1],a[2]);if(gd(s,s,o),Math.abs(s[0])>.001||Math.abs(s[1])>.001||Math.abs(s[2])>.001){const c=[0,0,0],l=[0,0,0];eh(c,i.focalPoint,s),eh(l,i.position,s),this.setCamera({focalPoint:c,position:l}),this.render()}return!0}setOrientation(e,n=!0){let r,i;if(typeof e=="string"){if(e===Fg.ACQUISITION)({viewPlaneNormal:r,viewUp:i}=super._getAcquisitionPlaneOrientation());else if(e===Fg.REFORMAT||e.includes("_reformat"))({viewPlaneNormal:r,viewUp:i}=a3e(this,{useViewportNormal:!0}));else if(W0[e])({viewPlaneNormal:r,viewUp:i}=W0[e]);else throw new Error(`Invalid orientation: ${e}. Use Enums.OrientationAxis instead.`);this.setCamera({viewPlaneNormal:r,viewUp:i}),this.viewportProperties.orientation=e,this.resetCamera()}else({viewPlaneNormal:r,viewUp:i}=e),this.applyViewOrientation(e);n&&this.render()}setCameraClippingRange(){const e=this.getVtkActiveCamera();if(!e){console.warn("No active camera found");return}e.getParallelProjection()?e.setClippingRange(-Ki.MAXIMUM_RAY_DISTANCE,Ki.MAXIMUM_RAY_DISTANCE):e.setClippingRange(Ki.MINIMUM_SLAB_THICKNESS,Ki.MAXIMUM_RAY_DISTANCE)}_setViewPlaneToReformatOrientation(e,n){let r,i;if(n){const{direction:a}=n;({viewPlaneNormal:r,viewUp:i}=i3e(a.slice(0,3),a.slice(3,6),a.slice(6,9),e))}else({viewPlaneNormal:r,viewUp:i}=this._getAcquisitionPlaneOrientation());this.setCamera({viewPlaneNormal:r,viewUp:i}),this.initialViewUp=i,this.resetCamera()}_setViewPlaneToAcquisitionPlane(e){let n,r;if(e){const{direction:i}=e;n=i.slice(6,9).map(a=>-a),r=i.slice(3,6).map(a=>-a)}else({viewPlaneNormal:n,viewUp:r}=this._getAcquisitionPlaneOrientation());this.setCamera({viewPlaneNormal:n,viewUp:r}),this.initialViewUp=r,this.resetCamera()}getBlendMode(e){const n=this.getActors(),r=e?.length>0?n.find(i=>e.includes(i.uid)):n[0];return r?.blendMode||r?.actor.getMapper().getBlendMode()}setBlendMode(e,n=[],r=!1){let i=this.getActors();n?.length>0&&(i=i.filter(a=>n.includes(a.uid))),i.forEach(a=>{const{actor:o}=a;o.getMapper().setBlendMode?.(e),a.blendMode=e}),r&&this.render()}resetCamera(e){const{resetPan:n=!0,resetZoom:r=!0,resetRotation:i=!0,resetToCenter:a=!0,suppressEvents:o=!1,resetOrientation:s=!0}=e||{},{orientation:c}=this.viewportProperties;c&&s&&this.applyViewOrientation(c,!1),super.resetCamera({resetPan:n,resetZoom:r,resetToCenter:a});const l=this.getVtkActiveCamera(),u=l.getViewPlaneNormal(),f=l.getFocalPoint();if(this.getActors().forEach(h=>{if(!h.actor)return;const m=h.actor.getMapper();if(m.getClippingPlanes().length===0&&!h?.clippingFilter){const y=Os.newInstance(),x=Os.newInstance(),S=[y,x];let C=Ki.MINIMUM_SLAB_THICKNESS;h.slabThickness&&(C=h.slabThickness),this.setOrientationOfClippingPlanes(S,C,u,f),m.addClippingPlane(y),m.addClippingPlane(x)}}),i&&W0[this.viewportProperties.orientation]!==void 0){const h=W0[this.viewportProperties.orientation];this.setCameraNoEvent({viewUp:h.viewUp,viewPlaneNormal:h.viewPlaneNormal})}if(!o){const h={viewportId:this.id,camera:this.getCamera(),renderingEngineId:this.renderingEngineId,element:this.element};dt(this.element,it.CAMERA_RESET,h)}return!0}setSlabThickness(e,n=[]){e<.1&&(e=.1);let r=this.getActors();n?.length>0&&(r=r.filter(a=>n.includes(a.uid))),r.forEach(a=>{tc(a,"vtkVolume")&&(a.slabThickness=e)});const i=this.getCamera();this.updateClippingPlanesForActors(i),this.triggerCameraModifiedEventIfNecessary(i,i),this.viewportProperties.slabThickness=e}resetSlabThickness(){this.getActors().forEach(r=>{tc(r,"vtkVolume")&&(r.slabThickness=Ki.MINIMUM_SLAB_THICKNESS)});const n=this.getCamera();this.updateClippingPlanesForActors(n),this.triggerCameraModifiedEventIfNecessary(n,n),this.viewportProperties.slabThickness=void 0}isInAcquisitionPlane(){const e=this.getImageData();if(!e)return!1;const{direction:n}=e,{viewPlaneNormal:r}=this.getCamera(),i=[n[6],n[7],n[8]];return Math.abs(Vt(r,i))>.99}getSliceViewInfo(){const{width:e,height:n}=this.getCanvas(),r=Tg(this,[0,0]),i=Tg(this,[e-1,0]),a=Tg(this,[0,n-1]),o=yr(ut(),i,r),s=yr(ut(),a,r),c=Tr(ut(),o,s);Vr(o,o),Vr(s,s),Vr(c,c);const{dimensions:l}=this.getImageData(),[u,f,d]=l,p=[[0,0,0],[u-1,0,0],[0,f-1,0],[u-1,f-1,0],[0,0,d-1],[u-1,0,d-1],[0,f-1,d-1],[u-1,f-1,d-1]].map(k=>nIt(this,k)).reduce((k,L)=>(k.minX=Math.min(k.minX,L[0]),k.minY=Math.min(k.minY,L[1]),k.maxX=Math.max(k.maxX,L[0]),k.maxY=Math.max(k.maxY,L[1]),k),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}),y=Tg(this,[p.minX,p.minY]),x=Cxe(o[0],o[1],o[2],0,s[0],s[1],s[2],0,c[0],c[1],c[2],0,y[0],y[1],y[2],1),S=Tg(this,[p.maxX,p.maxY]),C=yr(ut(),S,y),_=Na(Td(),x),{viewPlaneNormal:T}=this.getCamera();if(T.filter(k=>Math.abs(k)>_u).length>1)throw new Error("getSliceInfo is not supported for oblique views");const M=T.findIndex(k=>Math.abs(k)>1-_u);if(M===-1)throw new Error("Unable to determine slice axis");const I=Vt(o,C)+1,V=Vt(s,C)+1;return{sliceIndex:this.getSliceIndex(),width:I,height:V,slicePlane:M,sliceToIndexMatrix:x,indexToSliceMatrix:_}}getCurrentSlicePixelData(){const{voxelManager:e}=this.getImageData();return e.getSliceData(this.getSliceViewInfo())}getViewReference(e={}){const n=super.getViewReference(e);if(!n?.volumeId)return;const r=Ct.getVolume(n.volumeId);return n.referencedImageId=Zw(r,n.cameraFocalPoint,n.viewPlaneNormal),n}resetProperties(e){this._resetProperties(e)}_resetProperties(e){const n=e?this.getActor(e):this.getDefaultActor();if(!n)throw new Error(`No actor found for the given volumeId: ${e}`);n.slabThickness&&(n.slabThickness=Ki.MINIMUM_SLAB_THICKNESS,this.viewportProperties.slabThickness=void 0,this.updateClippingPlanesForActors(this.getCamera())),e||=this.getVolumeId();const r=Ct.getVolume(e);if(!r)throw new Error(`imageVolume with id: ${e} does not exist in cache`);if(MF(n.actor,r),nf(n)){const l=n.actor.getProperty().getRGBTransferFunction(0);BE(l,this.initialTransferFunctionNodes)}const i={...super.getVOIModifiedEventDetail(e)};this.resetCamera({resetPan:!0,resetZoom:!0,resetToCenter:!0,resetCameraRotation:!0}),dt(this.element,it.VOI_MODIFIED,i)}getSlicesClippingPlanes(){const e=this.getSlicePlaneCoordinates(),{viewPlaneNormal:n}=this.getCamera(),r=Ki.MINIMUM_SLAB_THICKNESS;return e.map(({point:i,sliceIndex:a})=>{const o=[Os.newInstance(),Os.newInstance()];return this.setOrientationOfClippingPlanes(o,r,n,i),{sliceIndex:a,planes:o.map(s=>({normal:s.getNormal(),origin:s.getOrigin()}))}})}}class $F extends Tu{constructor(e){super(e),this.setSampleDistanceMultiplier=a=>{this.getActors().forEach(s=>{if(tc(s,"vtkVolume")){const l=s.actor.getMapper();if(l&&l.getInputData){const u=l.getInputData();if(u){const f=u.getSpacing();let m=(f[0]+f[1]+f[2])/6*(a||1);m!==void 0&&l.setSampleDistance&&(l.getSampleDistance(),l.setSampleDistance(m))}}}}),this.render()},this.getNumberOfSlices=()=>1,this.getRotation=()=>0,this.getCurrentImageIdIndex=()=>0,this.getCurrentImageId=()=>null,this.resetCameraForResize=()=>this.resetCamera({resetPan:!0,resetZoom:!0,resetToCenter:!0});const{parallelProjection:n,orientation:r}=this.options,i=this.getVtkActiveCamera();n!=null&&i.setParallelProjection(n),r&&r!==Fg.ACQUISITION&&this.applyViewOrientation(r)}isInAcquisitionPlane(){return!1}resetCamera({resetPan:e=!0,resetZoom:n=!0,resetToCenter:r=!0}={}){super.resetCamera({resetPan:e,resetZoom:n,resetToCenter:r});const i=this.getVtkActiveCamera();return i.getParallelProjection()?i.setClippingRange(-Ki.MAXIMUM_RAY_DISTANCE,Ki.MAXIMUM_RAY_DISTANCE):i.setClippingRange(Ki.MINIMUM_SLAB_THICKNESS,Ki.MAXIMUM_RAY_DISTANCE),this.getRenderer().resetCameraClippingRange(),!0}setSlabThickness(e,n){return null}setBlendMode(e,n,r){return null}resetProperties(e){const n=e?this.getActor(e):this.getDefaultActor();if(!n)throw new Error(`No actor found for the given volumeId: ${e}`);n.slabThickness&&(n.slabThickness=Ki.MINIMUM_SLAB_THICKNESS,this.viewportProperties.slabThickness=void 0,this.updateClippingPlanesForActors(this.getCamera())),e||=this.getVolumeId();const r=Ct.getVolume(e);if(!r)throw new Error(`imageVolume with id: ${e} does not exist in cache`);if(MF(n.actor,r),nf(n)){const i=n.actor.getProperty().getRGBTransferFunction(0);BE(i,this.initialTransferFunctionNodes)}this.setCamera(this.initialCamera),dt(this.element,it.VOI_MODIFIED,super.getVOIModifiedEventDetail(e))}getSliceIndex(){return null}setCamera(e){super.setCamera(e),this.getRenderer().resetCameraClippingRange(),this.render()}setCameraClippingRange(){const e=this.getVtkActiveCamera();e.getParallelProjection()?e.setClippingRange(-Ki.MAXIMUM_RAY_DISTANCE,Ki.MAXIMUM_RAY_DISTANCE):e.setClippingRange(Ki.MINIMUM_SLAB_THICKNESS,Ki.MAXIMUM_RAY_DISTANCE)}resetSlabThickness(){return null}}async function rIt(t,e,n,r=!1,i=!1){n.forEach(o=>{const s=t.getViewport(o);if(!s)throw new Error(`Viewport with Id ${o} does not exist`);if(!(s instanceof Tu))throw new Error("setVolumesForViewports only supports VolumeViewport and VolumeViewport3D")});const a=n.map(async o=>{await t.getViewport(o).setVolumes(e,r,i)});await Promise.all(a)}async function iIt(t,e,n,r=!1,i=!1){for(const o of n){const s=t.getViewport(o);if(!s)throw new Error(`Viewport with Id ${o} does not exist`);if(!(s instanceof Tu)){console.warn(`Viewport with Id ${o} is not a BaseVolumeViewport. Cannot add volume to this viewport.`);return}}const a=n.map(async o=>{await t.getViewport(o).addVolumes(e,r,i)});await Promise.all(a)}function aIt(t,e,n){for(const r of n){const i=t.getViewport(r);if(!i)throw new Error(`Viewport with Id ${r} does not exist`);if(!i.addImages){console.warn(`Viewport with Id ${r} does not have addImages. Cannot add image segmentation to this viewport.`);return}}n.forEach(r=>{t.getViewport(r).addImages(e)})}class oIt{constructor(e){this.opacity=.4,this.outlineOpacity=.4,this.transferFunction=[],this.actor=e}setRGBTransferFunction(e,n){this.transferFunction[e]=n}setScalarOpacity(e){}setInterpolationTypeToNearest(){}setUseLabelOutline(){}setLabelOutlineOpacity(e){this.outlineOpacity=e}setLabelOutlineThickness(){}getColor(e){const n=this.transferFunction[0],r=n.getRedValue(e),i=n.getGreenValue(e),a=n.getBlueValue(e);return[r,i,a,this.opacity]}}class sIt{constructor(e){this.actor=e}getInputData(){return this.actor.getImage()}}class cIt{constructor(e,n){this.canvasProperties=new oIt(this),this.visibility=!1,this.mapper=new sIt(this),this.className="CanvasActor",this.derivedImage=n,this.viewport=e}renderRLE(e,n,r){const{width:i,height:a}=this.image;let{canvas:o}=this;(!o||o.width!==i||o.height!==a)&&(this.canvas=o=new window.OffscreenCanvas(i,a));const s=o.getContext("2d"),c=s.createImageData(i,a),{data:l}=c;l.fill(0);const{map:u}=r;let f=1/0,d=1/0,h=-1/0,m=-1/0;for(let x=0;x<a;x++){const S=u.getRun(x,0);if(!S)continue;d=Math.min(d,x),m=Math.max(m,x);const C=x*i<<2;let _;for(const T of S){const{start:O,end:M,value:I}=T;if(I===0){_||=[],_.push(S.indexOf(T));continue}f=Math.min(f,O),h=Math.max(h,M);const V=this.canvasProperties.getColor(I).map(L=>L*255);let k=C+(O<<2);for(let L=O;L<M;L++)l[k++]=V[0],l[k++]=V[1],l[k++]=V[2],l[k++]=V[3]}}if(f>i)return;const p=h-f,y=m-d;s.putImageData(c,0,0,f-1,d-1,p+2,y+2),n.drawImage(o,f,d,p,y,f,d,p,y)}setMapper(e){this.mapper=e}render(e,n){if(!this.visibility)return;const r=this.image||this.getImage(),{width:i,height:a}=r,o=r.getScalarData();if(!o)return;const{voxelManager:s}=r;if(s&&s.map.getRun){this.renderRLE(e,n,s);return}let{canvas:c}=this;(!c||c.width!==i||c.height!==a)&&(this.canvas=c=new window.OffscreenCanvas(i,a));const l=c.getContext("2d"),u=l.createImageData(i,a),{data:f}=u;let d=0,h=0,m=1/0,p=1/0,y=-1/0,x=-1/0;for(let _=0;_<a;_++)for(let T=0;T<i;T++){const O=o[d++];if(O){m=Math.min(T,m),p=Math.min(_,p),y=Math.max(T,y),x=Math.max(_,x);const M=this.canvasProperties.getColor(O);f[h]=M[0]*255,f[h+1]=M[1]*255,f[h+2]=M[2]*255,f[h+3]=127}h+=4}if(m>i)return;const S=y-m+1,C=x-p+1;l.putImageData(u,0,0,m,p,S,C),n.drawImage(c,m,p,S,C,m,p,S,C)}getClassName(){return this.className}getProperty(){return this.canvasProperties}setVisibility(e){this.visibility=e}getMapper(){return this.mapper}isA(e){return e===this.className}getImage(){if(this.image)return this.image;this.image={...this.derivedImage};const e=this.viewport.getImageData();return Object.assign(this.image,{worldToIndex:n=>e.imageData.worldToIndex(n),indexToWorld:(n,r)=>e.imageData.indexToWorld(n,r),getDimensions:()=>e.dimensions,getScalarData:()=>this.derivedImage?.getPixelData(),getDirection:()=>e.direction,getSpacing:()=>e.spacing,setOrigin:()=>null,setDerivedImage:n=>{this.derivedImage=n,this.image=null},modified:()=>null}),this.image}}const EB=class EB{static imageIdToFrames(e){const n=e.match(this.frameRangeExtractor);if(!n||!n[2])return null;const r=n[2].split("-").map(i=>Number(i));return r.length===1?r[0]:r}static imageIdToFrameEnd(e){const n=this.imageIdToFrames(e);return Array.isArray(n)?n[1]:n}static imageIdToFrameStart(e){const n=this.imageIdToFrames(e);return Array.isArray(n)?n[0]:n}static framesToString(e){return Array.isArray(e)?`${e[0]}-${e[1]}`:String(e)}static framesToImageId(e,n){const r=e.match(this.frameRangeExtractor);if(!r||!r[2])return null;const i=this.framesToString(n);return e.replace(this.frameRangeExtractor,`${r[1]}${i}`)}};EB.frameRangeExtractor=/(\/frames\/|[&?]frameNumber=)([^/&?]*)/i;let vy=EB;const aw=class aw extends r9{constructor(e){super({...e,canvas:e.canvas||xu(e.element)}),this.videoWidth=0,this.videoHeight=0,this.loop=!0,this.mute=!0,this.isPlaying=!1,this.scrollSpeed=1,this.playbackRate=1,this.frameRange=[0,0],this.fps=30,this.videoCamera={panWorld:[0,0],parallelScale:1},this.voiRange={lower:0,upper:255},this.getProperties=()=>({loop:this.videoElement.loop,muted:this.videoElement.muted,playbackRate:this.playbackRate,scrollSpeed:this.scrollSpeed,voiRange:{...this.voiRange}}),this.getMiddleSliceData=()=>{throw new Error("Method not implemented.")},this.useCustomRenderingPipeline=!0,this.resetCamera=()=>(this.refreshRenderValues(),this.canvasContext.fillRect(0,0,this.canvas.width,this.canvas.height),this.isPlaying||this.renderFrame(),!0),this.getNumberOfSlices=()=>{const n=Math.round(this.videoElement.duration*this.fps/this.scrollSpeed);return isNaN(n)?this.numberOfFrames:n},this.getFrameOfReferenceUID=()=>this.videoElement.src,this.resize=()=>{const n=this.canvas,{clientWidth:r,clientHeight:i}=n;(n.width!==r||n.height!==i)&&(n.width=r,n.height=i),this.refreshRenderValues(),this.isPlaying||this.renderFrame()},this.canvasToWorld=(n,r=[0,0,0])=>{const i=this.videoCamera.panWorld,a=this.getWorldToCanvasRatio(),o=[i[0]*a,i[1]*a],s=[n[0]-o[0],n[1]-o[1]];return r.splice(0,2,s[0]/a,s[1]/a),r},this.worldToCanvas=n=>{const r=this.videoCamera.panWorld,i=this.getWorldToCanvasRatio();return[(n[0]+r[0])*i,(n[1]+r[1])*i]},this.getRotation=()=>0,this.canvasToIndex=n=>{const r=this.getTransform();return r.invert(),r.transformPoint(n.map(i=>i*devicePixelRatio))},this.indexToCanvas=n=>this.getTransform().transformPoint(n).map(i=>i/devicePixelRatio),this.customRenderViewportToCanvas=()=>{this.renderFrame()},this.renderFrame=()=>{const n=window.devicePixelRatio||1,i=this.getTransform().getMatrix(),a=this.canvasContext;a.resetTransform(),a.clearRect(0,0,this.canvas.width,this.canvas.height),a.transform(i[0]/n,i[1]/n,i[2]/n,i[3]/n,i[4]/n,i[5]/n),a.drawImage(this.videoElement,0,0,this.videoWidth,this.videoHeight);for(const s of this.getActors())s.actor.render(this,this.canvasContext);this.canvasContext.resetTransform(),dt(this.element,it.STACK_NEW_IMAGE,{element:this.element,viewportId:this.id,viewport:this,renderingEngineId:this.renderingEngineId,time:this.videoElement.currentTime,duration:this.videoElement.duration}),dt(this.element,it.IMAGE_RENDERED,{element:this.element,viewportId:this.id,viewport:this,imageIndex:this.getCurrentImageIdIndex(),numberOfSlices:this.numberOfFrames,renderingEngineId:this.renderingEngineId,time:this.videoElement.currentTime,duration:this.videoElement.duration}),this.initialRender?.();const o=this.getFrameNumber();this.isPlaying&&(o<this.frameRange[0]?this.setFrameNumber(this.frameRange[0]):o>this.frameRange[1]&&(this.loop?this.setFrameNumber(this.frameRange[0]):this.pause()))},this.renderWhilstPlaying=()=>{this.renderFrame(),this.isPlaying&&requestAnimationFrame(this.renderWhilstPlaying)},this.canvasContext=this.canvas.getContext("2d"),this.renderingEngineId=e.renderingEngineId,this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId),this.videoElement=document.createElement("video"),this.videoElement.muted=this.mute,this.videoElement.loop=this.loop,this.videoElement.autoplay=!0,this.videoElement.crossOrigin="anonymous",this.addEventListeners(),this.resize()}static get useCustomRenderingPipeline(){return!0}addEventListeners(){this.canvas.addEventListener(it.ELEMENT_DISABLED,this.elementDisabledHandler)}removeEventListeners(){this.canvas.removeEventListener(it.ELEMENT_DISABLED,this.elementDisabledHandler)}elementDisabledHandler(){this.removeEventListeners(),this.videoElement.remove()}getImageDataMetadata(e){const n=typeof e=="string"?e:e.imageId,r=Ot(Js.IMAGE_PLANE,n);let i=r.rowCosines,a=r.columnCosines;(r.usingDefaultValues||i==null||a==null)&&(i=[1,0,0],a=[0,1,0]);const s=Zn(i[0],i[1],i[2]),c=Zn(a[0],a[1],a[2]),{rows:l,columns:u}=r,f=ut();Tr(f,s,c);let d=r.imagePositionPatient;d==null&&(d=[0,0,0]);const h=r.columnPixelSpacing||1,m=r.rowPixelSpacing||1,p=r.columns,y=r.rows,x=1,S=1;return this.hasPixelSpacing=!!r.columnPixelSpacing,{bitsAllocated:8,numberOfComponents:3,origin:d,rows:l,columns:u,direction:[...s,...c,...f],dimensions:[p,y,S],spacing:[h,m,x],hasPixelSpacing:this.hasPixelSpacing,numVoxels:p*y*S,imagePlaneModule:r}}setDataIds(e,n){this.setVideo(e[0],(n.viewReference?.sliceIndex||0)+1)}setVideo(e,n){this.imageId=Array.isArray(e)?e[0]:e;const r=Ot(Js.IMAGE_URL,e);if(!r?.rendered)throw new Error(`Video Image ID ${e} does not have a rendered video view`);const{rendered:i}=r,a=Ot(Js.GENERAL_SERIES,e);this.modality=a?.Modality,this.metadata=this.getImageDataMetadata(e);let{cineRate:o,numberOfFrames:s}=Ot(Js.CINE,e);return this.numberOfFrames=s,this.setVideoURL(i).then(()=>((!s||s===1)&&(s=Math.round(this.videoElement.duration*(o||30))),o||(o=Math.round(s/this.videoElement.duration)),this.fps=o,this.numberOfFrames=s,this.setFrameRange([1,s]),this.initialRender=()=>{this.initialRender=null,this.pause(),this.setFrameNumber(n||1)},new Promise(c=>{window.setTimeout(()=>{this.setFrameNumber(n||1),c(this)},25)})))}async setVideoURL(e){return new Promise(n=>{this.videoElement.src=e,this.videoElement.preload="auto";const r=()=>{this.videoWidth=this.videoElement.videoWidth,this.videoHeight=this.videoElement.videoHeight,this.videoElement.removeEventListener("loadedmetadata",r),this.refreshRenderValues(),n(!0)};this.videoElement.addEventListener("loadedmetadata",r)})}getImageIds(){const e=new Array(this.numberOfFrames),n=this.imageId.replace(/[0-9]+$/,"");for(let r=0;r<this.numberOfFrames;r++)e[r]=`${n}${r+1}`;return e}togglePlayPause(){return this.isPlaying?(this.pause(),!1):(this.play(),!0)}async play(){try{this.isPlaying||(this.isPlaying=!0,await this.videoElement.play(),this.renderWhilstPlaying())}catch{}}pause(){try{this.isPlaying=!1,this.videoElement.pause()}catch{}}async scroll(e=1){await this.pause();const n=this.videoElement,r=this.renderFrame,a=n.currentTime+e*this.scrollSpeed/this.fps;n.currentTime=a;const o=s=>{r(),n.removeEventListener("seeked",o)};n.addEventListener("seeked",o)}async start(){const e=this.videoElement,n=this.renderFrame;if(e.currentTime=0,e.paused){const r=i=>{n(),e.removeEventListener("seeked",r)};e.addEventListener("seeked",r)}}async end(){const e=this.videoElement,n=this.renderFrame;if(e.currentTime=e.duration,e.paused){const r=i=>{n(),e.removeEventListener("seeked",r)};e.addEventListener("seeked",r)}}async setTime(e){const n=this.videoElement,r=this.renderFrame;if(n.currentTime=e,n.paused){const i=a=>{r(),n.removeEventListener("seeked",i)};n.addEventListener("seeked",i)}}getSliceViewInfo(){throw new Error("Method not implemented.")}async setFrameNumber(e){this.setTime((e-1)/this.fps)}setFrameRange(e){if(!e){this.frameRange=[1,this.numberOfFrames];return}e.length!==2||e[0]===e[1]||(this.frameRange=[e[0],e[1]])}getSliceIndexForImage(e){if(e){if(typeof e=="string")return vy.imageIdToFrameStart(e);if(e.referencedImageId)return vy.imageIdToFrameStart(e.referencedImageId)}}getFrameRange(){return this.frameRange}setProperties(e){e.loop!==void 0&&(this.videoElement.loop=e.loop),e.muted!==void 0&&(this.videoElement.muted=e.muted),e.playbackRate!==void 0&&this.setPlaybackRate(e.playbackRate),e.scrollSpeed!==void 0&&this.setScrollSpeed(e.scrollSpeed),e.voiRange&&this.setVOI(e.voiRange)}setPlaybackRate(e=1){if(this.playbackRate=e,e<.0625){this.pause();return}this.videoElement&&(this.videoElement.playbackRate=e,this.play())}setScrollSpeed(e=1,n=Gw.FRAME){this.scrollSpeed=n===Gw.SECOND?e*this.fps:e}resetProperties(){this.setProperties({loop:!1,muted:!0,voiRange:{lower:0,upper:255}})}getScalarData(){if(this.scalarData?.frameNumber===this.getFrameNumber())return this.scalarData;if(!this.videoElement||!this.videoElement.videoWidth||!this.videoElement.videoHeight){console.debug("Video not ready yet, returning empty scalar data");const a=new Uint8ClampedArray;return a.getRange=()=>[0,255],a.frameNumber=-1,a}const e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;const n=e.getContext("2d");n.drawImage(this.videoElement,0,0);const i=n.getImageData(0,0,e.width,e.height).data;return i.getRange=()=>[0,255],i.frameNumber=this.getFrameNumber(),this.scalarData=i,i}getImageData(){const{metadata:e}=this,n=e.spacing,r={getDirection:()=>e.direction,getDimensions:()=>e.dimensions,getRange:()=>[0,255],getScalarData:()=>this.getScalarData(),getSpacing:()=>e.spacing,worldToIndex:a=>{const o=this.worldToCanvas(a),s=this.canvasToIndex(o);return[s[0],s[1],0]},indexToWorld:(a,o)=>{const s=this.indexToCanvas([a[0],a[1]]);return this.canvasToWorld(s,o)}},i={dimensions:e.dimensions,spacing:n,origin:e.origin,direction:e.direction,metadata:{Modality:this.modality,FrameOfReferenceUID:e.FrameOfReferenceUID},getScalarData:()=>this.getScalarData(),scalarData:this.getScalarData(),imageData:r,voxelManager:{forEach:(a,o)=>Fwe(o.imageData,{pointInShapeFn:o.isInObject??(()=>!0),callback:a,boundsIJK:o.boundsIJK,returnPoints:o.returnPoints??!1})},hasPixelSpacing:this.hasPixelSpacing,calibration:this.calibration,preScale:{scaled:!1}};return Object.defineProperty(r,"scalarData",{get:()=>this.getScalarData(),enumerable:!0}),i}hasImageURI(e){const n=e.match(aw.frameRangeExtractor),r=n?e.substring(0,n.index):e;return this.imageId.includes(r)}setVOI(e){this.voiRange=e;const n=this.setColorTransform(e,this.averageWhite);this.canvas.style.filter=n}setWindowLevel(e=256,n=128){const r=n-e/2,i=n+e/2-1;this.setVOI({lower:r,upper:i}),this.setColorTransform({lower:r,upper:i},this.averageWhite)}setAverageWhite(e){this.averageWhite=e,this.setColorTransform(this.voiRange,e)}setCamera(e){const{parallelScale:n,focalPoint:r}=e;if(n&&(this.videoCamera.parallelScale=this.element.clientHeight/2/n),r!==void 0){const i=this.worldToCanvas(r),a=[this.element.clientWidth/2,this.element.clientHeight/2],o=[(i[0]-a[0])/this.videoCamera.parallelScale,(i[1]-a[1])/this.videoCamera.parallelScale];this.videoCamera.panWorld=[this.videoCamera.panWorld[0]-o[0],this.videoCamera.panWorld[1]-o[1]]}this.canvasContext.fillStyle="rgba(0,0,0,1)",this.canvasContext.fillRect(0,0,this.canvas.width,this.canvas.height),this.isPlaying||this.renderFrame()}getCurrentImageId(e=this.getCurrentImageIdIndex()){return this.imageId?.replace("/frames/1",`/frames/${e+1}`)}getViewReferenceId(e={}){const{sliceIndex:n}=e;return n===void 0?`videoId:${this.getCurrentImageId()}`:Array.isArray(n)?`videoId:${this.imageId.substring(0,this.imageId.length-1)}${n[0]+1}-${n[1]+1}`:`videoId:${this.imageId.replace("/frames/1",`/frames/${1+n}`)}`}isReferenceViewable(e,n={}){let{imageURI:r}=n;const{referencedImageId:i,sliceIndex:a,multiSliceReference:o}=e;if(!super.isReferenceViewable(e))return!1;const s=this.getCurrentImageId();if(!r){const d=s.indexOf(":");r=s.substring(d+1,s.length-1)}if(n.withNavigation)return!0;const c=this.getSliceIndex();if(o){const d=vy.imageIdToFrameEnd(o.referencedImageId);return c>=a&&c<=d}if(a!==void 0)return c===a;if(!i)return!1;const l=i.match(aw.frameRangeExtractor);if(!l||!l[2])return!0;const u=l[2].split("-").map(d=>Number(d)),f=c+1;return u[0]<=f&&f<=(u[1]??u[0])}setViewReference(e){typeof e.sliceIndex=="number"?this.setFrameNumber(e.sliceIndex+1):Array.isArray(e.sliceIndex)&&this.setFrameRange(e.sliceIndex)}getViewReference(e){const n=e?.sliceIndex??(this.isPlaying?this.frameRange[0]:this.getCurrentImageIdIndex()),r=e?.rangeEndSliceIndex??(this.isPlaying?this.frameRange[1]-1:void 0),i=r>n?{sliceIndex:r,referencedImageId:this.getCurrentImageId(r)}:void 0;return{...super.getViewReference(e),referencedImageId:this.getViewReferenceId(e),sliceIndex:n,multiSliceReference:i}}getFrameNumber(){return 1+this.getCurrentImageIdIndex()}getCurrentImageIdIndex(){return Math.round(this.videoElement.currentTime*this.fps)}getSliceIndex(){return this.getCurrentImageIdIndex()/this.scrollSpeed}getCamera(){const{parallelScale:e}=this.videoCamera,n=[this.element.clientWidth/2,this.element.clientHeight/2];return{parallelProjection:!0,focalPoint:this.canvasToWorld(n),position:[0,0,0],viewUp:[0,-1,0],parallelScale:this.element.clientHeight/2/e,viewPlaneNormal:[0,0,1]}}getFrameRate(){return this.fps}getPan(){const e=this.videoCamera.panWorld;return[e[0],e[1]]}refreshRenderValues(){let e=this.canvas.offsetWidth/this.videoWidth;this.videoHeight*e>this.canvas.height&&(e=this.canvas.offsetHeight/this.videoHeight);const n=Math.floor(this.videoWidth*e),r=Math.floor(this.videoHeight*e),i=(this.canvas.offsetWidth-n)/2,a=(this.canvas.offsetHeight-r)/2,o=i/e,s=a/e;this.videoCamera.panWorld=[o,s],this.videoCamera.parallelScale=e}getWorldToCanvasRatio(){return this.videoCamera.parallelScale}getCanvasToWorldRatio(){return 1/this.videoCamera.parallelScale}getTransform(){const e=this.videoCamera.panWorld,n=window.devicePixelRatio||1,r=this.getWorldToCanvasRatio(),i=this.getCanvasToWorldRatio(),a=[this.canvas.offsetWidth/2,this.canvas.offsetHeight/2],o=[a[0]*i,a[1]*i],s=new j2;return s.scale(n,n),s.translate(a[0],a[1]),s.scale(r,r),s.translate(e[0],e[1]),s.translate(-o[0],-o[1]),s}updateCameraClippingPlanesAndRange(){}addImages(e){const n=this.getActors();e.forEach(r=>{const{imageId:i,...a}=r,o=Ct.getImage(i),s=this.createActorMapper(o),c=r.actorUID??ya();s&&(n.push({uid:c,actor:s,referencedId:i,...a}),r.callback&&r.callback({imageActor:s,imageId:i}))}),this.setActors(n)}createActorMapper(e){return new cIt(this,e)}};aw.frameRangeExtractor=/(\/frames\/|[&?]frameNumber=)([^/&?]*)/i;let _k=aw;const lIt=`
.DicomMicroscopyViewer {
  --ol-partial-background-color: rgba(127, 127, 127, 0.7);
  --ol-foreground-color: #000000;
  --ol-subtle-foreground-color: #000;
  --ol-subtle-background-color: rgba(78, 78, 78, 0.5);
}

.DicomMicroscopyViewer .ol-box {
  box-sizing: border-box;
  border-radius: 2px;
  border: 1.5px solid var(--ol-background-color);
  background-color: var(--ol-partial-background-color);
}

.DicomMicroscopyViewer .ol-mouse-position {
  top: 8px;
  right: 8px;
  position: absolute;
}

.DicomMicroscopyViewer .ol-scale-line {
  background: var(--ol-partial-background-color);
  border-radius: 4px;
  bottom: 8px;
  left: 8px;
  padding: 2px;
  position: absolute;
}

.DicomMicroscopyViewer .ol-scale-line-inner {
  border: 1px solid var(--ol-subtle-foreground-color);
  border-top: none;
  color: var(--ol-foreground-color);
  font-size: 10px;
  text-align: center;
  margin: 1px;
  will-change: contents, width;
  transition: all 0.25s;
}

.DicomMicroscopyViewer .ol-scale-bar {
  position: absolute;
  bottom: 8px;
  left: 8px;
}

.DicomMicroscopyViewer .ol-scale-bar-inner {
  display: flex;
}

.DicomMicroscopyViewer .ol-scale-step-marker {
  width: 1px;
  height: 15px;
  background-color: var(--ol-foreground-color);
  float: right;
  z-index: 10;
}

.DicomMicroscopyViewer .ol-scale-step-text {
  position: absolute;
  bottom: -5px;
  font-size: 10px;
  z-index: 11;
  color: var(--ol-foreground-color);
  text-shadow:
    -1.5px 0 var(--ol-partial-background-color),
    0 1.5px var(--ol-partial-background-color),
    1.5px 0 var(--ol-partial-background-color),
    0 -1.5px var(--ol-partial-background-color);
}

.DicomMicroscopyViewer .ol-scale-text {
  position: absolute;
  font-size: 12px;
  text-align: center;
  bottom: 25px;
  color: var(--ol-foreground-color);
  text-shadow:
    -1.5px 0 var(--ol-partial-background-color),
    0 1.5px var(--ol-partial-background-color),
    1.5px 0 var(--ol-partial-background-color),
    0 -1.5px var(--ol-partial-background-color);
}

.DicomMicroscopyViewer .ol-scale-singlebar {
  position: relative;
  height: 10px;
  z-index: 9;
  box-sizing: border-box;
  border: 1px solid var(--ol-foreground-color);
}

.DicomMicroscopyViewer .ol-scale-singlebar-even {
  background-color: var(--ol-subtle-foreground-color);
}

.DicomMicroscopyViewer .ol-scale-singlebar-odd {
  background-color: var(--ol-background-color);
}

.DicomMicroscopyViewer .ol-unsupported {
  display: none;
}

.DicomMicroscopyViewer .ol-viewport,
.DicomMicroscopyViewer .ol-unselectable {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.DicomMicroscopyViewer .ol-viewport canvas {
  all: unset;
}

.DicomMicroscopyViewer .ol-selectable {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

.DicomMicroscopyViewer .ol-grabbing {
  cursor: -webkit-grabbing;
  cursor: -moz-grabbing;
  cursor: grabbing;
}

.DicomMicroscopyViewer .ol-grab {
  cursor: move;
  cursor: -webkit-grab;
  cursor: -moz-grab;
  cursor: grab;
}

.DicomMicroscopyViewer .ol-control {
  position: absolute;
  background-color: var(--ol-subtle-background-color);
  border-radius: 4px;
}

.DicomMicroscopyViewer .ol-zoom {
  top: 0.5em;
  left: 0.5em;
}

.DicomMicroscopyViewer .ol-rotate {
  top: 0.5em;
  right: 0.5em;
  transition:
    opacity 0.25s linear,
    visibility 0s linear;
}

.DicomMicroscopyViewer .ol-rotate.ol-hidden {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s linear,
    visibility 0s linear 0.25s;
}

.DicomMicroscopyViewer .ol-zoom-extent {
  top: 4.643em;
  left: 0.5em;
}

.DicomMicroscopyViewer .ol-full-screen {
  right: 0.5em;
  top: 0.5em;
}

.DicomMicroscopyViewer .ol-control button {
  display: block;
  margin: 1px;
  padding: 0;
  color: var(--ol-subtle-foreground-color);
  font-weight: bold;
  text-decoration: none;
  font-size: inherit;
  text-align: center;
  height: 1.375em;
  width: 1.375em;
  line-height: 0.4em;
  background-color: var(--ol-background-color);
  border: none;
  border-radius: 2px;
}

.DicomMicroscopyViewer .ol-control button::-moz-focus-inner {
  border: none;
  padding: 0;
}

.DicomMicroscopyViewer .ol-zoom-extent button {
  line-height: 1.4em;
}

.DicomMicroscopyViewer .ol-compass {
  display: block;
  font-weight: normal;
  will-change: transform;
}

.DicomMicroscopyViewer .ol-touch .ol-control button {
  font-size: 1.5em;
}

.DicomMicroscopyViewer .ol-touch .ol-zoom-extent {
  top: 5.5em;
}

.DicomMicroscopyViewer .ol-control button:hover,
.DicomMicroscopyViewer .ol-control button:focus {
  text-decoration: none;
  outline: 1px solid var(--ol-subtle-foreground-color);
  color: var(--ol-foreground-color);
}

.DicomMicroscopyViewer .ol-zoom .ol-zoom-in {
  border-radius: 2px 2px 0 0;
}

.DicomMicroscopyViewer .ol-zoom .ol-zoom-out {
  border-radius: 0 0 2px 2px;
}

.DicomMicroscopyViewer .ol-attribution {
  text-align: right;
  bottom: 0.5em;
  right: 0.5em;
  max-width: calc(100% - 1.3em);
  display: flex;
  flex-flow: row-reverse;
  align-items: center;
}

.DicomMicroscopyViewer .ol-attribution a {
  color: var(--ol-subtle-foreground-color);
  text-decoration: none;
}

.DicomMicroscopyViewer .ol-attribution ul {
  margin: 0;
  padding: 1px 0.5em;
  color: var(--ol-foreground-color);
  text-shadow: 0 0 2px var(--ol-background-color);
  font-size: 12px;
}

.DicomMicroscopyViewer .ol-attribution li {
  display: inline;
  list-style: none;
}

.DicomMicroscopyViewer .ol-attribution li:not(:last-child):after {
  content: ' ';
}

.DicomMicroscopyViewer .ol-attribution img {
  max-height: 2em;
  max-width: inherit;
  vertical-align: middle;
}

.DicomMicroscopyViewer .ol-attribution button {
  flex-shrink: 0;
}

.DicomMicroscopyViewer .ol-attribution.ol-collapsed ul {
  display: none;
}

.DicomMicroscopyViewer .ol-attribution:not(.ol-collapsed) {
  background: var(--ol-partial-background-color);
}

.DicomMicroscopyViewer .ol-attribution.ol-uncollapsible {
  bottom: 0;
  right: 0;
  border-radius: 4px 0 0;
}

.DicomMicroscopyViewer .ol-attribution.ol-uncollapsible img {
  margin-top: -0.2em;
  max-height: 1.6em;
}

.DicomMicroscopyViewer .ol-attribution.ol-uncollapsible button {
  display: none;
}

.DicomMicroscopyViewer .ol-zoomslider {
  top: 4.5em;
  left: 0.5em;
  height: 200px;
}

.DicomMicroscopyViewer .ol-zoomslider button {
  position: relative;
  height: 10px;
}

.DicomMicroscopyViewer .ol-touch .ol-zoomslider {
  top: 5.5em;
}

.DicomMicroscopyViewer .ol-overviewmap {
  left: 0.5em;
  bottom: 0.5em;
}

.DicomMicroscopyViewer .ol-overviewmap.ol-uncollapsible {
  bottom: 0;
  left: 0;
  border-radius: 0 4px 0 0;
}

.DicomMicroscopyViewer .ol-overviewmap .ol-overviewmap-map,
.DicomMicroscopyViewer .ol-overviewmap button {
  display: block;
}

.DicomMicroscopyViewer .ol-overviewmap .ol-overviewmap-map {
  border: 1px solid var(--ol-subtle-foreground-color);
  height: 150px;
  width: 150px;
}

.DicomMicroscopyViewer .ol-overviewmap:not(.ol-collapsed) button {
  bottom: 0;
  left: 0;
  position: absolute;
}

.DicomMicroscopyViewer .ol-overviewmap.ol-collapsed .ol-overviewmap-map,
.DicomMicroscopyViewer .ol-overviewmap.ol-uncollapsible button {
  display: none;
}

.DicomMicroscopyViewer .ol-overviewmap:not(.ol-collapsed) {
  background: var(--ol-subtle-background-color);
}

.DicomMicroscopyViewer .ol-overviewmap-box {
  border: 0.5px dotted var(--ol-subtle-foreground-color);
}

.DicomMicroscopyViewer .ol-overviewmap .ol-overviewmap-box:hover {
  cursor: move;
}

@layout-header-background: #007ea3;
@primary-color: #007ea3;
@processing-color: #8cb8c6;
@success-color: #3f9c35;
@warning-color: #eeaf30;
@error-color: #96172e;
@font-size-base: 14px;

.DicomMicroscopyViewer .ol-tooltip {
  font-size: 16px !important;
}
`;let o5=null;const uIt="postrender",Qv=class Qv extends r9{constructor(e){super({...e,canvas:e.canvas||xu(e.element)}),this.internalCamera={rotation:0,centerIndex:[0,0],extent:[0,-2,1,-1],xSpacing:1,ySpacing:1,resolution:1,zoom:1},this.voiRange={lower:0,upper:255},this.getProperties=()=>({voiRange:{...this.voiRange}}),this.resetCamera=()=>!0,this.getNumberOfSlices=()=>1,this.getFrameOfReferenceUID=()=>this.frameOfReferenceUID,this.resize=()=>{const r=this.canvas,{clientWidth:i,clientHeight:a}=r;(r.width!==i||r.height!==a)&&(r.width=i,r.height=a),this.refreshRenderValues()},this.canvasToWorld=r=>{if(!this.metadata)return;const i=this.canvasToIndex(r);return i[1]=-i[1],this.indexToWorld(i)},this.worldToCanvas=r=>{if(!this.metadata)return;const i=this.worldToIndex(r);return i[1]=-i[1],this.indexToCanvas([i[0],i[1],0])},this.postrender=()=>{this.refreshRenderValues(),dt(this.element,it.IMAGE_RENDERED,{element:this.element,viewportId:this.id,viewport:this,renderingEngineId:this.renderingEngineId})},this.getRotation=()=>0,this.canvasToIndex=r=>{const i=this.getTransform();i.invert();const a=i.transformPoint(r.map(o=>o*devicePixelRatio));return[a[0],a[1],0]},this.indexToCanvas=r=>this.getTransform().transformPoint([r[0],r[1]]).map(a=>a/devicePixelRatio),this.customRenderViewportToCanvas=()=>{},this.getImageIds=()=>[this.imageIds[0]],this.renderingEngineId=e.renderingEngineId,this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId),this.element.style.position="relative",this.microscopyElement=document.createElement("div"),this.microscopyElement.setAttribute("class","DicomMicroscopyViewer"),this.microscopyElement.id=ya(),this.microscopyElement.innerText="Initial",this.microscopyElement.style.background="grey",this.microscopyElement.style.width="100%",this.microscopyElement.style.height="100%",this.microscopyElement.style.position="absolute",this.microscopyElement.style.left="0",this.microscopyElement.style.top="0";const n=this.element.firstElementChild;n.insertBefore(this.microscopyElement,n.childNodes[1]),this.addEventListeners(),this.addWidget("DicomMicroscopyViewer",{getEnabled:()=>!!this.viewer,setEnabled:()=>{this.elementDisabledHandler()}}),this.resize()}static get useCustomRenderingPipeline(){return!0}addEventListeners(){this.canvas.addEventListener(it.ELEMENT_DISABLED,this.elementDisabledHandler)}removeEventListeners(){this.canvas.removeEventListener(it.ELEMENT_DISABLED,this.elementDisabledHandler)}elementDisabledHandler(){this.removeEventListeners(),this.viewer?.cleanup(),this.viewer=null,this.element.firstElementChild.removeChild(this.microscopyElement),this.microscopyElement=null}getImageDataMetadata(e=0){const n=this.metadataDicomweb.reduce((V,k)=>V?.NumberOfFrames<k.NumberOfFrames?k:V),{TotalPixelMatrixColumns:r,TotalPixelMatrixRows:i,ImageOrientationSlide:a,ImagedVolumeWidth:o,ImagedVolumeHeight:s,ImagedVolumeDepth:c}=n,l=Ot(Js.IMAGE_PLANE,this.imageIds[e]);let u=a.slice(0,3),f=a.slice(3,6);(u==null||f==null)&&(u=[1,0,0],f=[0,1,0]);const d=Zn(u[0],u[1],u[2]),h=Zn(f[0],f[1],f[2]),m=ut();Tr(m,d,h);const{XOffsetInSlideCoordinateSystem:p=0,YOffsetInSlideCoordinateSystem:y=0,ZOffsetInSlideCoordinateSystem:x=0}=n.TotalPixelMatrixOriginSequence?.[0]||{},S=[p,y,x],C=o/r,_=s/i,T=r,O=i,M=c,I=1;return this.hasPixelSpacing=!!(o&&s),{bitsAllocated:8,numberOfComponents:3,origin:S,direction:[...d,...h,...m],dimensions:[T,O,I],spacing:[C,_,M],hasPixelSpacing:this.hasPixelSpacing,numVoxels:T*O*I,imagePlaneModule:l}}async setFrameNumber(e){}setProperties(e){e.voiRange&&this.setVOI(e.voiRange)}resetProperties(){this.setProperties({voiRange:{lower:0,upper:255}})}setVOI(e){this.voiRange=e;const n=this.setColorTransform(e,this.averageWhite);this.map.getViewport().querySelectorAll(".ol-layers canvas").forEach(i=>{i.style.filter=n})}setAverageWhite(e){this.averageWhite=e,this.setColorTransform(this.voiRange,e)}getScalarData(){return null}computeTransforms(){const e=Td(),n=Td();return p3(e,this.metadata.origin),e[0]=this.metadata.direction[0],e[1]=this.metadata.direction[1],e[2]=this.metadata.direction[2],e[4]=this.metadata.direction[3],e[5]=this.metadata.direction[4],e[6]=this.metadata.direction[5],e[8]=this.metadata.direction[6],e[9]=this.metadata.direction[7],e[10]=this.metadata.direction[8],Ed(e,e,this.metadata.spacing),Na(n,e),{indexToWorld:e,worldToIndex:n}}getImageData(){const{metadata:e}=this;if(!e)return null;const{spacing:n}=e,r={getDirection:()=>e.direction,getDimensions:()=>e.dimensions,getRange:()=>[0,255],getScalarData:()=>this.getScalarData(),getSpacing:()=>e.spacing,worldToIndex:a=>this.worldToIndex(a),indexToWorld:a=>this.indexToWorld(a)};return{dimensions:e.dimensions,spacing:n,numberOfComponents:3,origin:e.origin,direction:e.direction,metadata:{Modality:this.modality,FrameOfReferenceUID:this.frameOfReferenceUID},hasPixelSpacing:this.hasPixelSpacing,calibration:this.calibration,preScale:{scaled:!1},scalarData:this.getScalarData(),imageData:r}}hasImageURI(e){return!0}setCamera(e){const n=this.getCamera(),{parallelScale:r,focalPoint:i}=e,a=this.getView(),{xSpacing:o}=this.internalCamera;if(r){const c=this.element.clientHeight/r,l=1/o/c;a.setResolution(l)}if(i){const c=this.worldToCanvas(i),l=this.canvasToIndex(c);a.setCenter(l)}const s=this.getCamera();this.triggerCameraModifiedEventIfNecessary(n,s)}getCurrentImageId(){return this.imageIds[0]}getFrameNumber(){return 1}getCamera(){this.refreshRenderValues();const{resolution:e,xSpacing:n,centerIndex:r}=this.internalCamera,i=e*n,a=this.indexToCanvas([r[0],r[1],0]),o=this.canvasToWorld(a);return{parallelProjection:!0,focalPoint:o,position:o,viewUp:[0,-1,0],parallelScale:this.element.clientHeight*i,viewPlaneNormal:[0,0,1]}}worldToIndexWSI(e){if(!o5)return;const n=this.viewer.getAffine(),r=o5.applyInverseTransform({coordinate:[e[0],e[1]],affine:n});return[r[0],r[1]]}indexToWorldWSI(e){if(!o5)return;const n=o5.applyTransform({coordinate:[e[0],e[1]],affine:this.viewer.getAffine()});return[n[0],n[1],0]}worldToIndex(e){const{worldToIndex:n}=this.computeTransforms(),r=ut();return gr(r,e,n),r}indexToWorld(e){const{indexToWorld:n}=this.computeTransforms(),r=ut(),i=Zn(...e);return gr(r,i,n),[r[0],r[1],r[2]]}setDataIds(e,n){n?.miniNavigationOverlay!==!1&&Qv.addMiniNavigationOverlayCss();const r=n?.webClient||Ot(Js.WADO_WEB_CLIENT,e[0]);if(!r)throw new Error(`To use setDataIds on WSI data, you must provide metaData.webClient for ${e[0]}`);return this.setWSI(e,r)}async setWSI(e,n){this.microscopyElement.style.background="black",this.microscopyElement.innerText="Loading",this.imageIds=e;const r=await Qv.getDicomMicroscopyViewer();o5||=r.utils,this.frameOfReferenceUID=null;const i=this.imageIds.map(s=>{const c=n.getDICOMwebMetadata(s);Object.defineProperty(c,"isMultiframe",{value:c.isMultiframe,enumerable:!1}),Object.defineProperty(c,"frameNumber",{value:void 0,enumerable:!1});const l=c["00080008"]?.Value;l?.length===1&&(c["00080008"].Value=l[0].split("\\"));const u=c["00200052"]?.Value?.[0];return this.frameOfReferenceUID?u!==this.frameOfReferenceUID&&(c["00200052"].Value=[this.frameOfReferenceUID]):this.frameOfReferenceUID=u,c}),a=[];i.forEach(s=>{const c=new r.metadata.VLWholeSlideMicroscopyImage({metadata:s}),l=c.ImageType[2];l==="VOLUME"||l==="THUMBNAIL"?a.push(c):console.log("Unknown image type",c.ImageType)}),this.metadataDicomweb=a;const o=new r.viewer.VolumeImageViewer({client:n,metadata:a,controls:["overview","position"],retrieveRendered:!1,bindings:{}});o.render({container:this.microscopyElement}),this.metadata=this.getImageDataMetadata(),o.deactivateDragPanInteraction(),this.viewer=o,this.map=o.getMap(),this.map.on(uIt,this.postrender),this.resize(),this.microscopyElement.innerText="",Object.assign(this.microscopyElement.style,{"--ol-partial-background-color":"rgba(127, 127, 127, 0.7)","--ol-foreground-color":"#000000","--ol-subtle-foreground-color":"#000","--ol-subtle-background-color":"rgba(78, 78, 78, 0.5)",background:"none"})}scroll(e){const n=this.getCamera();this.setCamera({parallelScale:n.parallelScale*(1+.1*e)})}getSliceIndex(){return 0}getView(){if(!this.viewer)return;const e=this.viewer.getMap(),n=window;return n.map=e,n.viewer=this.viewer,n.view=e?.getView(),n.wsi=this,e?.getView()}refreshRenderValues(){const e=this.getView();if(!e)return;const n=e.getResolution();if(!n||n<_u)return;const r=e.getCenter(),i=e.getProjection().getExtent(),a=e.getRotation(),o=e.getZoom(),{metadata:{spacing:[s,c]}}=this,l=1/n/s;Object.assign(this.internalCamera,{extent:i,centerIndex:r,worldToCanvasRatio:l,xSpacing:s,ySpacing:c,resolution:n,rotation:a,zoom:o})}getZoom(){return this.getView()?.getZoom()}setZoom(e){this.getView()?.setZoom(e)}getTransform(){this.refreshRenderValues();const{centerIndex:e,resolution:n,rotation:r}=this.internalCamera,i=[this.canvas.width/2,this.canvas.height/2],a=new j2;return a.translate(i[0],i[1]),a.rotate(r),a.scale(1/n,-1/n),a.translate(-e[0],-e[1]),a}getViewReferenceId(){return`imageId:${this.getCurrentImageId()}`}getCurrentImageIdIndex(){return 0}static addMiniNavigationOverlayCss(){if(document.getElementById(this.overlayCssId))return;const e=document.createElement("style");e.innerText=lIt,e.setAttribute("id",this.overlayCssId),document.getElementsByTagName("head")[0].append(e)}};Qv.getDicomMicroscopyViewer=async()=>Zwt("dicom-microscopy-viewer"),Qv.overlayCssId="overlayCss";let Tk=Qv;const T3e={[Rr.ORTHOGRAPHIC]:is,[Rr.PERSPECTIVE]:is,[Rr.STACK]:Ms,[Rr.VOLUME_3D]:$F,[Rr.VIDEO]:_k,[Rr.WHOLE_SLIDE]:Tk};function ld(t){return T3e[t].useCustomRenderingPipeline}const Sc={WIDTH:160,HEIGHT:96,TEXT_PADDING:3,TEXT_Y_OFFSET:2,GRAPH_Y_OFFSET:15,GRAPH_WIDTH:150,GRAPH_HEIGHT:70,FONT_SIZE:9,FONT_FAMILY:"Helvetica,Arial,sans-serif",GRAPH_ALPHA:.9},US={UPDATE_INTERVAL:1e3,MAX_MS_VALUE:200,MAX_FPS_VALUE:300,OVERLAY_STYLES:{position:"fixed",top:"0px",right:"0px",left:"auto",zIndex:"9999",cursor:"pointer",opacity:"0.9"}},qR={BYTES_TO_MB:1048576,MS_PER_SECOND:1e3},p0=[{name:"FPS",foregroundColor:"#0ff",backgroundColor:"#002"},{name:"MS",foregroundColor:"#0f0",backgroundColor:"#020"},{name:"MB",foregroundColor:"#f08",backgroundColor:"#201"}];class KR{constructor(e,n,r){this.minValue=1/0,this.maxValue=0,this.name=e,this.foregroundColor=n,this.backgroundColor=r,this.devicePixelRatio=Math.round(window.devicePixelRatio||1),this.dimensions=this.calculateDimensions(),this.dom=this.createCanvas(),this.context=this.initializeContext(),this.drawInitialPanel()}update(e,n){this.updateMinMax(e),this.clearTextArea(),this.drawText(e),this.scrollGraph(),this.drawNewValue(e,n)}calculateDimensions(){const e=this.devicePixelRatio;return{width:Sc.WIDTH*e,height:Sc.HEIGHT*e,textX:Sc.TEXT_PADDING*e,textY:Sc.TEXT_Y_OFFSET*e,graphX:Sc.TEXT_PADDING*e,graphY:Sc.GRAPH_Y_OFFSET*e,graphWidth:Sc.GRAPH_WIDTH*e,graphHeight:Sc.GRAPH_HEIGHT*e}}createCanvas(){const e=document.createElement("canvas");return e.width=this.dimensions.width,e.height=this.dimensions.height,e.style.cssText=`width:${Sc.WIDTH}px;height:${Sc.HEIGHT}px`,e}initializeContext(){const e=this.dom.getContext("2d");if(!e)throw new Error("Failed to get 2D context");return e.font=`bold ${Sc.FONT_SIZE*this.devicePixelRatio}px ${Sc.FONT_FAMILY}`,e.textBaseline="top",e}drawInitialPanel(){const{width:e,height:n,textX:r,textY:i,graphX:a,graphY:o,graphWidth:s,graphHeight:c}=this.dimensions;this.context.fillStyle=this.backgroundColor,this.context.fillRect(0,0,e,n),this.context.fillStyle=this.foregroundColor,this.context.fillText(this.name,r,i),this.context.fillRect(a,o,s,c),this.context.fillStyle=this.backgroundColor,this.context.globalAlpha=Sc.GRAPH_ALPHA,this.context.fillRect(a,o,s,c),this.context.globalAlpha=1}updateMinMax(e){this.minValue=Math.min(this.minValue,e),this.maxValue=Math.max(this.maxValue,e)}clearTextArea(){const{width:e,graphY:n}=this.dimensions;this.context.fillStyle=this.backgroundColor,this.context.fillRect(0,0,e,n)}drawText(e){const{textX:n,textY:r}=this.dimensions,i=this.formatText(e);this.context.fillStyle=this.foregroundColor,this.context.fillText(i,n,r)}formatText(e){const n=Math.round(e),r=Math.round(this.minValue),i=Math.round(this.maxValue);return`${n} ${this.name} (${r}-${i})`}scrollGraph(){const{graphX:e,graphY:n,graphWidth:r,graphHeight:i}=this.dimensions,a=this.devicePixelRatio;this.context.drawImage(this.dom,e+a,n,r-a,i,e,n,r-a,i)}drawNewValue(e,n){const{graphX:r,graphY:i,graphWidth:a,graphHeight:o}=this.dimensions,s=this.devicePixelRatio,c=r+a-s;this.context.fillStyle=this.foregroundColor,this.context.fillRect(c,i,s,o);const l=Math.round((1-e/n)*o);this.context.fillStyle=this.backgroundColor,this.context.globalAlpha=Sc.GRAPH_ALPHA,this.context.fillRect(c,i,s,l),this.context.globalAlpha=1}}var Do;(function(t){t[t.FPS=0]="FPS",t[t.MS=1]="MS",t[t.MEMORY=2]="MEMORY"})(Do||(Do={}));var id;let fIt=(id=class{constructor(){this.dom=null,this.currentMode=0,this.startTime=0,this.lastUpdateTime=0,this.frameCount=0,this.panels=new Map,this.animationFrameId=null,this.isSetup=!1}static getInstance(){return id.instance||(id.instance=new id),id.instance}setup(){if(!this.isSetup)try{this.dom=this.createOverlayElement(),this.startTime=performance.now(),this.lastUpdateTime=this.startTime,this.initializePanels(),this.showPanel(Do.FPS),this.applyOverlayStyles(),document.body.appendChild(this.dom),this.startLoop(),this.isSetup=!0}catch(e){console.warn("Failed to setup stats overlay:",e)}}cleanup(){this.stopLoop(),this.dom&&this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.dom=null,this.panels.clear(),this.isSetup=!1}showPanel(e){Array.from(this.dom.children).forEach((r,i)=>{r.style.display=i===e?"block":"none"}),this.currentMode=e}update(){this.startTime=this.updateStats()}createOverlayElement(){const e=document.createElement("div");return e.addEventListener("click",this.handleClick.bind(this),!1),e}applyOverlayStyles(){Object.assign(this.dom.style,US.OVERLAY_STYLES)}handleClick(e){e.preventDefault();const n=this.dom.children.length;this.showPanel((this.currentMode+1)%n)}initializePanels(){const e=new KR(p0[Do.FPS].name,p0[Do.FPS].foregroundColor,p0[Do.FPS].backgroundColor);this.addPanel(Do.FPS,e);const n=new KR(p0[Do.MS].name,p0[Do.MS].foregroundColor,p0[Do.MS].backgroundColor);if(this.addPanel(Do.MS,n),this.isMemoryAvailable()){const r=new KR(p0[Do.MEMORY].name,p0[Do.MEMORY].foregroundColor,p0[Do.MEMORY].backgroundColor);this.addPanel(Do.MEMORY,r)}}isMemoryAvailable(){return performance.memory!==void 0}addPanel(e,n){this.dom.appendChild(n.dom),this.panels.set(e,n)}startLoop(){const e=()=>{this.update(),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}stopLoop(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}updateStats(){this.frameCount++;const e=performance.now(),n=e-this.startTime,r=this.panels.get(Do.MS);if(r&&r.update(n,US.MAX_MS_VALUE),e>=this.lastUpdateTime+US.UPDATE_INTERVAL){const i=this.frameCount*qR.MS_PER_SECOND/(e-this.lastUpdateTime),a=this.panels.get(Do.FPS);a&&a.update(i,US.MAX_FPS_VALUE),this.lastUpdateTime=e,this.frameCount=0,this.updateMemoryPanel()}return e}updateMemoryPanel(){const e=this.panels.get(Do.MEMORY);if(!e)return;const n=performance;if(n.memory){const r=n.memory.usedJSHeapSize/qR.BYTES_TO_MB,i=n.memory.jsHeapSizeLimit/qR.BYTES_TO_MB;e.update(r,i)}}},id.instance=null,id);const Vte=fIt.getInstance(),i6=2;class E3e{constructor(e){if(this._needsRender=new Set,this._animationFrameSet=!1,this._animationFrameHandle=null,this.renderFrameOfReference=r=>{const a=this._getViewportsAsArray().map(o=>{if(o.getFrameOfReferenceUID()===r)return o.id});this.renderViewports(a)},this.id=e||ya(),this.useCPURendering=q5(),Ww.set(this),!Xwt())throw new Error("@cornerstonejs/core is not initialized, run init() first");this._viewports=new Map,this.hasBeenDestroyed=!1,mf()?.debug?.statsOverlay&&Vte.setup()}enableElement(e){const n=this._normalizeViewportInputEntry(e);this._throwIfDestroyed();const{element:r,viewportId:i}=n;if(!r)throw new Error("No element provided");this.getViewport(i)&&this.disableElement(i);const{type:o}=n,s=ld(o);!this.useCPURendering&&!s?this.enableVTKjsDrivenViewport(n):this.addCustomViewport(n);const c=xu(r),{background:l}=n.defaultOptions;this.fillCanvasWithBackgroundColor(c,l)}disableElement(e){this._throwIfDestroyed();const n=this.getViewport(e);if(!n){console.warn(`viewport ${e} does not exist`);return}this._resetViewport(n),!ld(n.type)&&!this.useCPURendering&&this.offscreenMultiRenderWindow&&this.offscreenMultiRenderWindow.removeRenderer(e),this._removeViewport(e),n.isDisabled=!0,this._needsRender.delete(e),this.getViewports().length||this._clearAnimationFrame()}setViewports(e){const n=this._normalizeViewportInputEntries(e);this._throwIfDestroyed(),this._reset();const r=[],i=[];n.forEach(a=>{!this.useCPURendering&&!ld(a.type)?r.push(a):i.push(a)}),this.setVtkjsDrivenViewports(r),this.setCustomViewports(i),n.forEach(a=>{const o=xu(a.element),{background:s}=a.defaultOptions;this.fillCanvasWithBackgroundColor(o,s)})}resize(e=!0,n=!0){this._throwIfDestroyed();const r=this._getViewportsAsArray(),i=[],a=[];r.forEach(o=>{ld(o.type)?a.push(o):i.push(o)}),i.length&&this._resizeVTKViewports(i,n,e),a.length&&this._resizeUsingCustomResizeHandler(a,n,e)}getViewport(e){return this._viewports?.get(e)}getViewports(){return this._throwIfDestroyed(),this._getViewportsAsArray()}getStackViewport(e){this._throwIfDestroyed();const n=this.getViewport(e);if(!n)throw new Error(`Viewport with Id ${e} does not exist`);if(!(n instanceof Ms))throw new Error(`Viewport with Id ${e} is not a StackViewport.`);return n}getStackViewports(){return this._throwIfDestroyed(),this.getViewports().filter(n=>n instanceof Ms)}getVolumeViewports(){this._throwIfDestroyed();const e=this.getViewports(),n=r=>r instanceof Tu;return e.filter(n)}render(){const n=this.getViewports().map(r=>r.id);this._setViewportsToBeRenderedNextFrame(n)}renderViewports(e){this._setViewportsToBeRenderedNextFrame(e)}renderViewport(e){this._setViewportsToBeRenderedNextFrame([e])}destroy(){this.hasBeenDestroyed||(Vte.cleanup(),this.useCPURendering||(this._getViewportsAsArray().forEach(n=>{this.offscreenMultiRenderWindow&&this.offscreenMultiRenderWindow.removeRenderer(n.id)}),this.offscreenMultiRenderWindow&&this.offscreenMultiRenderWindow.delete(),delete this.offscreenMultiRenderWindow),this._reset(),Ww.delete(this.id),this.hasBeenDestroyed=!0)}fillCanvasWithBackgroundColor(e,n){const r=e.getContext("2d");let i;if(n){const a=n.map(o=>Math.floor(255*o));i=`rgb(${a[0]}, ${a[1]}, ${a[2]})`}else i="black";r.fillStyle=i,r.fillRect(0,0,e.width,e.height)}_normalizeViewportInputEntry(e){const{type:n,defaultOptions:r}=e;let i=r;return(!i||Object.keys(i).length===0)&&(i={background:[0,0,0],orientation:null,displayArea:null},n===Rr.ORTHOGRAPHIC&&(i={...i,orientation:Fg.AXIAL})),{...e,defaultOptions:i}}_normalizeViewportInputEntries(e){const n=[];return e.forEach(r=>{n.push(this._normalizeViewportInputEntry(r))}),n}_resizeUsingCustomResizeHandler(e,n=!0,r=!0){e.forEach(i=>{typeof i.resize=="function"&&i.resize()}),e.forEach(i=>{const a=i.getCamera();i.resetCamera(),n&&i.setCamera(a)}),r&&this.render()}_removeViewport(e){if(!this.getViewport(e)){console.warn(`viewport ${e} does not exist`);return}this._viewports.delete(e)}addCustomViewport(e){const{element:n,viewportId:r,type:i,defaultOptions:a}=e;n.tabIndex=-1;const o=xu(n),{clientWidth:s,clientHeight:c}=o;(o.width!==s||o.height!==c)&&(o.width=s,o.height=c);const l={id:r,renderingEngineId:this.id,element:n,type:i,canvas:o,sx:0,sy:0,sWidth:s,sHeight:c,defaultOptions:a||{}},u=T3e[i],f=new u(l);this._viewports.set(r,f);const d={element:n,viewportId:r,renderingEngineId:this.id};dt(pt,it.ELEMENT_ENABLED,d)}getRenderer(e){return this.offscreenMultiRenderWindow.getRenderer(e)}getOffscreenMultiRenderWindow(e){if(this.useCPURendering)throw new Error("Offscreen multi render window is not available when using CPU rendering.");return this.offscreenMultiRenderWindow}setCustomViewports(e){e.forEach(n=>{this.addCustomViewport(n)})}_getViewportsAsArray(){return Array.from(this._viewports.values())}_setViewportsToBeRenderedNextFrame(e){e.forEach(n=>{this._needsRender.add(n)}),this._render()}_render(){this._needsRender.size>0&&!this._animationFrameSet&&(this._animationFrameHandle=window.requestAnimationFrame(this._renderFlaggedViewports),this._animationFrameSet=!0)}_resetViewport(e){const n=this.id,{element:r,canvas:i,id:a}=e,o={element:r,viewportId:a,renderingEngineId:n};e.removeWidgets(),dt(pt,it.ELEMENT_DISABLED,o),r.removeAttribute("data-viewport-uid"),r.removeAttribute("data-rendering-engine-uid"),i.getContext("2d").clearRect(0,0,i.width,i.height)}_clearAnimationFrame(){window.cancelAnimationFrame(this._animationFrameHandle),this._needsRender.clear(),this._animationFrameSet=!1,this._animationFrameHandle=null}_reset(){this._getViewportsAsArray().forEach(n=>{this._resetViewport(n)}),this._clearAnimationFrame(),this._viewports=new Map}_throwIfDestroyed(){if(this.hasBeenDestroyed)throw new Error("this.destroy() has been manually called to free up memory, can not longer use this instance. Instead make a new one.")}}class O3e extends E3e{constructor(e){super(e),this._renderFlaggedViewports=()=>{this._throwIfDestroyed(),this.useCPURendering||this.performVtkDrawCall();const n=this._getViewportsAsArray(),r=[];for(let i=0;i<n.length;i++){const a=n[i];if(this._needsRender.has(a.id)){const o=this.renderViewportUsingCustomOrVtkPipeline(a);if(r.push(o),a.setRendered(),this._needsRender.delete(a.id),this._needsRender.size===0)break}}this._animationFrameSet=!1,this._animationFrameHandle=null,r.forEach(i=>{i?.element&&dt(i.element,it.IMAGE_RENDERED,i)})},this.useCPURendering||(this.offscreenMultiRenderWindow=Nbe.newInstance(),this.offScreenCanvasContainer=document.createElement("div"),this.offscreenMultiRenderWindow.setContainer(this.offScreenCanvasContainer))}enableVTKjsDrivenViewport(e){const r=this._getViewportsAsArray().filter(u=>ld(u.type)===!1),i=r.map(u=>u.canvas),a=xu(e.element);i.push(a);const{offScreenCanvasWidth:o,offScreenCanvasHeight:s}=this._resizeOffScreenCanvas(i),c=this._resize(r,o,s),l={...e,canvas:a};this.addVtkjsDrivenViewport(l,{offScreenCanvasWidth:o,offScreenCanvasHeight:s,xOffset:c})}addVtkjsDrivenViewport(e,n){const{element:r,canvas:i,viewportId:a,type:o,defaultOptions:s}=e;r.tabIndex=-1;const{offScreenCanvasWidth:c,offScreenCanvasHeight:l,xOffset:u}=n,{sxStartDisplayCoords:f,syStartDisplayCoords:d,sxEndDisplayCoords:h,syEndDisplayCoords:m,sx:p,sy:y,sWidth:x,sHeight:S}=this._getViewportCoordsOnOffScreenCanvas(e,c,l,u);this.offscreenMultiRenderWindow.addRenderer({viewport:[f,d,h,m],id:a,background:s.background?s.background:[0,0,0]});const C={id:a,element:r,renderingEngineId:this.id,type:o,canvas:i,sx:p,sy:y,sWidth:x,sHeight:S,defaultOptions:s||{}};let _;if(o===Rr.STACK)_=new Ms(C);else if(o===Rr.ORTHOGRAPHIC||o===Rr.PERSPECTIVE)_=new is(C);else if(o===Rr.VOLUME_3D)_=new $F(C);else throw new Error(`Viewport Type ${o} is not supported`);this._viewports.set(a,_);const T={element:r,viewportId:a,renderingEngineId:this.id};_.suppressEvents||dt(pt,it.ELEMENT_ENABLED,T)}setVtkjsDrivenViewports(e){if(e.length){const n=e.map(o=>xu(o.element));n.forEach(o=>{const s=window.devicePixelRatio||1,c=o.getBoundingClientRect();o.width=c.width*s,o.height=c.height*s});const{offScreenCanvasWidth:r,offScreenCanvasHeight:i}=this._resizeOffScreenCanvas(n);let a=0;for(let o=0;o<e.length;o++){const s=e[o],c=n[o],l={...s,canvas:c};this.addVtkjsDrivenViewport(l,{offScreenCanvasWidth:r,offScreenCanvasHeight:i,xOffset:a}),a+=c.width}}}_resizeVTKViewports(e,n=!0,r=!0){const i=e.map(a=>xu(a.element));if(i.forEach(a=>{const o=window.devicePixelRatio||1;a.width=a.clientWidth*o,a.height=a.clientHeight*o}),i.length){const{offScreenCanvasWidth:a,offScreenCanvasHeight:o}=this._resizeOffScreenCanvas(i);this._resize(e,a,o)}e.forEach(a=>{const o=a.getCamera(),s=a.getRotation(),{flipHorizontal:c}=o;a.resetCameraForResize();const l=a.getDisplayArea();n&&(l?(c&&a.setCamera({flipHorizontal:c}),s&&a.setViewPresentation({rotation:s})):a.setCamera(o))}),r&&this.render()}performVtkDrawCall(){const{offscreenMultiRenderWindow:e}=this,n=e.getRenderWindow(),r=e.getRenderers();if(r.length){for(let i=0;i<r.length;i++){const{renderer:a,id:o}=r[i];this._needsRender.has(o)?a.setDraw(!0):a.setDraw(!1)}n.render();for(let i=0;i<r.length;i++)r[i].renderer.setDraw(!1)}}renderViewportUsingCustomOrVtkPipeline(e){let n;if(e.sWidth<i6||e.sHeight<i6){console.warn("Viewport is too small",e.sWidth,e.sHeight);return}if(ld(e.type)===!0)n=e.customRenderViewportToCanvas();else{if(this.useCPURendering)throw new Error("GPU not available, and using a viewport with no custom render pipeline.");const{offscreenMultiRenderWindow:r}=this,o=r.getOpenGLRenderWindow().get3DContext().canvas;n=this._renderViewportFromVtkCanvasToOnscreenCanvas(e,o)}return n}_renderViewportFromVtkCanvasToOnscreenCanvas(e,n){const{element:r,canvas:i,sx:a,sy:o,sWidth:s,sHeight:c,id:l,renderingEngineId:u,suppressEvents:f}=e,{width:d,height:h}=i;return i.getContext("2d").drawImage(n,a,o,s,c,0,0,d,h),{element:r,suppressEvents:f,viewportId:l,renderingEngineId:u,viewportStatus:e.viewportStatus}}_resizeOffScreenCanvas(e){const{offScreenCanvasContainer:n,offscreenMultiRenderWindow:r}=this,i=Math.max(...e.map(o=>o.height));let a=0;return e.forEach(o=>{a+=o.width}),n.width=a,n.height=i,r.resize(),{offScreenCanvasWidth:a,offScreenCanvasHeight:i}}_resize(e,n,r){let i=0;for(let a=0;a<e.length;a++){const o=e[a],{sxStartDisplayCoords:s,syStartDisplayCoords:c,sxEndDisplayCoords:l,syEndDisplayCoords:u,sx:f,sy:d,sWidth:h,sHeight:m}=this._getViewportCoordsOnOffScreenCanvas(o,n,r,i);i+=o.canvas.width,o.sx=f,o.sy=d,o.sWidth=h,o.sHeight=m,this.offscreenMultiRenderWindow.getRenderer(o.id).setViewport(s,c,l,u)}return i}_getViewportCoordsOnOffScreenCanvas(e,n,r,i){const{canvas:a}=e,{width:o,height:s}=a,c=i,l=0,u=c/n,f=l+(r-s)/r,d=o/n,h=s/r;return{sxStartDisplayCoords:u,syStartDisplayCoords:f,sxEndDisplayCoords:u+d,syEndDisplayCoords:f+h,sx:c,sy:l,sWidth:o,sHeight:s}}}class dIt{constructor(e){this.contexts=[],this.offScreenCanvasContainers=[],this.viewportToContext=new Map,this.viewportSizes=new Map,this.contextMaxSizes=new Map;for(let n=0;n<e;n++){const r=Nbe.newInstance(),i=document.createElement("div");r.setContainer(i),this.contexts.push(r),this.offScreenCanvasContainers.push(i)}}getContextByIndex(e){return e>=0&&e<this.contexts.length?{context:this.contexts[e],container:this.offScreenCanvasContainers[e]}:null}assignViewportToContext(e,n){this.viewportToContext.set(e,n)}getContextIndexForViewport(e){return this.viewportToContext.get(e)}getAllContexts(){return this.contexts}getContextCount(){return this.contexts.length}updateViewportSize(e,n,r){const i=this.viewportToContext.get(e);if(i===void 0)return!1;this.viewportSizes.set(e,{width:n,height:r});const a=this.contextMaxSizes.get(i),o=this.calculateMaxSizeForContext(i);return this.contextMaxSizes.set(i,o),!a||a.width!==o.width||a.height!==o.height}getMaxSizeForContext(e){return this.contextMaxSizes.get(e)}calculateMaxSizeForContext(e){let n=0,r=0;return this.viewportToContext.forEach((i,a)=>{if(i===e){const o=this.viewportSizes.get(a);o&&(n=Math.max(n,o.width),r=Math.max(r,o.height))}}),{width:n,height:r}}removeViewport(e){const n=this.viewportToContext.get(e);if(this.viewportToContext.delete(e),this.viewportSizes.delete(e),n!==void 0){const r=this.calculateMaxSizeForContext(n);this.contextMaxSizes.set(n,r)}}destroy(){this.contexts.forEach(e=>{e.delete()}),this.contexts=[],this.offScreenCanvasContainers=[],this.viewportToContext.clear(),this.viewportSizes.clear(),this.contextMaxSizes.clear()}}class $te extends E3e{constructor(e){super(e),this._renderFlaggedViewports=()=>{this._throwIfDestroyed();const a=this._getViewportsAsArray().filter(s=>this._needsRender.has(s.id));if(a.length===0){this._animationFrameSet=!1,this._animationFrameHandle=null;return}const o=a.map(s=>{const c=this.renderViewportUsingCustomOrVtkPipeline(s);return s.setRendered(),this._needsRender.delete(s.id),c});this._animationFrameSet=!1,this._animationFrameHandle=null,o.forEach(s=>{s?.element&&dt(s.element,it.IMAGE_RENDERED,s)})};const{rendering:n}=mf(),{webGlContextCount:r}=n;this.useCPURendering||(this.contextPool=new dIt(r))}enableVTKjsDrivenViewport(e){const i=this._getViewportsAsArray().filter(s=>ld(s.type)===!1).map(s=>s.canvas),a=xu(e.element);i.push(a);const o={...e,canvas:a};this.addVtkjsDrivenViewport(o)}addVtkjsDrivenViewport(e){const{element:n,canvas:r,viewportId:i,type:a,defaultOptions:o}=e;n.tabIndex=-1;let s=0;if(a===Rr.STACK){const p=this.contextPool.getAllContexts();s=this._viewports.size%p.length}this.contextPool.assignViewportToContext(i,s),this.contextPool.updateViewportSize(i,r.width,r.height);const c=this.contextPool.getContextByIndex(s),{context:l,container:u}=c,f=this.contextPool.getMaxSizeForContext(s);u.width=f.width,u.height=f.height,l.resize(),l.addRenderer({viewport:[0,0,1,1],id:i,background:o.background?o.background:[0,0,0]});const d={id:i,element:n,renderingEngineId:this.id,type:a,canvas:r,sx:0,sy:0,sWidth:r.width,sHeight:r.height,defaultOptions:o||{}};let h;if(a===Rr.STACK)h=new Ms(d);else if(a===Rr.ORTHOGRAPHIC||a===Rr.PERSPECTIVE)h=new is(d);else if(a===Rr.VOLUME_3D)h=new $F(d);else throw new Error(`Viewport Type ${a} is not supported`);this._viewports.set(i,h);const m={element:n,viewportId:i,renderingEngineId:this.id};h.suppressEvents||dt(pt,it.ELEMENT_ENABLED,m)}setVtkjsDrivenViewports(e){if(e.length){const n=e.map(r=>xu(r.element));n.forEach(r=>{const i=window.devicePixelRatio||1,a=r.getBoundingClientRect();r.width=a.width*i,r.height=a.height*i});for(let r=0;r<e.length;r++){const i=e[r],a=n[r],o={...i,canvas:a};this.addVtkjsDrivenViewport(o)}}}_resizeVTKViewports(e,n=!0,r=!0){const i=e.map(a=>xu(a.element));i.forEach(a=>{const o=window.devicePixelRatio||1;a.width=a.clientWidth*o,a.height=a.clientHeight*o}),i.length&&this._resize(e),e.forEach(a=>{const o=a.getCamera(),s=a.getRotation(),{flipHorizontal:c}=o;a.resetCameraForResize();const l=a.getDisplayArea();n&&(l?(c&&a.setCamera({flipHorizontal:c}),s&&a.setViewPresentation({rotation:s})):a.setCamera(o))}),r&&this.render()}renderViewportUsingCustomOrVtkPipeline(e){if(ld(e.type))return e.customRenderViewportToCanvas();if(this.useCPURendering)throw new Error("GPU not available, and using a viewport with no custom render pipeline.");const n=this.contextPool.getContextIndexForViewport(e.id),r=this.contextPool.getContextByIndex(n),{context:i,container:a}=r;return this._renderViewportWithContext(e,i,a)}_renderViewportWithContext(e,n,r){if(e.sWidth<i6||e.sHeight<i6){console.warn("Viewport is too small",e.sWidth,e.sHeight);return}if(ld(e.type))return e.customRenderViewportToCanvas();if(this.useCPURendering)throw new Error("GPU not available, and using a viewport with no custom render pipeline.");n.getRenderer(e.id)||n.addRenderer({viewport:[0,0,1,1],id:e.id,background:e.defaultOptions?.background||[0,0,0]});const i=n.getRenderWindow(),a=i.getViews()[0],o=a.getRenderPasses(),s=this.getViewportRenderPasses(e.id);s&&a.setRenderPasses(s),this._resizeOffScreenCanvasForViewport(e,r,n);const c=n.getRenderer(e.id),l=this.contextPool.getContextIndexForViewport(e.id),u=this.contextPool.getMaxSizeForContext(l),f=e.canvas.width,d=e.canvas.height,h=Math.min(1,f/u.width),m=Math.min(1,d/u.height);c.setViewport(0,0,h,m);const p=n.getRenderers();p.forEach(({renderer:T,id:O})=>{T.setDraw(O===e.id)});const y=this.getWidgetRenderers();y.forEach((T,O)=>{O.setDraw(T===e.id)}),i.render(),p.forEach(({renderer:T})=>T.setDraw(!1)),y.forEach((T,O)=>{O.setDraw(!1)}),o&&a.setRenderPasses(o);const C=n.getOpenGLRenderWindow().get3DContext().canvas;return this._copyToOnscreenCanvas(e,C)}_renderViewportFromVtkCanvasToOnscreenCanvas(e,n){return this._copyToOnscreenCanvas(e,n)}_resizeOffScreenCanvasForViewport(e,n,r){const i=this.contextPool.getContextIndexForViewport(e.id);if(i===void 0||!this.contextPool.updateViewportSize(e.id,e.canvas.width,e.canvas.height))return;const o=this.contextPool.getMaxSizeForContext(i);n.width===o.width&&n.height===o.height||(n.width=o.width,n.height=o.height,r.resize())}_copyToOnscreenCanvas(e,n){const{element:r,canvas:i,id:a,renderingEngineId:o,suppressEvents:s}=e,{width:c,height:l}=i,u=i.getContext("2d"),f=this.contextPool.getContextIndexForViewport(a),h=this.contextPool.getMaxSizeForContext(f).height-l;return u.drawImage(n,0,h,c,l,0,0,c,l),{element:r,suppressEvents:s,viewportId:a,renderingEngineId:o,viewportStatus:e.viewportStatus}}_resize(e){const n=new Set;for(const r of e){r.sx=0,r.sy=0,r.sWidth=r.canvas.width,r.sHeight=r.canvas.height;const i=this.contextPool.getContextIndexForViewport(r.id);this.contextPool.updateViewportSize(r.id,r.canvas.width,r.canvas.height)&&n.add(i);const o=this.contextPool.getContextByIndex(i),{context:s}=o,c=s.getRenderer(r.id),l=this.contextPool.getMaxSizeForContext(i),u=Math.min(1,r.canvas.width/l.width),f=Math.min(1,r.canvas.height/l.height);c.setViewport(0,0,u,f)}n.forEach(r=>{const i=this.contextPool.getContextByIndex(r);if(i){const{context:a,container:o}=i,s=this.contextPool.getMaxSizeForContext(r);o.width=s.width,o.height=s.height,a.resize()}})}getWidgetRenderers(){const e=this._getViewportsAsArray(),n=new Map;return e.forEach(r=>{(r.getWidgets?r.getWidgets():[]).forEach(a=>{const o=a.getRenderer?a.getRenderer():null;o&&n.set(o,r.id)})}),n}getViewportRenderPasses(e){const n=this.getViewport(e);return n?.getRenderPasses?n.getRenderPasses():null}getRenderer(e){const n=this.contextPool?.getContextIndexForViewport(e),r=this.contextPool.getContextByIndex(n),{context:i}=r;return i.getRenderer(e)}disableElement(e){const n=this.getViewport(e);if(n&&(super.disableElement(e),!ld(n.type)&&!this.useCPURendering)){const r=this.contextPool.getContextIndexForViewport(e);if(r!==void 0){const i=this.contextPool.getContextByIndex(r);if(i){const{context:a}=i;a.removeRenderer(e)}}this.contextPool.removeViewport(e)}}destroy(){this.contextPool&&this.contextPool.destroy(),super.destroy()}getOffscreenMultiRenderWindow(e){if(this.useCPURendering)throw new Error("Offscreen multi render window is not available when using CPU rendering.");const n=this.contextPool.getContextIndexForViewport(e);return this.contextPool.getContextByIndex(n).context}}class hIt{constructor(e){const r=mf()?.rendering?.renderingEngineMode;switch(r){case o1.Tiled:this._implementation=new O3e(e);break;case o1.ContextPool:this._implementation=new $te(e);break;default:console.warn(`RenderingEngine: Unknown rendering engine mode "${r}". Defaulting to Next rendering engine.`),this._implementation=new $te(e);break}}get id(){return this._implementation.id}enableElement(e){return this._implementation.enableElement(e)}disableElement(e){return this._implementation.disableElement(e)}setViewports(e){return this._implementation.setViewports(e)}resize(e=!0,n=!0){return this._implementation.resize(e,n)}getViewport(e){return this._implementation.getViewport(e)}getViewports(){return this._implementation.getViewports()}getStackViewport(e){return this._implementation.getStackViewport(e)}getStackViewports(){return this._implementation.getStackViewports()}getVolumeViewports(){return this._implementation.getVolumeViewports()}getRenderer(e){return this._implementation.getRenderer(e)}fillCanvasWithBackgroundColor(e,n){return this._implementation.fillCanvasWithBackgroundColor(e,n)}render(){return this._implementation.render()}renderViewports(e){return this._implementation.renderViewports(e)}renderViewport(e){return this._implementation.renderViewport(e)}destroy(){return this._implementation.destroy()}getOffscreenMultiRenderWindow(e){return this._implementation.getOffscreenMultiRenderWindow(e)}}var Ku;(function(t){t[t.None=0]="None",t[t.Capture=1]="Capture",t[t.Bubble=2]="Bubble"})(Ku||(Ku={}));class s9{constructor(e){this._eventListeners=new Map,this._children=new Map,this._target=e}get isEmpty(){return this._eventListeners.size===0&&this._children.size===0}addEventListener(e,n,r){const i=e.indexOf(".");if(i!==-1){const o=e.substring(0,i);let s=this._children.get(o);s||(s=new s9(this._target),this._children.set(o,s)),e=e.substring(i+1),s.addEventListener(e,n,r)}else this._addEventListener(e,n,r)}removeEventListener(e,n,r){const i=e.indexOf(".");if(i!==-1){const o=e.substring(0,i),s=this._children.get(o);if(!s)return;e=e.substring(i+1),s.removeEventListener(e,n,r),s.isEmpty&&this._children.delete(o)}else this._removeEventListener(e,n,r)}reset(){Array.from(this._children.entries()).forEach(([e,n])=>{if(n.reset(),n.isEmpty)this._children.delete(e);else throw new Error("Child is not empty and cannot be removed")}),this._unregisterAllEvents()}_addEventListener(e,n,r){let i=this._eventListeners.get(e);i||(i=new Map,this._eventListeners.set(e,i));const o=r?.capture??!1?Ku.Capture:Ku.Bubble,s=i.get(n)??Ku.None;if(s&o){console.warn("A listener is already registered for this phase");return}i.set(n,s|o),this._target.addEventListener(e,n,r)}_removeEventListener(e,n,r){const a=r?.capture??!1?Ku.Capture:Ku.Bubble,o=this._eventListeners.get(e);if(!o)return;(n?[n]:Array.from(o.keys())).forEach(c=>{const l=o.get(c)??Ku.None;if(!!!(l&a))return;this._target.removeEventListener(e,c,r);const f=l^a;f===Ku.None?o.delete(c):o.set(c,f)}),o.size||this._eventListeners.delete(e)}_unregisterAllListeners(e,n){Array.from(n.entries()).forEach(([r,i])=>{const a=Ku.Capture;for(let o=a;i;o<<=1){if(!(i&o))continue;const s=o===Ku.Capture;this.removeEventListener(e,r,{capture:s}),i^=o}})}_unregisterAllEvents(){Array.from(this._eventListeners.entries()).forEach(([e,n])=>{this._unregisterAllListeners(e,n)})}}class gIt{constructor(){this._targetsEventListeners=new Map}addEventListener(e,n,r,i){let a=this._targetsEventListeners.get(e);a||(a=new s9(e),this._targetsEventListeners.set(e,a)),a.addEventListener(n,r,i)}removeEventListener(e,n,r,i){const a=this._targetsEventListeners.get(e);a&&(a.removeEventListener(n,r,i),a.isEmpty&&this._targetsEventListeners.delete(e))}reset(){Array.from(this._targetsEventListeners.entries()).forEach(([e,n])=>{n.reset(),this._targetsEventListeners.delete(e)})}}const pIt=Object.freeze(Object.defineProperty({__proto__:null,MultiTargetEventListenerManager:gIt,TargetEventListeners:s9},Symbol.toStringTag,{value:"Module"}));function mIt(t,e){const n=t.getSize();for(let r=0;r<n;r++){const i=[];t.getNodeValue(r,i),i[1]=i[1]*e,i[2]=i[2]*e,i[3]=i[3]*e,t.setNodeValue(r,i)}}function vIt(t){let e=t[0],n=t[0],r;const i=t.length;for(let a=1;a<i;a++)r=t[a],e=Math.min(e,r),n=Math.max(n,r);return{min:e,max:n}}const yIt=Symbol("LastRuntimeId"),xIt={},wIt=4294967295,bIt="-";function D3e(t,e,n){return SIt(t!==null&&typeof t=="object"?t:xIt,yIt,(typeof n=="number"&&n>0?n:wIt)>>>0).join(typeof e=="string"?e:bIt)}function SIt(t,e,n){let r=t[e];r instanceof Array||(r=[0],Object.defineProperty(t,e,{value:r}));for(let i=!0,a=0;i&&a<r.length;++a){let o=r[a]|0;o<n?(i=!1,o=o+1):(o=0,a+1===r.length&&r.push(0)),r[a]=o}return r}const jte={},CIt={add:(t,e)=>{const n=ma(t);jte[n]=e},get:(t,e)=>{if(t==="calibratedPixelSpacing"){const n=ma(e);return jte[n]}}};function _It(t,e,n=1e-5){return Math.abs(t[0]+e[0])<n&&Math.abs(t[1]+e[1])<n&&Math.abs(t[2]+e[2])<n}function wh(t,e){return!(t[0]<0||t[0]>=e[0]||t[1]<0||t[1]>=e[1]||t[2]<0||t[2]>=e[2])}function TIt(t,e){let n;e?n=[O1(e)]:n=Ld();const r=[];return n.forEach(i=>{const a=t.getActors(),o=i.getVolumeViewports();for(const s of o){const c=s.getActors();if(c.length!==a.length)continue;a.every(({uid:u})=>c.find(f=>u===f.uid))&&r.push(s)}}),r}const M3e=t=>t.preScale.scaled&&t.preScale.scalingParameters.suvbw;function R3e(t,e,n=void 0,r="_thumbnails",i={displayArea:{imageArea:[1,1]}}){if(!t||!(t instanceof HTMLCanvasElement))throw new Error("canvas element is required");const a=!e.imageId,o=!a&&e,s=a&&e,l=`renderGPUViewport-${o.imageId||s.volumeId}`,u=document.createElement("div"),f=window.devicePixelRatio||1;i.displayArea||(i.displayArea={imageArea:[1,1]});const d=t.width,h=t.height;u.style.width=`${d/f+Rte}px`,u.style.height=`${h/f+Rte}px`,u.style.visibility="hidden",u.style.position="absolute",document.body.appendChild(u);const m=l.split(":").join("-");u.setAttribute("viewport-id-for-remove",m);const p=xu(u),y=O1(r)||new O3e(r);let x=y.getViewport(l);if(!x){const S={viewportId:l,type:a?Rr.ORTHOGRAPHIC:Rr.STACK,element:u,defaultOptions:{...i,suppressEvents:!0}};y.enableElement(S),x=y.getViewport(l)}return new Promise(S=>{let C=!1,{viewReference:_}=i;const T=O=>{if(C)return;if(_){const G=_;_=null,x.setViewReference(G),x.render();return}t.getContext("2d").drawImage(p,0,0,p.width,p.height,0,0,t.width,t.height);const I=x.canvasToWorld([0,0]),V=x.canvasToWorld([p.width/f,0]),k=x.canvasToWorld([0,p.height/f]),L=yr([0,0,0],x.canvasToWorld([1/f,0]),I),$=yr([0,0,0],x.canvasToWorld([0,1/f]),I),W=1;C=!0,u.removeEventListener(it.IMAGE_RENDERED,T),setTimeout(()=>{y.disableElement(l),document.querySelectorAll(`[viewport-id-for-remove="${m}"]`).forEach(oe=>{oe.remove()})},0),S({origin:I,bottomLeft:k,topRight:V,thicknessMm:W,rightVector:L,downVector:$})};u.addEventListener(it.IMAGE_RENDERED,T),a?x.setVolumes([s],!1,!0):x.renderImageObject(e),x.resetCamera(),n==="PT"&&!M3e(o)&&x.setProperties({voiRange:{lower:o.minPixelValue,upper:o.maxPixelValue}}),x.render()})}function I3e(t,e,n,r,i){if(e.volumeId)throw new Error("Unsupported volume rendering for CPU");const o=e,s=_3e(t,o,n),c={canvas:t,viewport:s,image:o,renderingTools:{}};c.transform=Xw(c);const l=!0;return new Promise((u,f)=>{b3e(c,l),u(null)})}function EIt(t){const{canvas:e,imageId:n,viewReference:r,requestType:i=In.Thumbnail,priority:a=-5,renderingEngineId:o="_thumbnails",useCPURendering:s=!1,thumbnail:c=!1,imageAspect:l=!1,viewportOptions:u}=t,f=r?.volumeId,d=f&&!n,h=r&&u?{...u,viewReference:r}:u,m=s?I3e:R3e;return new Promise((p,y)=>{function x(T,O){const{modality:M}=Ot("generalSeriesModule",O)||{},I=!d&&T,V=d&&T;I&&(I.isPreScaled=I.isPreScaled||I.preScale?.scaled),c&&(e.height=256,e.width=256),l&&I&&(e.width=I&&e.height*I.width/I.height),e.style.width=`${e.width/devicePixelRatio}px`,e.style.height=`${e.height/devicePixelRatio}px`,V&&s&&y(new Error("CPU rendering of volume not supported")),m(e,T,M,o,h).then(p)}function S(T,O){console.error(T,O),y(T)}function C(T,O,M){return d1(T,M).then(I=>{x.call(this,I,T)},I=>{S.call(this,I,T)})}const _={useRGBA:!!s,requestType:i};if(f){const T=Ct.getVolume(f);T||y(new Error(`Volume id ${f} not found in cache`));const O=T.imageIds[0];x(T,O)}else Dd.addRequest(C.bind(null,n,null,_),i,{imageId:n},a)})}function Ek(t){return Array.isArray(t)?t:[t]}const Ute={HISTORY_UNDO:"CORNERSTONE_TOOLS_HISTORY_UNDO",HISTORY_REDO:"CORNERSTONE_TOOLS_HISTORY_REDO"};class N3e{constructor(e="Tools",n=50){this.position=-1,this.redoAvailable=0,this.undoAvailable=0,this.ring=new Array,this.isRecordingGrouped=!1,this.label=e,this._size=n}get size(){return this._size}set size(e){this.ring=new Array(e),this._size=e,this.position=-1,this.redoAvailable=0,this.undoAvailable=0}get canUndo(){return this.undoAvailable>0}get canRedo(){return this.redoAvailable>0}undo(e=1){for(;e>0&&this.undoAvailable>0;){const n=this.ring[this.position];for(const r of Ek(n).reverse())r.restoreMemo(!0),this.dispatchHistoryEvent({item:r,isUndo:!0});e--,this.redoAvailable++,this.undoAvailable--,this.position=(this.position-1+this.size)%this.size}}undoIf(e){return this.undoAvailable>0&&e(this.ring[this.position])?(this.undo(),!0):!1}dispatchHistoryEvent({item:e,isUndo:n}){e.id&&pt.dispatchEvent(new CustomEvent(n?Ute.HISTORY_UNDO:Ute.HISTORY_REDO,{detail:{isUndo:n,id:e.id,operationType:e.operationType||"annotation",memo:e}}))}redo(e=1){for(;e>0&&this.redoAvailable>0;){const n=(this.position+1)%this.size,r=this.ring[n];for(const i of Ek(r).reverse())i.restoreMemo(!1),this.dispatchHistoryEvent({item:i,isUndo:!1});e--,this.position=n,this.undoAvailable++,this.redoAvailable--}}initializeGroupItem(){this.redoAvailable=0,this.undoAvailable<this._size&&this.undoAvailable++,this.position=(this.position+1)%this._size,this.ring[this.position]=[]}startGroupRecording(){this.isRecordingGrouped=!0,this.initializeGroupItem()}rollbackUnusedGroupItem(){this.ring[this.position]=void 0,this.position=(this.position-1)%this._size,this.undoAvailable--}endGroupRecording(){this.isRecordingGrouped=!1;const e=this.ring[this.position];Array.isArray(e)&&e.length===0&&this.rollbackUnusedGroupItem()}pushGrouped(e){const n=this.ring[this.position];if(Array.isArray(n))return n.push(e),e;throw new Error("Last item should be an array for grouped memos.")}push(e){if(!e)return;const n=e.restoreMemo?e:e.createMemo?.();if(n)return this.isRecordingGrouped?this.pushGrouped(n):(this.redoAvailable=0,this.undoAvailable<this._size&&this.undoAvailable++,this.position=(this.position+1)%this._size,this.ring[this.position]=n,n)}}const OIt=new N3e,jF=Object.freeze(Object.defineProperty({__proto__:null,DefaultHistoryMemo:OIt,HistoryMemo:N3e},Symbol.toStringTag,{value:"Module"}));function DIt(t,e){const n=Ot("imagePlaneModule",t);if(!n)throw new Error(`No imagePlaneModule found for imageId: ${t}`);const{columnCosines:r,rowCosines:i,imagePositionPatient:a}=n;let{columnPixelSpacing:o,rowPixelSpacing:s}=n;o||=1,s||=1;const c=ut();Ro(c,a,r,-o/2),Ro(c,c,i,-s/2);const l=ut();yr(l,e,c);const u=Vt(l,i),f=Vt(l,r);return[u/s,f/o]}function MIt(t,e){const n=Ot("imagePlaneModule",t);if(!n)throw new Error(`No imagePlaneModule found for imageId: ${t}`);const{columnCosines:r,rowCosines:i,imagePositionPatient:a}=n;let{columnPixelSpacing:o,rowPixelSpacing:s}=n;o||=1,s||=1;const c=ut();return Ro(c,a,i,s*(e[0]-.5)),Ro(c,c,r,o*(e[1]-.5)),Array.from(c)}function a6(t){const e=Ld(),n=[];return e.forEach(r=>{r.getViewports().forEach(a=>{a.hasImageURI(t)&&n.push(a)})}),n}function P3e(t,e){const n=RIt(t,e);return n?n.index:null}function RIt(t,e){const n=e.getImageIds(),r=e.getCurrentImageIdIndex();if(n.length===0)return null;const i=c=>{const l=IIt(c);if(!l)return null;const u=Jbe(l.planeNormal,l.imagePositionPatient);return RF(u,t)},a={distance:i(n[r])??1/0,index:r},o=n.slice(r+1);for(let c=0;c<o.length;c++){const l=o[c],u=i(l);if(u!==null)if(u<=a.distance)a.distance=u,a.index=c+r+1;else break}const s=n.slice(0,r);for(let c=s.length-1;c>=0;c--){const l=s[c],u=i(l);if(!(u===null||u===a.distance))if(u<a.distance)a.distance=u,a.index=c;else break}return a.distance===1/0?null:a}function IIt(t){const e=Ot("imagePlaneModule",t);if(!e||!(e.rowCosines instanceof Array&&e.rowCosines.length===3)||!(e.columnCosines instanceof Array&&e.columnCosines.length===3)||!(e.imagePositionPatient instanceof Array&&e.imagePositionPatient.length===3))return null;const{rowCosines:n,columnCosines:r,imagePositionPatient:i}=e,a=_r(ut(),...n),o=_r(ut(),...r),s=Tr(ut(),a,o);return{rowCosines:n,columnCosines:r,imagePositionPatient:i,planeNormal:s}}function NIt(t){const{width:e,height:n}=t.getCanvas(),{sliceToIndexMatrix:r,indexToSliceMatrix:i}=t.getSliceViewInfo(),a=Tg(t,[0,0]),o=Tg(t,[e-1,0]),s=Tg(t,[0,n-1]),c=yr(ut(),o,a),l=yr(ut(),s,a),u=Tr(ut(),c,l);Vr(c,c),Vr(l,l),Vr(u,u);const f=Math.max(Math.abs(c[0]),Math.abs(c[1]),Math.abs(c[2])),d=Math.max(Math.abs(l[0]),Math.abs(l[1]),Math.abs(l[2]));if(!jT(1,f)||!jT(1,d))throw new Error("Livewire is not available for rotate/oblique viewports");const{voxelManager:h}=t.getImageData(),m=t.getSliceViewInfo(),p=h.getSliceData(m);return{width:m.width,height:m.height,scalarData:p,sliceToIndexMatrix:r,indexToSliceMatrix:i}}const Yp={},o6={add:(t,e)=>{const[n,r]=t,i=`${n}_${r}`;Yp[i]||(Yp[i]={}),Yp[i]=e},get:(t,e,n)=>{if(t!=="spatialRegistrationModule")return;const r=`${e}_${n}`;if(Yp[r])return Yp[r];const i=`${n}_${e}`;if(Yp[i])return Na(Td(),Yp[i])}};L2(o6.get.bind(o6));const PIt=.05;function kIt(t,e){const n=t.getSliceIndex(),r=e.getSliceIndex(),i=Ot("imagePlaneModule",n.toString()),a=Ot("imagePlaneModule",r.toString());if(!i||!a){console.log("Viewport spatial registration requires image plane module");return}const{imageOrientationPatient:o}=a;if(!i.imageOrientationPatient.every((d,h)=>Math.abs(d-o[h])<PIt)){console.log("Viewport spatial registration only supported for same orientation (hence translation only) for now",i?.imageOrientationPatient,a?.imageOrientationPatient);return}const c=i.imagePositionPatient,l=a.imagePositionPatient,u=Xi(ut(),c,l),f=p3(Td(),u);o6.add([t.id,e.id],f)}function AIt(t){const{imageData:e,dimensions:n}=t.getImageData()||{};if(!e||!n)return[];const{canvas:r}=t,i=window.devicePixelRatio,a=[0,0],o=[r.width/i,0],s=[r.width/i,r.height/i],c=[0,r.height/i],l=t.canvasToWorld(a),u=t.canvasToWorld(o),f=t.canvasToWorld(s),d=t.canvasToWorld(c),h=e.worldToIndex(l),m=e.worldToIndex(u),p=e.worldToIndex(f),y=e.worldToIndex(d);return LIt({dimensions:n,imageData:e,topLeftImage:h,topRightImage:m,bottomRightImage:p,bottomLeftImage:y,topLeftWorld:l,topRightWorld:u,bottomRightWorld:f,bottomLeftWorld:d})}function LIt({dimensions:t,imageData:e,topLeftImage:n,topRightImage:r,bottomRightImage:i,bottomLeftImage:a,topLeftWorld:o,topRightWorld:s,bottomRightWorld:c,bottomLeftWorld:l}){const u=FS(n,t)?o:e.indexToWorld([0,0,0]),f=FS(r,t)?s:e.indexToWorld([t[0]-1,0,0]),d=FS(i,t)?c:e.indexToWorld([t[0]-1,t[1]-1,0]),h=FS(a,t)?l:e.indexToWorld([0,t[1]-1,0]);return[u,f,h,d]}function FS(t,e){return t[0]>0||t[0]<e[0]-1||t[1]>0||t[1]<e[1]-1||t[2]>0||t[2]<e[2]-1}function yt(t){if(!t)return;const{viewportUid:e,renderingEngineUid:n}=t.dataset;return C3(e,n)}function C3(t,e){if(!e||!t)return;const n=O1(e);if(!n||n.hasBeenDestroyed)return;const r=n.getViewport(t);if(!r)return;const i=r.getFrameOfReferenceUID();return{viewport:r,renderingEngine:n,viewportId:t,renderingEngineId:e,FrameOfReferenceUID:i}}function Ai(t){const e=Ld();for(let n=0;n<e.length;n++){const r=e[n];if(r.getViewport(t))return C3(t,r.id)}}function VIt(){const t=[];return Ld().forEach(n=>{n.getViewports().forEach(({element:i})=>{t.push(yt(i))})}),t}function $It(t){const e=yt(t);if(!e)return;const{viewport:n}=e;if(!(n instanceof Ms))throw new Error(`An image can only be fetched for a stack viewport and not for a viewport of type: ${n.type}`);return n.getCornerstoneImage()}function jIt(t){if(t.length<=1)return!1;const e=t[0],{modality:n,seriesInstanceUID:r}=Ot("generalSeriesModule",e),{imageOrientationPatient:i,pixelSpacing:a,frameOfReferenceUID:o,columns:s,rows:c,usingDefaultValues:l}=Ot("imagePlaneModule",e);if(l)return!1;const u={modality:n,imageOrientationPatient:i,pixelSpacing:a,columns:s,rows:c,seriesInstanceUID:r};let f=!0;for(let d=0;d<t.length;d++){const h=t[d],{modality:m,seriesInstanceUID:p}=Ot("generalSeriesModule",h),{imageOrientationPatient:y,pixelSpacing:x,columns:S,rows:C}=Ot("imagePlaneModule",h);if(p!==u.seriesInstanceUID){f=!1;break}if(m!==u.modality){f=!1;break}if(S!==u.columns){f=!1;break}if(C!==u.rows){f=!1;break}if(!Lr(y,u.imageOrientationPatient)){f=!1;break}if(!Lr(x,u.pixelSpacing)){f=!1;break}}return f}const UIt=new Set(["1.2.840.10008.1.2.4.100","1.2.840.10008.1.2.4.100.1","1.2.840.10008.1.2.4.101","1.2.840.10008.1.2.4.101.1","1.2.840.10008.1.2.4.102","1.2.840.10008.1.2.4.102.1","1.2.840.10008.1.2.4.103","1.2.840.10008.1.2.4.103.1","1.2.840.10008.1.2.4.104","1.2.840.10008.1.2.4.104.1","1.2.840.10008.1.2.4.105","1.2.840.10008.1.2.4.105.1","1.2.840.10008.1.2.4.106","1.2.840.10008.1.2.4.106.1","1.2.840.10008.1.2.4.107","1.2.840.10008.1.2.4.108"]);function k3e(t){return t?(Array.isArray(t)?t:[t]).find(n=>UIt.has(n)):!1}async function FIt({viewport:t,options:e={}}){const n=t.getRenderingEngine();let r=e.volumeId||`${ya()}`;r.split(":").length===0&&(r=`${nMt()}:${r}`);const{id:i,element:a}=t,o=e.viewportId||i,s=t.getImageIds(),c=t.getViewPresentation(),l=t.getViewReference();n.enableElement({viewportId:o,type:Rr.ORTHOGRAPHIC,element:a,defaultOptions:{background:e.background,orientation:e.orientation}}),(await Xbe(r,{imageIds:s})).load();const f=n.getViewport(o);await rIt(n,[{volumeId:r}],[o]);const d=()=>{f.render(),a.removeEventListener(it.VOLUME_VIEWPORT_NEW_VOLUME,d)};return(()=>{a.addEventListener(it.VOLUME_VIEWPORT_NEW_VOLUME,d)})(),f.setViewPresentation(c),f.setViewReference(l),f.render(),f}async function BIt({viewport:t,options:e}){const n=t,{id:r,element:i}=n,a=t.getRenderingEngine(),{background:o}=e,s=e.viewportId||r,c=Ct.getVolume(n.getVolumeId());if(!(c instanceof JE))throw new Error("Currently, you cannot decache a volume that is not an ImageVolume. So, unfortunately, volumes such as nifti  (which are basic Volume, without imageIds) cannot be decached.");const l={viewportId:s,type:Rr.STACK,element:i,defaultOptions:{background:o}},u=n.getViewReference();a.enableElement(l);const f=a.getViewport(s);return await f.setStack(c.imageIds),f.setViewReference(u),f.render(),f}function Qi(t,e=2){if(Array.isArray(t))return t.map(i=>Qi(i,e)).join(", ");if(t==null||t==="")return"NaN";t=Number(t);const n=Math.abs(t);if(n<1e-4)return`${t}`;const r=n>=100?e-2:n>=10?e-1:n>=1?e:n>=.1?e+1:n>=.01?e+2:n>=.001?e+3:e+4;return t.toFixed(r)}function zIt(t){return Math.round(t/_u)*_u}function GIt(t,e,n){const r=t.length===e*n*4,i=t.length===e*n*3;if(r||i){const a=new Float32Array(e*n);let o=0,s=0;const c=r?4:3;for(let l=0;l<e;l++)for(let u=0;u<n;u++){const f=t[o],d=t[o+1],h=t[o+2];a[s]=(f+d+h)/3,o+=c,s++}return a}else return t}function WIt(t){if(t instanceof is)return Ct.getVolume(t.getVolumeId()).imageIds;if(t.getImageIds)return t.getImageIds()}function UF(t,e){const n=[...t];return e>=n.length?(Fte(n),n):(Fte(n),n.slice(0,e))}function Fte(t){for(let e=t.length-1;e>0;e--){const n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}}function YR(t){const e=t.toString(16);return e.length==1?"0"+e:e}function HIt(t,e,n){return"#"+YR(t)+YR(e)+YR(n)}function qIt(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}const KIt=Object.freeze(Object.defineProperty({__proto__:null,hexToRgb:qIt,rgbToHex:HIt},Symbol.toStringTag,{value:"Module"}));function A3e(t,e){if(t===e)return!0;if(t==null||e==null)return!1;try{return JSON.stringify(t)===JSON.stringify(e)}catch(n){return console.debug("Error in JSON.stringify during deep comparison:",n),t===e}}function YIt(t,e,n){if(!n)throw new Error("getVolume is required, use the utilities export instead ");if(t.modality)return t.modality;if(t.setVolumes)return e=e??t.getVolumeId(),!e||!n?void 0:n(e).metadata.Modality;throw new Error("Invalid viewport type")}const XIt=(t,e)=>t.reduce((n,r)=>((n[r[e]]=n[r[e]]||[]).push(r),n),{});function ZIt(t){const e=t.map(o=>{const{imagePositionPatient:s}=Ot("imagePlaneModule",o)||{};return{imageId:o,imagePositionPatient:s}});if(!e.every(o=>o.imagePositionPatient))return null;const n=XIt(e,"imagePositionPatient"),r=Object.keys(n),i=n[r[0]].length;return i===1||!r.every(o=>n[o].length===i)?null:n}function QIt(t,e){const n={};let r=[];const i=Object.keys(t);for(let a=0;a<i.length;a++){const o=new Set,s=t[i[a]];for(let c=0;c<s.length;c++){const l=e(s[c].imageId)||0;if(n[l]=n[l]||[],n[l].push({imageId:s[c].imageId}),o.add(l),o.size-1<c)return}if(a==0)r=Array.from(o);else if(!nNt(r,o))return}return n}function s5(t,e){const n=Ot(e,t);try{return parseFloat(n)}catch{return}}function JIt(t){const e=Ot("20011003",t);try{const{InlineBinary:n}=e;if(n){const r=atob(n),i=new ArrayBuffer(r.length),a=new DataView(i);for(let o=0;o<r.length;o++)a.setUint8(o,r.charCodeAt(o));return new Float32Array(i)[0]}return parseFloat(e)}catch{return}}function eNt(t){let e=Ot("0019100c",t)||Ot("0019100C",t);try{const{InlineBinary:n}=e;return n&&(e=atob(n)),parseFloat(e)}catch{return}}function tNt(t){let e=Ot("00431039",t);try{const{InlineBinary:n}=e;return n&&(e=atob(n).split("//")),parseFloat(e[0])%1e5}catch{return}}function nNt(t,e){if(t.length!=e.size)return!1;for(let n=0;n<t.length;n++)if(!e.has(t[n]))return!1;return!0}function rNt(t){const e=Ot("petImageModule",t);return e?e.frameReferenceTime:0}function L3e(t){const e=ZIt(t);if(!e)return{imageIdGroups:[t],splittingTag:null};const n=["TemporalPositionIdentifier","DiffusionBValue","TriggerTime","EchoTime","EchoNumber","PhilipsPrivateBValue","SiemensPrivateBValue","GEPrivateBValue","PetFrameReferenceTime"],r=[i=>s5(i,n[0]),i=>s5(i,n[1]),i=>s5(i,n[2]),i=>s5(i,n[3]),i=>s5(i,n[4]),JIt,eNt,tNt,rNt];for(let i=0;i<r.length;i++){const a=QIt(e,r[i]);if(a)return{imageIdGroups:Object.keys(a).map(Number.parseFloat).sort((c,l)=>c-l).map(c=>a[c].map(l=>l.imageId)),splittingTag:n[i]}}return{imageIdGroups:[t],splittingTag:null}}function iNt(t){const{imageIdGroups:e,splittingTag:n}=L3e(t);return{isDynamicVolume:e.length>1,timePoints:e,splittingTag:n}}function aNt(t,e){const n=t.length,{rescaleSlope:r,rescaleIntercept:i,suvbw:a}=e;if(e.modality==="PT"&&typeof a=="number")for(let o=0;o<n;o++)t[o]=a*(t[o]*r+i);else for(let o=0;o<n;o++)t[o]=t[o]*r+i;return t}function V3e(t,e,n){return Math.min(Math.max(e,t),n)}function $3e(t,e){if(!yt(t.element))throw new Error("Scroll::Viewport is not enabled (it might be disabled)");if(t instanceof Ms&&t.getImageIds().length===0)throw new Error("Scroll::Stack Viewport has no images");const{volumeId:r,delta:i,scrollSlabs:a}=e;if(t instanceof is)oNt(t,r,i,a);else{const o=t.getCurrentImageIdIndex();if(o+i>t.getImageIds().length-1||o+i<0){const s={imageIdIndex:o,direction:i};dt(pt,it.STACK_SCROLL_OUT_OF_BOUNDS,s)}t.scroll(i,e.debounceLoading,e.loop)}}function oNt(t,e,n,r=!1){const i=r,{numScrollSteps:a,currentStepIndex:o,sliceRangeInfo:s}=py(t,e,i);if(!s)return;const{sliceRange:c,spacingInNormalDirection:l,camera:u}=s,{focalPoint:f,viewPlaneNormal:d,position:h}=u,{newFocalPoint:m,newPosition:p}=my(f,h,c,d,l,n);t.setCamera({focalPoint:m,position:p}),t.render();const y=o+n,x={volumeId:e,viewport:t,delta:n,desiredStepIndex:y,currentStepIndex:o,numScrollSteps:a,currentImageId:t.getCurrentImageId()};(y>a||y<0)&&t.getCurrentImageId()?dt(pt,it.VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS,x):dt(pt,it.VOLUME_VIEWPORT_SCROLL,x)}async function sNt(t,e={}){const{imageIndex:n,debounceLoading:r,volumeId:i}=e,a=yt(t);if(!a)throw new Error("Element has been disabled");const{viewport:o}=a,{imageIndex:s,numberOfSlices:c}=cNt(o,r),u=lNt(c,n)-s;$3e(o,{delta:u,debounceLoading:r,volumeId:i})}function cNt(t,e){return t instanceof Ms?{numberOfSlices:t.getImageIds().length,imageIndex:e?t.getTargetImageIdIndex():t.getCurrentImageIdIndex()}:{numberOfSlices:t.getNumberOfSlices(),imageIndex:t.getSliceIndex()}}function lNt(t,e){const n=t-1;return V3e(e,0,n)}function uNt(t,e,n={}){const r=Ct.getVolume(t);if(!r)throw new Error(`Referenced volume with id ${t} does not exist.`);const{metadata:i,spacing:a,direction:o,dimensions:s}=r,{minX:c,maxX:l,minY:u,maxY:f,minZ:d,maxZ:h}=e,m=[Math.min(c,l),Math.min(u,f),Math.min(d,h)],p=r6(r.imageData,m),y=[Math.abs(l-c)+1,Math.abs(f-u)+1,Math.abs(h-d)+1],{targetBuffer:x}=n,S={metadata:i,dimensions:y,spacing:a,origin:p,direction:o,targetBuffer:x,scalarData:x?.type==="Float32Array"?new Float32Array(y[0]*y[1]*y[2]):void 0},C=eMt(ya(),S),_=C.voxelManager.getCompleteScalarDataArray(),T=y[0]*y[1],O=s[0]*s[1],M=r.voxelManager.getCompleteScalarDataArray();for(let I=0;I<y[2];I++)for(let V=0;V<y[1];V++){const k=r6(C.imageData,[0,V,I]),L=nd(r.imageData,k),$=L[2]*O+L[1]*s[0]+L[0],W=M.slice($,$+y[0]),G=I*T+V*y[0];_.set(W,G)}return C.voxelManager.setCompleteScalarDataArray(_),C}function fNt(t,e){const{viewUp:n,viewPlaneNormal:r}=e,i=AC(t,[0,0,0]),a=th(ut(),n),o=th(ut(),r),s=Tr(ut(),a,o),c=yr(ut(),AC(t,a),i),l=yr(ut(),AC(t,o),i);Vr(c,c),Vr(l,l);const u=Tr(ut(),c,l);return{worldVecRowDir:s,worldVecColDir:a,worldVecSliceDir:o,ijkVecRowDir:u,ijkVecColDir:c,ijkVecSliceDir:l}}function dNt(t,e,n,r){const[i,a,o]=e,s=i*a;let c=0,l=0,u=0;const[f,d,h]=n.map(Math.round);for(let x=h-r;x<=h+r;x++)if(!(x<0||x>=o)){for(let S=d-r;S<=d+r;S++)if(!(S<0||S>=a))for(let C=f-r;C<=f+r;C++){if(C<0||C>=i)continue;const _=x*s+S*i+C,T=t[_];c+=T,l+=T*T,u++}}if(u===0){const x=h*s+d*i+f;return x>=0&&x<t.length?{mean:t[x],stdDev:0,count:1}:{mean:0,stdDev:0,count:0}}const m=c/u,p=l/u-m*m,y=Math.sqrt(Math.max(0,p));return{mean:m,stdDev:y,count:u}}const hNt=new Set(["1.2.840.10008.5.1.4.1.1.1","1.2.840.10008.5.1.4.1.1.1.1","1.2.840.10008.5.1.4.1.1.1.1.1","1.2.840.10008.5.1.4.1.1.1.2","1.2.840.10008.5.1.4.1.1.1.2.1","1.2.840.10008.5.1.4.1.1.1.3","1.2.840.10008.5.1.4.1.1.1.3.1","1.2.840.10008.5.1.4.1.1.12.1","1.2.840.10008.5.1.4.1.1.12.1.1","1.2.840.10008.5.1.4.1.1.12.2","1.2.840.10008.5.1.4.1.1.12.2.1","1.2.840.10008.5.1.4.1.1.12.3"]);function gNt(t){const{PixelSpacing:e,ImagerPixelSpacing:n,EstimatedRadiographicMagnificationFactor:r,PixelSpacingCalibrationType:i,PixelSpacingCalibrationDescription:a}=t,o=!0;return n?e?Lr(e,n)?{PixelSpacing:e,type:ed.PROJECTION,isProjection:o}:i||a?{PixelSpacing:e,type:ed.CALIBRATED,isProjection:o,PixelSpacingCalibrationType:i,PixelSpacingCalibrationDescription:a}:{PixelSpacing:e,type:ed.UNKNOWN,isProjection:o}:r?{PixelSpacing:n.map(c=>c/r),type:ed.ERMF,isProjection:o}:(console.warn("EstimatedRadiographicMagnificationFactor was not present. Unable to correct ImagerPixelSpacing."),{PixelSpacing:n,type:ed.PROJECTION,isProjection:o}):{PixelSpacing:e,type:ed.UNKNOWN,isProjection:o}}function pNt(t){const{SequenceOfUltrasoundRegions:e}=t,n=Array.isArray(e);if(n&&e.length>1){console.warn("Sequence of Ultrasound Regions > one entry. This is not yet implemented, all measurements will be shown in pixels.");return}const{PhysicalDeltaX:r,PhysicalDeltaY:i}=n?e[0]:e;return{PixelSpacing:[Math.abs(r)*10,Math.abs(i)*10]}}function mNt(t){const{PixelSpacing:e,SOPClassUID:n,SequenceOfUltrasoundRegions:r}=t;return r?pNt(t):hNt.has(n)?gNt(t):{PixelSpacing:e,type:ed.NOT_APPLICABLE,isProjection:!1}}const vNt=(t,e)=>YIt(t,e,Ct.getVolume),Bc=Object.freeze(Object.defineProperty({__proto__:null,FrameRange:vy,HistoryMemo:jF,PointsManager:UC,ProgressiveIterator:JT,RLEVoxelMap:Cg,VoxelManager:oi,actorIsA:tc,applyPreset:r3e,asArray:Ek,autoLoad:yk,buildMetadata:h3e,calculateNeighborhoodStats:dNt,calculateSpacingBetweenImageIds:Fbe,calculateViewportsSpatialRegistration:kIt,calibratedPixelSpacingMetadataProvider:CIt,clamp:Ck,clip:V3e,color:KIt,colormap:ASt,convertStackToVolumeViewport:FIt,convertToGrayscale:GIt,convertVolumeToStackViewport:BIt,createLinearRGBTransferFunction:m3e,createSigmoidRGBTransferFunction:aF,createSubVolume:uNt,decimate:Wbe,deepClone:rf,deepEqual:A3e,deepMerge:Ac,eventListener:pIt,fnv1aHash:Lxe,generateVolumePropsFromImageIds:DF,genericMetadataProvider:e9,getBufferConfiguration:wbe,getClosestImageId:Zw,getClosestStackImageIndexForPoint:P3e,getCurrentVolumeViewportSlice:NIt,getDynamicVolumeInfo:iNt,getImageDataMetadata:g3e,getImageLegacy:$It,getImageSliceDataForVolumeViewport:t6,getMinMax:vIt,getPixelSpacingInformation:mNt,getRandomSampleFromArray:UF,getRuntimeId:D3e,getScalingParameters:zbe,getSliceRange:n9,getSpacingInNormalDirection:b3,getTargetVolumeAndSpacingInNormalDir:S3,getViewportImageCornersInWorld:AIt,getViewportImageIds:WIt,getViewportModality:vNt,getViewportsWithImageURI:a6,getViewportsWithVolumeId:t9,getVoiFromSigmoidRGBTransferFunction:n3e,getVolumeActorCorners:Zbe,getVolumeDirectionVectors:fNt,getVolumeId:V2,getVolumeSliceRangeInfo:t3e,getVolumeViewportScrollInfo:py,getVolumeViewportsContainingSameVolumes:TIt,hasFloatScalingParameters:OF,hasNaNValues:wk,imageIdToURI:ma,imageRetrieveMetadataProvider:Hy,imageToWorldCoords:MIt,indexWithinDimensions:wh,invertRgbTransferFunction:Y5,isEqual:Lr,isEqualAbs:kC,isEqualNegative:jxe,isImageActor:nf,isNumber:uo,isOpposite:_It,isPTPrescaledWithSUV:M3e,isValidVolume:jIt,isVideoTransferSyntax:k3e,jumpToSlice:sNt,loadImageToCanvas:EIt,logger:fRt,makeVolumeMetadata:Ube,planar:wMt,pointInShapeCallback:Fwe,renderToCanvasCPU:I3e,renderToCanvasGPU:R3e,roundNumber:Qi,roundToPrecision:zIt,scaleArray:aNt,scaleRgbTransferFunction:mIt,scroll:$3e,snapFocalPointToSlice:my,sortImageIdsAndGetSpacing:Bbe,spatialRegistrationMetadataProvider:o6,splitImageIdsBy4DTags:L3e,transferFunctionUtils:VSt,transformIndexToWorld:r6,transformWorldToIndex:nd,transformWorldToIndexContinuous:AC,triggerEvent:dt,updatePlaneRestriction:e3e,updateVTKImageDataWithCornerstoneImage:a9,uuidv4:ya,windowLevel:LSt,worldToImageCoords:DIt},Symbol.toStringTag,{value:"Module"})),_3=new SU("imageRetrievalPool");_3.setMaxSimultaneousRequests(In.Interaction,200);_3.setMaxSimultaneousRequests(In.Thumbnail,200);_3.setMaxSimultaneousRequests(In.Prefetch,200);_3.grabDelay=0;const Bte=Symbol("DefaultSettings"),zte=Symbol("RuntimeSettings"),Gte=Symbol("ObjectSettingsMap"),m0=Symbol("Dictionary");class Oi{constructor(e){const n=Object.create(e instanceof Oi&&m0 in e?e[m0]:null);Object.seal(Object.defineProperty(this,m0,{value:n}))}set(e,n){return s6(this[m0],e,n,null)}get(e){return wNt(this[m0],e)}unset(e){return yNt(this[m0],e+"")}forEach(e){Wte(this[m0],e)}extend(){return new Oi(this)}import(e){j3e(e)&&Object.keys(e).forEach(n=>{s6(this[m0],n,e[n],null)})}dump(){const e={};return Wte(this[m0],(n,r)=>{typeof r<"u"&&U3e(e,n,r)}),e}static assert(e){return e instanceof Oi?e:Oi.getRuntimeSettings()}static getDefaultSettings(e=null){let n=Oi[Bte];if(n instanceof Oi||(n=new Oi,Oi[Bte]=n),e){const r={};return n.forEach(i=>{if(i.startsWith(e)){const a=i.split(`${e}.`)[1];r[a]=n.get(i)}}),r}return n}static getRuntimeSettings(){let e=Oi[zte];return e instanceof Oi||(e=new Oi(Oi.getDefaultSettings()),Oi[zte]=e),e}static getObjectSettings(e,n){let r=null;if(e instanceof Oi)r=e;else if(typeof e=="object"&&e!==null){let i=Oi[Gte];i instanceof WeakMap||(i=new WeakMap,Oi[Gte]=i),r=i.get(e),r instanceof Oi||(r=new Oi(Oi.assert(Oi.getObjectSettings(n))),i.set(e,r))}return r}static extendRuntimeSettings(){return Oi.getRuntimeSettings().extend()}}function yNt(t,e){if(e.endsWith(".")){let n=0;const r=e,i=r.slice(0,-1),a=i.length===0;for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(a||o.startsWith(r)||o===i)&&(delete t[o],++n);return n>0}return delete t[e]}function Wte(t,e){for(const n in t)e(n,t[n])}function xNt(t,e,n,r){let i;if(r.has(n))return s6(t,e,null,r);r.add(n),i=0;for(const a in n)if(Object.prototype.hasOwnProperty.call(n,a)){const o=a.length===0?e:`${e}.${a}`;s6(t,o,n[a],r)||++i}return r.delete(n),i===0}function s6(t,e,n,r){return bNt(e)?j3e(n)?xNt(t,e,n,r instanceof WeakSet?r:new WeakSet):(t[e]=n,!0):!1}function wNt(t,e){return t[e]}function bNt(t){let e,n,r;if(typeof t!="string"||(e=t.length-1)<0)return!1;for(r=-1;(n=t.indexOf(".",r+1))>=0;){if(n-r<2||n===e)return!1;r=n}return!0}function j3e(t){if(typeof t=="object"&&t!==null){const e=Object.getPrototypeOf(t);if(e===Object.prototype||e===null)return!0}return!1}function U3e(t,e,n){const r=e.indexOf(".");if(r>=0){const i=e.slice(0,r);let a=t[i];if(typeof a!="object"||a===null){const o=a;a={},typeof o<"u"&&(a[""]=o),t[i]=a}U3e(a,e.slice(r+1,e.length),n)}else t[e]=n}Oi.getDefaultSettings().set("useCursors",!0);var ud;(function(t){t[t.Primary=1]="Primary",t[t.Secondary=2]="Secondary",t[t.Primary_And_Secondary=3]="Primary_And_Secondary",t[t.Auxiliary=4]="Auxiliary",t[t.Primary_And_Auxiliary=5]="Primary_And_Auxiliary",t[t.Secondary_And_Auxiliary=6]="Secondary_And_Auxiliary",t[t.Primary_And_Secondary_And_Auxiliary=7]="Primary_And_Secondary_And_Auxiliary",t[t.Fourth_Button=8]="Fourth_Button",t[t.Fifth_Button=16]="Fifth_Button",t[t.Wheel=524288]="Wheel",t[t.Wheel_Primary=524289]="Wheel_Primary"})(ud||(ud={}));var sl;(function(t){t[t.Shift=16]="Shift",t[t.Ctrl=17]="Ctrl",t[t.Alt=18]="Alt",t[t.Meta=91]="Meta",t[t.ShiftCtrl=1617]="ShiftCtrl",t[t.ShiftAlt=1618]="ShiftAlt",t[t.ShiftMeta=1691]="ShiftMeta",t[t.CtrlAlt=1718]="CtrlAlt",t[t.CtrlMeta=1791]="CtrlMeta",t[t.AltMeta=1891]="AltMeta"})(sl||(sl={}));var vi;(function(t){t.Active="Active",t.Passive="Passive",t.Enabled="Enabled",t.Disabled="Disabled"})(vi||(vi={}));var Eg;(function(t){t.Default="",t.Highlighted="Highlighted",t.Selected="Selected",t.Locked="Locked",t.AutoGenerated="AutoGenerated"})(Eg||(Eg={}));var ge;(function(t){t.TOOL_ACTIVATED="CORNERSTONE_TOOLS_TOOL_ACTIVATED",t.TOOLGROUP_VIEWPORT_ADDED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_ADDED",t.TOOLGROUP_VIEWPORT_REMOVED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_REMOVED",t.TOOL_MODE_CHANGED="CORNERSTONE_TOOLS_TOOL_MODE_CHANGED",t.CROSSHAIR_TOOL_CENTER_CHANGED="CORNERSTONE_TOOLS_CROSSHAIR_TOOL_CENTER_CHANGED",t.VOLUMECROPPINGCONTROL_TOOL_CHANGED="CORNERSTONE_TOOLS_VOLUMECROPPINGCONTROL_TOOL_CHANGED",t.VOLUMECROPPING_TOOL_CHANGED="CORNERSTONE_TOOLS_VOLUMECROPPING_TOOL_CHANGED",t.STACK_PREFETCH_COMPLETE="CORNERSTONE_TOOLS_STACK_PREFETCH_COMPLETE",t.ANNOTATION_ADDED="CORNERSTONE_TOOLS_ANNOTATION_ADDED",t.ANNOTATION_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_COMPLETED",t.ANNOTATION_MODIFIED="CORNERSTONE_TOOLS_ANNOTATION_MODIFIED",t.ANNOTATION_REMOVED="CORNERSTONE_TOOLS_ANNOTATION_REMOVED",t.ANNOTATION_SELECTION_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_SELECTION_CHANGE",t.ANNOTATION_LOCK_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_LOCK_CHANGE",t.ANNOTATION_VISIBILITY_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_VISIBILITY_CHANGE",t.ANNOTATION_RENDERED="CORNERSTONE_TOOLS_ANNOTATION_RENDERED",t.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_CUT_MERGE_PROCESS_COMPLETED",t.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_INTERPOLATION_PROCESS_COMPLETED",t.INTERPOLATED_ANNOTATIONS_REMOVED="CORNERSTONE_TOOLS_INTERPOLATED_ANNOTATIONS_REMOVED",t.SEGMENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_MODIFIED",t.SEGMENTATION_RENDERED="CORNERSTONE_TOOLS_SEGMENTATION_RENDERED",t.SEGMENTATION_REPRESENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_ADDED",t.SEGMENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_ADDED",t.SEGMENTATION_REPRESENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_MODIFIED",t.SEGMENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REMOVED",t.SEGMENTATION_REPRESENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_REMOVED",t.SEGMENTATION_DATA_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_DATA_MODIFIED",t.HISTORY_UNDO="CORNERSTONE_TOOLS_HISTORY_UNDO",t.HISTORY_REDO="CORNERSTONE_TOOLS_HISTORY_REDO",t.KEY_DOWN="CORNERSTONE_TOOLS_KEY_DOWN",t.KEY_UP="CORNERSTONE_TOOLS_KEY_UP",t.MOUSE_DOWN="CORNERSTONE_TOOLS_MOUSE_DOWN",t.MOUSE_UP="CORNERSTONE_TOOLS_MOUSE_UP",t.MOUSE_DOWN_ACTIVATE="CORNERSTONE_TOOLS_MOUSE_DOWN_ACTIVATE",t.MOUSE_DRAG="CORNERSTONE_TOOLS_MOUSE_DRAG",t.MOUSE_MOVE="CORNERSTONE_TOOLS_MOUSE_MOVE",t.MOUSE_CLICK="CORNERSTONE_TOOLS_MOUSE_CLICK",t.MOUSE_DOUBLE_CLICK="CORNERSTONE_TOOLS_MOUSE_DOUBLE_CLICK",t.MOUSE_WHEEL="CORNERSTONE_TOOLS_MOUSE_WHEEL",t.TOUCH_START="CORNERSTONE_TOOLS_TOUCH_START",t.TOUCH_START_ACTIVATE="CORNERSTONE_TOOLS_TOUCH_START_ACTIVATE",t.TOUCH_PRESS="CORNERSTONE_TOOLS_TOUCH_PRESS",t.TOUCH_DRAG="CORNERSTONE_TOOLS_TOUCH_DRAG",t.TOUCH_END="CORNERSTONE_TOOLS_TOUCH_END",t.TOUCH_TAP="CORNERSTONE_TOOLS_TAP",t.TOUCH_SWIPE="CORNERSTONE_TOOLS_SWIPE"})(ge||(ge={}));var Dn;(function(t){t.Labelmap="Labelmap",t.Contour="Contour",t.Surface="Surface"})(Dn||(Dn={}));var qv;(function(t){t.UP="UP",t.DOWN="DOWN",t.LEFT="LEFT",t.RIGHT="RIGHT"})(qv||(qv={}));var na;(function(t){t.Interaction="Interaction",t.HandlesUpdated="HandlesUpdated",t.StatsUpdated="StatsUpdated",t.InitialSetup="InitialSetup",t.Completed="Completed",t.InterpolationUpdated="InterpolationUpdated",t.History="History",t.MetadataReferenceModified="MetadataReferenceModified",t.LabelChange="LabelChange"})(na||(na={}));let SNt={},Tt={isInteractingWithTool:!1,isMultiPartToolActive:!1,tools:{},toolGroups:[],synchronizers:[],svgNodeCache:SNt,enabledElements:[]};var XR,Hte;function CNt(){if(Hte)return XR;Hte=1;var t="Expected a function",e="__lodash_hash_undefined__",n="[object Function]",r="[object GeneratorFunction]",i="[object Symbol]",a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/,s=/^\./,c=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,l=/[\\^$.*+?()[\]{}|]/g,u=/\\(\\)?/g,f=/^\[object .+?Constructor\]$/,d=typeof _0=="object"&&_0&&_0.Object===Object&&_0,h=typeof self=="object"&&self&&self.Object===Object&&self,m=d||h||Function("return this")();function p(Ae,at){return Ae?.[at]}function y(Ae){var at=!1;if(Ae!=null&&typeof Ae.toString!="function")try{at=!!(Ae+"")}catch{}return at}var x=Array.prototype,S=Function.prototype,C=Object.prototype,_=m["__core-js_shared__"],T=(function(){var Ae=/[^.]+$/.exec(_&&_.keys&&_.keys.IE_PROTO||"");return Ae?"Symbol(src)_1."+Ae:""})(),O=S.toString,M=C.hasOwnProperty,I=C.toString,V=RegExp("^"+O.call(M).replace(l,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),k=m.Symbol,L=x.splice,$=ue(m,"Map"),W=ue(Object,"create"),G=k?k.prototype:void 0,oe=G?G.toString:void 0;function U(Ae){var at=-1,ct=Ae?Ae.length:0;for(this.clear();++at<ct;){var kt=Ae[at];this.set(kt[0],kt[1])}}function Y(){this.__data__=W?W(null):{}}function J(Ae){return this.has(Ae)&&delete this.__data__[Ae]}function ne(Ae){var at=this.__data__;if(W){var ct=at[Ae];return ct===e?void 0:ct}return M.call(at,Ae)?at[Ae]:void 0}function F(Ae){var at=this.__data__;return W?at[Ae]!==void 0:M.call(at,Ae)}function ae(Ae,at){var ct=this.__data__;return ct[Ae]=W&&at===void 0?e:at,this}U.prototype.clear=Y,U.prototype.delete=J,U.prototype.get=ne,U.prototype.has=F,U.prototype.set=ae;function re(Ae){var at=-1,ct=Ae?Ae.length:0;for(this.clear();++at<ct;){var kt=Ae[at];this.set(kt[0],kt[1])}}function te(){this.__data__=[]}function ye(Ae){var at=this.__data__,ct=Rt(at,Ae);if(ct<0)return!1;var kt=at.length-1;return ct==kt?at.pop():L.call(at,ct,1),!0}function we(Ae){var at=this.__data__,ct=Rt(at,Ae);return ct<0?void 0:at[ct][1]}function Oe(Ae){return Rt(this.__data__,Ae)>-1}function Te(Ae,at){var ct=this.__data__,kt=Rt(ct,Ae);return kt<0?ct.push([Ae,at]):ct[kt][1]=at,this}re.prototype.clear=te,re.prototype.delete=ye,re.prototype.get=we,re.prototype.has=Oe,re.prototype.set=Te;function Me(Ae){var at=-1,ct=Ae?Ae.length:0;for(this.clear();++at<ct;){var kt=Ae[at];this.set(kt[0],kt[1])}}function be(){this.__data__={hash:new U,map:new($||re),string:new U}}function Ye(Ae){return Ke(this,Ae).delete(Ae)}function ft(Ae){return Ke(this,Ae).get(Ae)}function je(Ae){return Ke(this,Ae).has(Ae)}function It(Ae,at){return Ke(this,Ae).set(Ae,at),this}Me.prototype.clear=be,Me.prototype.delete=Ye,Me.prototype.get=ft,Me.prototype.has=je,Me.prototype.set=It;function Rt(Ae,at){for(var ct=Ae.length;ct--;)if(wt(Ae[ct][0],at))return ct;return-1}function cn(Ae,at){at=B(at,Ae)?[at]:tr(at);for(var ct=0,kt=at.length;Ae!=null&&ct<kt;)Ae=Ae[pe(at[ct++])];return ct&&ct==kt?Ae:void 0}function ln(Ae){if(!Sn(Ae)||fe(Ae))return!1;var at=Ln(Ae)||y(Ae)?V:f;return at.test(Re(Ae))}function en(Ae){if(typeof Ae=="string")return Ae;if(hn(Ae))return oe?oe.call(Ae):"";var at=Ae+"";return at=="0"&&1/Ae==-1/0?"-0":at}function tr(Ae){return Pt(Ae)?Ae:ie(Ae)}function Ke(Ae,at){var ct=Ae.__data__;return K(at)?ct[typeof at=="string"?"string":"hash"]:ct.map}function ue(Ae,at){var ct=p(Ae,at);return ln(ct)?ct:void 0}function B(Ae,at){if(Pt(Ae))return!1;var ct=typeof Ae;return ct=="number"||ct=="symbol"||ct=="boolean"||Ae==null||hn(Ae)?!0:o.test(Ae)||!a.test(Ae)||at!=null&&Ae in Object(at)}function K(Ae){var at=typeof Ae;return at=="string"||at=="number"||at=="symbol"||at=="boolean"?Ae!=="__proto__":Ae===null}function fe(Ae){return!!T&&T in Ae}var ie=et(function(Ae){Ae=kn(Ae);var at=[];return s.test(Ae)&&at.push(""),Ae.replace(c,function(ct,kt,jt,gn){at.push(jt?gn.replace(u,"$1"):kt||ct)}),at});function pe(Ae){if(typeof Ae=="string"||hn(Ae))return Ae;var at=Ae+"";return at=="0"&&1/Ae==-1/0?"-0":at}function Re(Ae){if(Ae!=null){try{return O.call(Ae)}catch{}try{return Ae+""}catch{}}return""}function et(Ae,at){if(typeof Ae!="function"||at&&typeof at!="function")throw new TypeError(t);var ct=function(){var kt=arguments,jt=at?at.apply(this,kt):kt[0],gn=ct.cache;if(gn.has(jt))return gn.get(jt);var Kn=Ae.apply(this,kt);return ct.cache=gn.set(jt,Kn),Kn};return ct.cache=new(et.Cache||Me),ct}et.Cache=Me;function wt(Ae,at){return Ae===at||Ae!==Ae&&at!==at}var Pt=Array.isArray;function Ln(Ae){var at=Sn(Ae)?I.call(Ae):"";return at==n||at==r}function Sn(Ae){var at=typeof Ae;return!!Ae&&(at=="object"||at=="function")}function Sr(Ae){return!!Ae&&typeof Ae=="object"}function hn(Ae){return typeof Ae=="symbol"||Sr(Ae)&&I.call(Ae)==i}function kn(Ae){return Ae==null?"":en(Ae)}function Mn(Ae,at,ct){var kt=Ae==null?void 0:cn(Ae,at);return kt===void 0?ct:kt}return XR=Mn,XR}var _Nt=CNt();const TNt=ka(_Nt),qte=Symbol("DefinedCursors"),F3e=new Set(["alias","all-scroll","auto","cell","col-resize","context-menu","copy","crosshair","default","e-resize","ew-resize","grab","grabbing","help","move","ne-resize","nesw-resize","no-drop","none","not-allowed","n-resize","ns-resize","nw-resize","nwse-resize","pointer","progress","row-resize","se-resize","s-resize","sw-resize","text","vertical-text","wait","w-resize","zoom-in","zoom-out"]);class hl{constructor(e,n){this.name=e+"",this.fallback=n}getName(){return this.name+""}addFallbackStyleProperty(e){const{fallback:n}=this;return n instanceof hl?`${e}, ${n.getStyleProperty()}`:e+""}getStyleProperty(){return this.addFallbackStyleProperty(this.name)+""}static getDefinedCursor(e){const n=Kte(hl,qte);let r=n.get(e);if(r instanceof hl)return r;if(F3e.has(e))return r=new hl(e),n.set(e,r),r}static setDefinedCursor(e,n){return n instanceof hl?(Kte(hl,qte).set(e,n),!0):!1}}function Kte(t,e){let n=t[e];return n instanceof Map||(n=new Map,Object.defineProperty(t,e,{value:n})),n}const ENt=F3e.values(),ONt="image-cursor";class c6 extends hl{constructor(e,n,r,i,a){super(i||c6.getUniqueInstanceName(ONt),a),this.url=e,this.x=Number(n)||0,this.y=Number(r)||0}getStyleProperty(){const{url:e,x:n,y:r}=this;let i=`url('${e}')`;return n>=0&&r>=0&&(n>0||r>0)&&(i+=` ${n} ${r}`),this.addFallbackStyleProperty(i)}static getUniqueInstanceName(e){return`${e}-${D3e(c6)}`}}const ur={iconContent:"",iconSize:16,viewBox:{x:16,y:16},mousePoint:{x:8,y:8},mousePointerGroupString:`
    <path stroke="{{color}}" d="M8 16L8 0"></path>
    <path stroke="{{color}}" d="M16 8L0 8"></path>
  `},Cc={x:127,y:60},_v=`
<rect fill="{{color}}" x="80.19" y="25.03" width="47.14" height="15.85"/>
`,lg=`
<rect fill="{{color}}" x="80.19" y="25.03" width="47.14" height="15.85"/>
<rect fill="{{color}}" x="95.84" y="9.38" width="15.85" height="47.14"/>
`,BS='<path fill="{{color}}" d="M82.89,10a12.09,12.09,0,0,0-16.8-2.5l-27.5,20.4-8.5-6.3a2.93,2.93,0,0,1-1.1-3,14.66,14.66,0,0,0,.1-6.6,14.08,14.08,0,1,0-6.5,15.2,2.87,2.87,0,0,1,3.2.2l8.2,6.1-8.2,6.1a2.87,2.87,0,0,1-3.2.2,14.16,14.16,0,1,0,6.7,14.4,14,14,0,0,0-.3-5.8,2.93,2.93,0,0,1,1.1-3l8.5-6.3,27.5,20.4A11.91,11.91,0,0,0,82.89,57l-31.7-23.5ZM15.29,21a5.9,5.9,0,1,1,5.9-5.9A5.91,5.91,0,0,1,15.29,21Zm0,36.8a5.9,5.9,0,1,1,5.9-5.9A5.91,5.91,0,0,1,15.29,57.77Zm28.3-21.5a2.8,2.8,0,1,1,2.8-2.8A2.8,2.8,0,0,1,43.59,36.27Z" transform="translate(-1.17 -0.96)"/>',Tv='<path fill="{{color}}" d="M8.86,2.25V66.08H72.69V2.25H8.86ZM65.28,58.67h-49v-49h49v49Z" transform="translate(-8.86 -2.25)"/>',zS='<path fill="{{color}}" d="M40.77,2.25A31.92,31.92,0,1,0,72.69,34.16,31.92,31.92,0,0,0,40.77,2.25Zm0,57.63A25.71,25.71,0,1,1,66.48,34.16,25.71,25.71,0,0,1,40.77,59.87Z" transform="translate(-8.86 -2.25)"/>',B3e={Angle:fr(ur,{name:"Angle",iconContent:`<path fill="{{color}}" d="M1203 544q0 13-10 23l-393 393 393 393q10 10 10 23t-10 23l-50
    50q-10 10-23 10t-23-10l-466-466q-10-10-10-23t10-23l466-466q10-10 23-10t23
    10l50 50q10 10 10 23z" />`,viewBox:{x:1792,y:1792}}),ArrowAnnotate:fr(ur,{name:"ArrowAnnotate",iconContent:`<g id="arrowAnnotate-group" fill="none" stroke-width="1" stroke="{{color}}" stroke-linecap="round" stroke-linejoin="round">
    <path id="arrowAnnotate-arrow" d="M23,7 l-15,15 M7,17 l0,6 6,0" stroke-width="2" />
  </g>`,viewBox:{x:24,y:24}}),Bidirectional:fr(ur,{name:"Bidirectional",iconContent:`<g fill="{{color}}" stroke-width="3" stroke="{{color}}">
    <path d="M27.63 3.21L3.12 28.81"></path>
    <path d="M27.63 15.75L15.27 4.43"></path>
    <path d="M16.5 4.28C16.5 4.96 15.95 5.51 15.27 5.51C14.59 5.51 14.03 4.96 14.03 4.28C14.03 3.59 14.59 3.04 15.27 3.04C15.95 3.04 16.5 3.59 16.5 4.28Z" ></path>
    <path d="M28.87 3.19C28.87 3.87 28.31 4.43 27.63 4.43C26.95 4.43 26.4 3.87 26.4 3.19C26.4 2.51 26.95 1.95 27.63 1.95C28.31 1.95 28.87 2.51 28.87 3.19Z"></path>
    <path d="M28.87 15.75C28.87 16.43 28.31 16.99 27.63 16.99C26.95 16.99 26.4 16.43 26.4 15.75C26.4 15.07 26.95 14.51 27.63 14.51C28.31 14.51 28.87 15.07 28.87 15.75Z"></path>
    <path d="M4.73 28.44C4.73 29.12 4.17 29.68 3.49 29.68C2.81 29.68 2.25 29.12 2.25 28.44C2.25 27.76 2.81 27.2 3.49 27.2C4.17 27.2 4.73 27.76 4.73 28.44Z"></path>
  </g>`,viewBox:{x:48,y:48}}),CobbAngle:fr(ur,{name:"CobbAngle",iconContent:`<g stroke="{{color}}" stroke-width="3">
    <path d="M28.59 2.34L3.82 12.32"></path>
    <path d="M28.59 29.66L3.82 19.68"></path>
    <path stroke-dasharray="2" fill-opacity="0" d="M12.37
      23.06C12.67 22.36 12.85 21.93 12.92 21.76C14.6 17.8 14.68 13.35 13.15
      9.33C13.11 9.24 13.02 9 12.88 8.63">
    </path>
  </g>`,viewBox:{x:32,y:32}}),CircleROI:fr(ur,{name:"CircleROI",iconContent:'<circle stroke="{{color}}" fill="none" stroke-width="3" cx="16" cy="16" r="14" />',viewBox:{x:32,y:32}}),EllipticalROI:fr(ur,{name:"EllipticalROI",iconContent:`<path stroke="{{color}}" fill="none" stroke-width="3" d="M30.74 15.76C30.74 20.99 24.14 25.23 16
    25.23C7.86 25.23 1.26 20.99 1.26 15.76C1.26 10.54 7.86 6.3 16 6.3C24.14
    6.3 30.74 10.54 30.74 15.76Z" />`,viewBox:{x:32,y:32}}),FreehandROI:fr(ur,{name:"FreehandROI",iconContent:`<g fill="{{color}}" stroke="{{color}}" stroke-width="2">
    <ellipse ry="1" rx="1" id="svg_3" cy="4.240343" cx="14.306499"/>
    <line id="svg_4" y2="3.58462" x2="12.242186" y1="3.997482" x1="13.432202"/>
    <line id="svg_5" y2="3.268901" x2="10.857882" y1="3.608906" x1="12.387902"/>
    <line id="svg_6" y2="3.147471" x2="9.740724" y1="3.293187" x1="10.955026"/>
    <line id="svg_7" y2="3.147471" x2="8.089274" y1="3.196043" x1="9.983585"/>
    <line id="svg_8" y2="3.268901" x2="6.874972" y1="3.123185" x1="8.307848"/>
    <line id="svg_9" y2="3.657478" x2="5.587812" y1="3.220329" x1="7.020688"/>
    <line id="svg_10" y2="4.046054" x2="4.737801" y1="3.560334" x1="5.854959"/>
    <line id="svg_11" y2="4.337487" x2="4.300652" y1="3.997482" x1="4.834945"/>
    <line id="svg_12" y2="4.726063" x2="3.88779" y1="4.191771" x1="4.470655"/>
    <line id="svg_15" y2="5.3575" x2="3.377783" y1="4.604633" x1="3.960648"/>
    <line id="svg_16" y2="6.183226" x2="2.916348" y1="5.138926" x1="3.547785"/>
    <line id="svg_17" y2="6.960379" x2="2.770632" y1="5.867507" x1="3.037779"/>
    <line id="svg_18" y2="7.713246" x2="2.673488" y1="6.741804" x1="2.819204"/>
    <line id="svg_19" y2="8.684687" x2="2.697774" y1="7.616102" x1="2.673488"/>
    <line id="svg_20" y2="9.753273" x2="2.892062" y1="8.611829" x1="2.697774"/>
    <line id="svg_21" y2="10.724714" x2="3.134923" y1="9.534698" x1="2.84349"/>
    <line id="svg_23" y2="11.647583" x2="3.596357" y1="10.578998" x1="3.086351"/>
    <line id="svg_25" y2="12.521881" x2="4.276366" y1="11.501867" x1="3.499213"/>
    <line id="svg_26" y2="13.930471" x2="5.830673" y1="12.376165" x1="4.13065"/>
    <line id="svg_28" y2="14.707624" x2="7.263549" y1="13.881899" x1="5.733528"/>
    <line id="svg_29" y2="15.339061" x2="8.963571" y1="14.61048" x1="7.06926"/>
    <line id="svg_30" y2="15.581921" x2="10.882168" y1="15.314775" x1="8.817855"/>
    <line id="svg_31" y2="15.460491" x2="12.023612" y1="15.581921" x1="10.785024"/>
    <line id="svg_33" y2="15.120487" x2="13.092197" y1="15.484777" x1="11.877895"/>
    <line id="svg_34" y2="14.586194" x2="13.86935" y1="15.217631" x1="12.897909"/>
    <line id="svg_35" y2="13.833327" x2="14.597931" y1="14.756196" x1="13.699348"/>
    <line id="svg_37" y2="12.716169" x2="15.180796" y1="13.881899" x1="14.549359"/>
    <line id="svg_39" y2="11.429009" x2="15.520801" y1="12.813313" x1="15.15651"/>
    <ellipse ry="1" rx="1" id="svg_40" cy="10.967574" cx="15.520801"/>
  </g>`,viewBox:{x:18,y:18}}),FreehandROISculptor:fr(ur,{name:"FreehandROISculptor",iconContent:`<g id="icon-freehand-sculpt" fill="none" stroke-width="1.5" stroke="{{color}}" stroke-linecap="round" stroke-linejoin="round">
    <line id="svg_1" y2="2.559367" x2="10.184807" y1="4.467781" x1="8.81711"/>
    <line id="svg_4" y2="1.493836" x2="11.727442" y1="2.766112" x1="10.089386"/>
    <line id="svg_7" y2="1.080346" x2="13.047428" y1="1.748291" x1="11.345759"/>
    <line id="svg_8" y2="1.000829" x2="14.351511" y1="1.112153" x1="12.77707"/>
    <line id="svg_9" y2="1.350705" x2="15.242104" y1="0.905408" x1="13.969828"/>
    <line id="svg_10" y2="2.098167" x2="15.862339" y1="1.14396" x1="14.955842"/>
    <line id="svg_11" y2="3.195505" x2="16.41896" y1="1.939133" x1="15.766918"/>
    <line id="svg_12" y2="4.292843" x2="16.530284" y1="2.925147" x1="16.387153"/>
    <line id="svg_16" y2="5.644637" x2="16.196311" y1="3.831643" x1="16.593898"/>
    <line id="svg_18" y2="7.266789" x2="15.623787" y1="5.19934" x1="16.275829"/>
    <line id="svg_19" y2="10.813258" x2="14.526449" y1="6.726071" x1="15.766918"/>
    <line id="svg_20" y2="5.056209" x2="8.085552" y1="4.181519" x1="8.976145"/>
    <line id="svg_23" y2="5.326568" x2="7.481221" y1="4.78585" x1="8.403621"/>
    <line id="svg_24" y2="5.565119" x2="6.749662" y1="5.294761" x1="7.624352"/>
    <line id="svg_25" y2="5.994512" x2="5.429675" y1="5.533312" x1="6.956407"/>
    <line id="svg_27" y2="6.551133" x2="4.284627" y1="5.962706" x1="5.572807"/>
    <line id="svg_28" y2="7.584858" x2="3.044158" y1="6.392099" x1="4.427758"/>
    <line id="svg_29" y2="8.84123" x2="2.185372" y1="7.489437" x1="3.219096"/>
    <line id="svg_31" y2="10.606513" x2="1.644654" y1="8.602678" x1="2.280792"/>
    <line id="svg_32" y2="13.214679" x2="1.48562" y1="10.352058" x1="1.724171"/>
    <line id="svg_33" y2="14.375631" x2="1.676461" y1="12.992031" x1="1.453813"/>
    <line id="svg_34" y2="15.298031" x2="2.264889" y1="14.152983" x1="1.517427"/>
    <line id="svg_35" y2="16.172721" x2="3.521261" y1="14.948155" x1="1.915013"/>
    <line id="svg_36" y2="16.824762" x2="5.207027" y1="15.997783" x1="3.28271"/>
    <line id="svg_38" y2="17.063314" x2="7.035924" y1="16.745245" x1="4.968475"/>
    <line id="svg_39" y2="16.888376" x2="9.278311" y1="17.047411" x1="6.733758"/>
    <line id="svg_40" y2="16.284045" x2="10.661911" y1="16.983797" x1="8.992048"/>
    <line id="svg_41" y2="15.313934" x2="11.647925" y1="16.395369" x1="10.455166"/>
    <line id="svg_44" y2="13.898527" x2="12.82478" y1="15.425259" x1="11.504794"/>
    <line id="svg_45" y2="12.037824" x2="14.144766" y1="14.312017" x1="12.522614"/>
    <line id="svg_47" y2="10.59061" x2="14.605966" y1="12.228665" x1="13.953925"/>
    <ellipse ry="1" rx="1" id="svg_48" cy="3.982726" cx="13.460918"/>
  </g>`,viewBox:{x:18,y:18}}),Length:fr(ur,{name:"Length",iconContent:`<g id="length-group" fill="none" stroke-width="1" stroke="{{color}}" stroke-linecap="round" stroke-linejoin="round">
    <path id="length-dashes" d="m22.5,6 -16.5,16.5" stroke-width="3" stroke-dasharray="0.6666,5" />
  </g>`,viewBox:{x:24,y:24}}),Height:fr(ur,{name:"Height",iconContent:'<path d="m 6 22 l 8.5 0 v -16 h 8" stroke-width="3" fill="none" stroke="{{color}}" />',viewBox:{x:24,y:24}}),Probe:fr(ur,{name:"Probe",iconContent:`<path fill="{{color}}" d="M1152 896q0 106-75 181t-181 75-181-75-75-181 75-181 181-75 181 75
    75 181zm-256-544q-148 0-273 73t-198 198-73 273 73 273 198 198 273 73 273-73
    198-198 73-273-73-273-198-198-273-73zm768 544q0 209-103 385.5t-279.5
    279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5
    385.5-103 385.5 103 279.5 279.5 103 385.5z" />`,viewBox:{x:1792,y:1792}}),RectangleROI:fr(ur,{name:"RectangleROI",iconContent:`<path fill="{{color}}" d="M1312 256h-832q-66 0-113 47t-47 113v832q0 66 47
    113t113 47h832q66 0 113-47t47-113v-832q0-66-47-113t-113-47zm288 160v832q0
    119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119
    84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z" />`,viewBox:{x:1792,y:1792}}),Label:fr(ur,{name:"Label",iconContent:`<path fill="{{color}}" d="M789 559l-170 450q33 0 136.5 2t160.5 2q19 0
    57-2-87-253-184-452zm-725 1105l2-79q23-7 56-12.5t57-10.5 49.5-14.5 44.5-29
    31-50.5l237-616 280-724h128q8 14 11 21l205 480q33 78 106 257.5t114 274.5q15
    34 58 144.5t72 168.5q20 45 35 57 19 15 88 29.5t84 20.5q6 38 6 57 0 5-.5
    13.5t-.5 12.5q-63 0-190-8t-191-8q-76 0-215 7t-178 8q0-43 4-78l131-28q1 0
    12.5-2.5t15.5-3.5 14.5-4.5 15-6.5 11-8 9-11
    2.5-14q0-16-31-96.5t-72-177.5-42-100l-450-2q-26 58-76.5 195.5t-50.5 162.5q0
    22 14 37.5t43.5 24.5 48.5 13.5 57 8.5 41 4q1 19 1 58 0 9-2 27-58
    0-174.5-10t-174.5-10q-8 0-26.5 4t-21.5 4q-80 14-188 14z" />`,viewBox:{x:1792,y:1792}}),Crosshairs:fr(ur,{name:"Crosshairs",iconContent:`<path fill="{{color}}" d="M1325 1024h-109q-26 0-45-19t-19-45v-128q0-26
    19-45t45-19h109q-32-108-112.5-188.5t-188.5-112.5v109q0 26-19 45t-45
    19h-128q-26 0-45-19t-19-45v-109q-108 32-188.5 112.5t-112.5 188.5h109q26
    0 45 19t19 45v128q0 26-19 45t-45 19h-109q32 108 112.5 188.5t188.5
    112.5v-109q0-26 19-45t45-19h128q26 0 45 19t19 45v109q108-32
    188.5-112.5t112.5-188.5zm339-192v128q0 26-19 45t-45 19h-143q-37 161-154.5
    278.5t-278.5 154.5v143q0 26-19 45t-45 19h-128q-26
    0-45-19t-19-45v-143q-161-37-278.5-154.5t-154.5-278.5h-143q-26
    0-45-19t-19-45v-128q0-26 19-45t45-19h143q37-161
    154.5-278.5t278.5-154.5v-143q0-26 19-45t45-19h128q26 0 45 19t19 45v143q161
    37 278.5 154.5t154.5 278.5h143q26 0 45 19t19 45z" />`,viewBox:{x:1792,y:1792}}),Eraser:fr(ur,{name:"Eraser",iconContent:`<path transform="translate(0,1792) scale(1,-1)" fill="{{color}}" d="M960 1408l336-384h-768l-336 384h768zm1013-1077q15
    34 9.5 71.5t-30.5 65.5l-896 1024q-38 44-96 44h-768q-38
    0-69.5-20.5t-47.5-54.5q-15-34-9.5-71.5t30.5-65.5l896-1024q38-44 96-44h768q38
    0 69.5 20.5t47.5 54.5z" />`,viewBox:{x:2048,y:1792}}),Magnify:fr(ur,{name:"Magnify",iconContent:`<path fill="{{color}}" d="M508.5 481.6l-129-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3C395
    312 416 262.5 416 208 416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c54.5
    0 104-21 141.1-55.2V371c0 3.2 1.3 6.2 3.5 8.5l129 129c4.7 4.7 12.3 4.7 17
    0l9.9-9.9c4.7-4.7 4.7-12.3 0-17zM208 384c-97.3 0-176-78.7-176-176S110.7 32 208
    32s176 78.7 176 176-78.7 176-176 176z" />`,viewBox:{x:512,y:512}}),Pan:fr(ur,{name:"Pan",iconContent:`<path fill="{{color}}" d="M1411 541l-355 355 355 355 144-144q29-31 70-14 39 17
    39 59v448q0 26-19 45t-45 19h-448q-42 0-59-40-17-39 14-69l144-144-355-355-355
    355 144 144q31 30 14 69-17 40-59 40h-448q-26 0-45-19t-19-45v-448q0-42 40-59
    39-17 69 14l144 144 355-355-355-355-144 144q-19 19-45 19-12
    0-24-5-40-17-40-59v-448q0-26 19-45t45-19h448q42 0 59 40 17 39-14 69l-144
    144 355 355 355-355-144-144q-31-30-14-69 17-40 59-40h448q26 0 45 19t19
    45v448q0 42-39 59-13 5-25 5-26 0-45-19z" />`,viewBox:{x:1792,y:1792}}),Rotate:fr(ur,{name:"Rotate",iconContent:`<path fill="{{color}}" d="M1664 256v448q0 26-19 45t-45 19h-448q-42 0-59-40-17-39
    14-69l138-138q-148-137-349-137-104 0-198.5 40.5t-163.5 109.5-109.5
    163.5-40.5 198.5 40.5 198.5 109.5 163.5 163.5 109.5 198.5 40.5q119 0
    225-52t179-147q7-10 23-12 15 0 25 9l137 138q9 8 9.5 20.5t-7.5 22.5q-109
    132-264 204.5t-327 72.5q-156 0-298-61t-245-164-164-245-61-298 61-298
    164-245 245-164 298-61q147 0 284.5 55.5t244.5 156.5l130-129q29-31 70-14
    39 17 39 59z" />`,viewBox:{x:1792,y:1792}}),StackScroll:fr(ur,{name:"StackScroll",iconContent:`<path fill="{{color}}" d="M24 21v2c0 0.547-0.453 1-1 1h-22c-0.547
    0-1-0.453-1-1v-2c0-0.547 0.453-1 1-1h22c0.547 0 1 0.453 1 1zM24 13v2c0
    0.547-0.453 1-1 1h-22c-0.547 0-1-0.453-1-1v-2c0-0.547 0.453-1 1-1h22c0.547
    0 1 0.453 1 1zM24 5v2c0 0.547-0.453 1-1 1h-22c-0.547
    0-1-0.453-1-1v-2c0-0.547 0.453-1 1-1h22c0.547 0 1 0.453 1 1z" />`,viewBox:{x:24,y:28}}),WindowLevelRegion:fr(ur,{name:"WindowLevelRegion",iconContent:`<path fill="{{color}}" d="M1664 416v960q0 119-84.5 203.5t-203.5 84.5h-960q-119
    0-203.5-84.5t-84.5-203.5v-960q0-119 84.5-203.5t203.5-84.5h960q119 0 203.5
    84.5t84.5 203.5z" />`,viewBox:{x:1792,y:1792}}),WindowLevel:fr(ur,{name:"WindowLevel",iconContent:`
    <path fill="{{color}}" d="M14.5,3.5 a1 1 0 0 1 -11,11 Z" stroke="none" opacity="0.8" />
    <circle cx="9" cy="9" r="8" fill="none" stroke-width="2" stroke="{{color}}" />`,viewBox:{x:18,y:18}}),Zoom:fr(ur,{name:"Zoom",iconContent:`
  <path fill="{{color}}" d="M508.5 481.6l-129-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3C395
    312 416 262.5 416 208 416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c54.5
    0 104-21 141.1-55.2V371c0 3.2 1.3 6.2 3.5 8.5l129 129c4.7 4.7 12.3 4.7 17
    0l9.9-9.9c4.7-4.7 4.7-12.3 0-17zM208 384c-97.3 0-176-78.7-176-176S110.7 32 208
    32s176 78.7 176 176-78.7 176-176 176z" />
  <path fill="{{color}}" transform="scale(0.22,0.22) translate(1400,0)" d="M1216
    320q0 26-19 45t-45 19h-128v1024h128q26 0 45 19t19 45-19 45l-256 256q-19
    19-45 19t-45-19l-256-256q-19-19-19-45t19-45 45-19h128v-1024h-128q-26
    0-45-19t-19-45 19-45l256-256q19-19 45-19t45 19l256 256q19 19 19 45z" />`,viewBox:{x:640,y:512}}),SegmentationFreeHandEraseInside:fr(ur,{name:"SegmentationFreeHandEraseInside",iconContent:`${BS} ${_v}`,viewBox:Cc}),SegmentationFreeHandFillInside:fr(ur,{name:"SegmentationFreeHandFillInside",iconContent:`${BS} ${lg}`,viewBox:Cc}),SegmentationFreeHandEraseOutside:fr(ur,{name:"SegmentationFreeHandEraseOutside",iconContent:`${BS} ${_v}`,viewBox:Cc}),SegmentationFreeHandFillOutside:fr(ur,{name:"SegmentationFreeHandFillOutside",iconContent:`${BS} ${lg}`,viewBox:Cc}),SegmentationRectangleEraseInside:fr(ur,{name:"SegmentationRectangleEraseInside",iconContent:`${Tv} ${_v}`,viewBox:Cc}),RectangleScissor:fr(ur,{name:"RectangleScissor",iconContent:`${Tv} ${lg}`,viewBox:Cc}),"RectangleScissor.FILL_INSIDE":fr(ur,{name:"RectangleScissor.FILL_INSIDE",iconContent:`${Tv} ${lg}`,viewBox:Cc}),"RectangleScissor.FILL_OUTSIDE":fr(ur,{name:"RectangleScissor.FILL_OUTSIDE",iconContent:`${Tv} ${lg}`,viewBox:Cc}),"RectangleScissor.ERASE_OUTSIDE":fr(ur,{name:"RectangleScissor.ERASE_OUTSIDE",iconContent:`${Tv} ${_v}`,viewBox:Cc}),"RectangleScissor.ERASE_INSIDE":fr(ur,{name:"RectangleScissor.ERASE_INSIDE",iconContent:`${Tv} ${_v}`,viewBox:Cc}),CircleScissor:fr(ur,{name:"CircleScissor",iconContent:`${zS} ${lg}`,viewBox:Cc}),"CircleScissor.FILL_INSIDE":fr(ur,{name:"CircleScissor.FILL_INSIDE",iconContent:`${zS} ${lg}`,viewBox:Cc}),"CircleScissor.ERASE_OUTSIDE":fr(ur,{name:"CircleScissor.ERASE_OUTSIDE",iconContent:`${zS} ${_v}`,viewBox:Cc}),"CircleScissor.FILL_OUTSIDE":fr(ur,{name:"CircleScissor.FILL_OUTSIDE",iconContent:`${zS} ${lg}`,viewBox:Cc})};function fr(t,e){return Object.assign(Object.create(t),{...e,name:e.name||t.name})}function DNt(t){return B3e[t]}const MNt=Object.keys(B3e);class RNt{constructor(){const e={color:"rgb(255, 255, 0)",colorHighlighted:"rgb(0, 255, 0)",colorSelected:"rgb(0, 220, 0)",colorLocked:"rgb(209, 193, 90)",lineWidth:"1",lineDash:"",shadow:!0,textBoxVisibility:!0,textBoxFontFamily:"Helvetica Neue, Helvetica, Arial, sans-serif",textBoxFontSize:"14px",textBoxColor:"rgb(255, 255, 0)",textBoxColorHighlighted:"rgb(0, 255, 0)",textBoxColorSelected:"rgb(0, 255, 0)",textBoxColorLocked:"rgb(209, 193, 90)",textBoxBackground:"",textBoxLinkLineWidth:"1",textBoxLinkLineDash:"2,3",textBoxShadow:!0,markerSize:"10",angleArcLineDash:""};this._initializeConfig(e)}getAnnotationToolStyles(e){return this.config.annotations&&this.config.annotations[e]}getViewportToolStyles(e){return this.config.viewports&&this.config.viewports[e]}getToolGroupToolStyles(e){return this.config.toolGroups&&this.config.toolGroups[e]}getDefaultToolStyles(){return this.config.default}setAnnotationStyles(e,n){let r=this.config.annotations;r||(this.config={...this.config,annotations:{}},r=this.config.annotations),r[e]=n}setViewportToolStyles(e,n){let r=this.config.viewports;r||(this.config={...this.config,viewports:{}},r=this.config.viewports),r[e]=n}setToolGroupToolStyles(e,n){let r=this.config.toolGroups;r||(this.config={...this.config,toolGroups:{}},r=this.config.toolGroups),r[e]=n}setDefaultToolStyles(e){this.config.default=e}getStyleProperty(e,n){const{annotationUID:r,viewportId:i,toolGroupId:a,toolName:o}=n;return this._getToolStyle(e,r,i,a,o)}_getToolStyle(e,n,r,i,a){if(n){const s=this.getAnnotationToolStyles(n);if(s&&s[e]!==void 0)return s[e]}if(r){const s=this.getViewportToolStyles(r);if(s){if(s[a]&&s[a][e]!==void 0)return s[a][e];if(s.global&&s.global[e]!==void 0)return s.global[e]}}if(i){const s=this.getToolGroupToolStyles(i);if(s){if(s[a]&&s[a][e]!==void 0)return s[a][e];if(s.global&&s.global[e]!==void 0)return s.global[e]}}const o=this.getDefaultToolStyles();if(o[a]&&o[a][e]!==void 0)return o[a][e];if(o.global&&o.global[e]!==void 0)return o.global[e]}_initializeConfig(e){const n={};for(const r in e)n[r]=e[r];this.config={default:{global:n}}}}const INt=new RNt;function NNt(t,e,n){const r=[`${t}`];return e&&r.push(`${r[0]}${e}`),n&&r.push(`${r[r.length-1]}${n}`),r}function cp(t,e,n,r){const i=NNt(t,n,r);for(let a=i.length-1;a>=0;--a){const o=INt.getStyleProperty(i[a],e);if(o!==void 0)return o}}const PNt="color",kNt=Eg.Highlighted,ANt=vi.Active;class qC extends c6{constructor(e,n,r,i,a){super(e,n,r,i,a)}static getDefinedCursor(e,n=!1,r){r||(r=cp(PNt,{},kNt,ANt));const i=LNt(e,n,r);let a=super.getDefinedCursor(i);const o=Number(cp("pointerStrokeWidth",{}));if(!a){const s=DNt(e);s&&(a=VNt(s,i,n,r,o,super.getDefinedCursor("default")),super.setDefinedCursor(i,a))}return a}}function z3e(t,e){const n=Object(e),r=Object.prototype.hasOwnProperty.bind(n);return(t+"").replace(/\{\{(\w+)\}\}/g,(i,a)=>r(a)?n[a]+"":"")}function LNt(t,e,n){return`${e?"pointer":"cursor"}:${t}/${n}`}function VNt(t,e,n,r,i,a){const{x:o,y:s}=t.mousePoint;return new qC($Nt(t,n,{color:r,pointerStrokeWidth:i}),o,s,e,a)}function $Nt(t,e,n){const r=jNt(t,e,n);return`${URL.createObjectURL(r)}#${t.name||"unknown"}-${e?"pointer":"cursor"}`}function jNt(t,e,n){const r=(e?FNt:UNt)(t,n);return new Blob([r],{type:"image/svg+xml"})}function UNt(t,e){const{iconContent:n,iconSize:r,viewBox:i}=t,a=`
    <svg data-icon="cursor" role="img" xmlns="http://www.w3.org/2000/svg"
      width="${r}" height="${r}" viewBox="0 0
      ${i.x} ${i.y}">
      ${n}
    </svg>`;return z3e(a,e)}function FNt(t,e){const{iconContent:n,iconSize:r,viewBox:i,mousePointerGroupString:a}=t,o=r/Math.max(i.x,i.y,1),s=16+r,c=e.pointerStrokeWidth||1,l=`
    <svg data-icon="cursor" role="img" xmlns="http://www.w3.org/2000/svg"
      width="${s}" height="${s}" viewBox="0 0 ${s} ${s}">
      <g stroke-width="${c}">${a}</g>
      <g transform="translate(16, 16) scale(${o})">${n}</g>
    </svg>`;return z3e(l,e)}const Yte=Symbol("ElementCursorsMap");function BNt(t,e){Qw(t)[0]=e,FF(t,e)}function FF(t,e){const n=Qw(t);n[1]=n[0],n[0]=e,t.style.cursor=(e instanceof hl?e:hl.getDefinedCursor("auto")).getStyleProperty()}function rs(t){FF(t,Qw(t)[1])}function ea(t){FF(t,hl.getDefinedCursor("none"))}function Qw(t){let e=Qw[Yte];e instanceof WeakMap||(e=new WeakMap,Object.defineProperty(Qw,Yte,{value:e}));let n=e.get(t);return n||(n=[null,null],e.set(t,n)),n}[...MNt,...ENt];function qy(t){return Tt.toolGroups.find(e=>e.id===t)}const{Active:c5,Passive:ZR,Enabled:QR,Disabled:JR}=vi,zNt=[{mouseButton:ud.Primary}];class BF{constructor(e){this.viewportsInfo=[],this.toolOptions={},this.currentActivePrimaryToolName=null,this.prevActivePrimaryToolName=null,this.restoreToolOptions={},this._toolInstances={},this.id=e}getViewportIds(){return this.viewportsInfo.map(({viewportId:e})=>e)}getViewportsInfo(){return this.viewportsInfo.slice()}getToolInstance(e){const n=this._toolInstances[e];if(!n){console.warn(`'${e}' is not registered with this toolGroup (${this.id}).`);return}return n}getToolInstances(){return this._toolInstances}hasTool(e){return!!this._toolInstances[e]}addTool(e,n={}){const r=Tt.tools[e],i=typeof e<"u"&&e!=="",a=this.toolOptions[e];if(!i){console.warn("Tool with configuration did not produce a toolName: ",n);return}if(!r){console.warn(`'${e}' is not registered with the library. You need to use cornerstoneTools.addTool to register it.`);return}if(a){console.warn(`'${e}' is already registered for ToolGroup ${this.id}.`);return}const{toolClass:o}=r,s={name:e,toolGroupId:this.id,configuration:n},c=new o(s);this._toolInstances[e]=c}addToolInstance(e,n,r={}){let i=Tt.tools[e]?.toolClass;if(!i){const a=Tt.tools[n].toolClass;class o extends a{}o.toolName=e,i=o,Tt.tools[e]={toolClass:o}}this.addTool(i.toolName,r)}addViewport(e,n){if(typeof e!="string")throw new Error("viewportId must be defined and be a string");const r=this._findRenderingEngine(e,n);this.viewportsInfo.some(({viewportId:o})=>o===e)||this.viewportsInfo.push({viewportId:e,renderingEngineId:r});const i=this.getActivePrimaryMouseButtonTool();this.setViewportsCursorByToolName(i);const a={toolGroupId:this.id,viewportId:e,renderingEngineId:r};dt(pt,ge.TOOLGROUP_VIEWPORT_ADDED,a)}removeViewports(e,n){const r=[];if(this.viewportsInfo.forEach((a,o)=>{let s=!1;a.renderingEngineId===e&&(s=!0,n&&a.viewportId!==n&&(s=!1)),s&&r.push(o)}),r.length)for(let a=r.length-1;a>=0;a--)this.viewportsInfo.splice(r[a],1);const i={toolGroupId:this.id,viewportId:n,renderingEngineId:e};dt(pt,ge.TOOLGROUP_VIEWPORT_REMOVED,i)}setActiveStrategy(e,n){const r=this._toolInstances[e];if(r===void 0){console.warn(`Tool ${e} not added to toolGroup, can't set tool configuration.`);return}r.setActiveStrategy(n)}setToolMode(e,n,r={}){if(!e){console.warn("setToolMode: toolName must be defined");return}if(n===vi.Active){this.setToolActive(e,r||this.restoreToolOptions[e]);return}if(n===vi.Passive){this.setToolPassive(e);return}if(n===vi.Enabled){this.setToolEnabled(e);return}if(n===vi.Disabled){this.setToolDisabled(e);return}console.warn("setToolMode: mode must be defined")}setToolActive(e,n={}){const r=this._toolInstances[e];if(r===void 0){console.warn(`Tool ${e} not added to toolGroup, can't set tool mode.`);return}if(!r){console.warn(`'${e}' instance ${r} is not registered with this toolGroup, can't set tool mode.`);return}const i=this.toolOptions[e]?this.toolOptions[e].bindings:[],a=n.bindings?n.bindings:[],s={bindings:[...i,...a].reduce((l,u)=>{const f=u.numTouchPoints!==void 0,d=u.mouseButton!==void 0;return!l.some(h=>eI(h,u))&&(f||d)&&l.push(u),l},[]),mode:c5};if(this.toolOptions[e]=s,this._toolInstances[e].mode=c5,this._hasMousePrimaryButtonBinding(n))this.setViewportsCursorByToolName(e);else if(!this.getActivePrimaryMouseButtonTool()){const u=hl.getDefinedCursor("default");this._setCursorForViewports(u)}this._hasMousePrimaryButtonBinding(n)&&(this.prevActivePrimaryToolName===null?this.prevActivePrimaryToolName=e:this.prevActivePrimaryToolName=this.currentActivePrimaryToolName,this.currentActivePrimaryToolName=e),typeof r.onSetToolActive=="function"&&r.onSetToolActive(),this._renderViewports();const c={toolGroupId:this.id,toolName:e,toolBindingsOptions:n};dt(pt,ge.TOOL_ACTIVATED,c),this._triggerToolModeChangedEvent(e,c5,n)}setToolPassive(e,n){const r=this._toolInstances[e];if(r===void 0){console.warn(`Tool ${e} not added to toolGroup, can't set tool mode.`);return}const i=this.getToolOptions(e),a=Object.assign({bindings:i?i.bindings:[]},i,{mode:ZR}),o=Array.isArray(n?.removeAllBindings)?n.removeAllBindings:this.getDefaultPrimaryBindings();a.bindings=a.bindings.filter(c=>n?.removeAllBindings!==!0&&!o.some(l=>eI(c,l)));let s=ZR;a.bindings.length!==0&&(s=c5,a.mode=s),this.toolOptions[e]=a,r.mode=s,typeof r.onSetToolPassive=="function"&&r.onSetToolPassive(),this._renderViewports(),this._triggerToolModeChangedEvent(e,ZR)}setToolEnabled(e){const n=this._toolInstances[e];if(n===void 0){console.warn(`Tool ${e} not added to toolGroup, can't set tool mode.`);return}const r={bindings:[],mode:QR};this.toolOptions[e]=r,n.mode=QR,typeof n.onSetToolEnabled=="function"&&n.onSetToolEnabled(),this._renderViewports(),this._triggerToolModeChangedEvent(e,QR)}setToolDisabled(e){const n=this._toolInstances[e];if(n===void 0){console.warn(`Tool ${e} not added to toolGroup, can't set tool mode.`);return}const r={bindings:[],mode:JR};this.restoreToolOptions[e]=this.toolOptions[e],this.toolOptions[e]=r,n.mode=JR,typeof n.onSetToolDisabled=="function"&&n.onSetToolDisabled(),this._renderViewports(),this._triggerToolModeChangedEvent(e,JR)}getToolOptions(e){const n=this.toolOptions[e];if(n!==void 0)return n}getActivePrimaryMouseButtonTool(){return Object.keys(this.toolOptions).find(e=>{const n=this.toolOptions[e];return n.mode===c5&&this._hasMousePrimaryButtonBinding(n)})}setViewportsCursorByToolName(e,n){const r=this._getCursor(e,n);this._setCursorForViewports(r)}_getCursor(e,n){let r,i;return n&&(r=`${e}.${n}`,i=qC.getDefinedCursor(r,!0),i)||(r=`${e}`,i=qC.getDefinedCursor(r,!0),i)||(r=e,i=qC.getDefinedCursor(r,!0),i)?i:hl.getDefinedCursor("default")}_setCursorForViewports(e){Oi.getRuntimeSettings().get("useCursors")&&this.viewportsInfo.forEach(({renderingEngineId:r,viewportId:i})=>{const a=C3(i,r);if(!a)return;const{viewport:o}=a;BNt(o.element,e)})}setToolConfiguration(e,n,r){const i=this._toolInstances[e];if(i===void 0)return console.warn(`Tool ${e} not present, can't set tool configuration.`),!1;let a;return r?a=n:a=Object.assign(i.configuration,n),i.configuration=a,typeof i.onSetToolConfiguration=="function"&&i.onSetToolConfiguration(),this._renderViewports(),!0}getDefaultMousePrimary(){return ud.Primary}getDefaultPrimaryBindings(){return zNt}getToolConfiguration(e,n){if(this._toolInstances[e]===void 0){console.warn(`Tool ${e} not present, can't set tool configuration.`);return}const r=TNt(this._toolInstances[e].configuration,n)||this._toolInstances[e].configuration;return rf(r)}getPrevActivePrimaryToolName(){return this.prevActivePrimaryToolName}setActivePrimaryTool(e){const n=this.getCurrentActivePrimaryToolName();this.setToolDisabled(n),this.setToolActive(e,{bindings:[{mouseButton:ud.Primary}]})}getCurrentActivePrimaryToolName(){return this.currentActivePrimaryToolName}clone(e,n=null){let r=qy(e);return r?(console.debug(`ToolGroup ${e} already exists`),r):(r=new BF(e),Tt.toolGroups.push(r),n=n??(()=>!0),Object.keys(this._toolInstances).filter(n).forEach(i=>{const a=this._toolInstances[i],o=this.toolOptions[i],s=a.mode;r.addTool(i),r.setToolMode(i,s,{bindings:o.bindings??[]})}),r)}_hasMousePrimaryButtonBinding(e){const n=this.getDefaultPrimaryBindings();return e?.bindings?.some(r=>n.some(i=>eI(r,i)))}_renderViewports(){this.viewportsInfo.forEach(({renderingEngineId:e,viewportId:n})=>{O1(e).renderViewport(n)})}_triggerToolModeChangedEvent(e,n,r){const i={toolGroupId:this.id,toolName:e,mode:n,toolBindingsOptions:r};dt(pt,ge.TOOL_MODE_CHANGED,i)}_findRenderingEngine(e,n){const r=Ld();if(r?.length===0)throw new Error("No rendering engines found.");if(n)return n;const i=r.filter(a=>a.getViewport(e));if(i.length===0){if(r.length===1)return r[0].id;throw new Error("No rendering engines found that contain the viewport with the same viewportId, you must specify a renderingEngineId.")}if(i.length>1)throw new Error("Multiple rendering engines found that contain the viewport with the same viewportId, you must specify a renderingEngineId.");return i[0].id}}function eI(t,e){return t.mouseButton!==e.mouseButton||t.numTouchPoints!==e.numTouchPoints?!1:t.modifierKey===e.modifierKey}function GNt(t){if(Tt.toolGroups.some(r=>r.id===t)){console.warn(`'${t}' already exists.`);return}const n=new BF(t);return Tt.toolGroups.push(n),n}function Xte(t){const e=Tt.toolGroups.findIndex(n=>n.id===t);e>-1&&Tt.toolGroups.splice(e,1)}function Is(t,e){e||(e=Ld().find(r=>r.getViewports().find(i=>i.id===t))?.id);const n=Tt.toolGroups.filter(r=>r.viewportsInfo.some(i=>i.renderingEngineId===e&&(!i.viewportId||i.viewportId===t)));if(n.length){if(n.length>1)throw new Error(`Multiple tool groups found for renderingEngineId: ${e} and viewportId: ${t}. You should only
      have one tool group per viewport in a renderingEngine.`);return n[0]}}const WNt=[vi.Active,vi.Passive,vi.Enabled];function HNt(t){return Tt.toolGroups.filter(({toolOptions:e})=>{const n=Object.keys(e);for(let r=0;r<n.length;r++)if(t===n[r]&&e[t]&&WNt.includes(e[t].mode))return!0;return!1})}function G3e(t,e){const n=yt(e),{renderingEngine:r,viewportId:i}=n,a=ge.ANNOTATION_ADDED,o={annotation:t,viewportId:i,renderingEngineId:r.id};dt(pt,a,o)}function W3e(t){const{toolName:e}=t.metadata,n=HNt(e);if(!n.length)return;const r=[];n.forEach(o=>{o.viewportsInfo.forEach(s=>{const{renderingEngineId:c,viewportId:l}=s,{FrameOfReferenceUID:u}=C3(l,c);t.metadata.FrameOfReferenceUID===u&&r.push(s)})});const i=ge.ANNOTATION_ADDED,a={annotation:t};if(!r.length){dt(pt,i,a);return}r.forEach(({renderingEngineId:o,viewportId:s})=>{a.viewportId=s,a.renderingEngineId=o,dt(pt,i,a)})}function c9(t){const e=ge.ANNOTATION_REMOVED;dt(pt,e,t)}function ji(t,e,n=na.HandlesUpdated){const r=e&&yt(e),{viewportId:i,renderingEngineId:a}=r||{},o=ge.ANNOTATION_MODIFIED;dt(pt,o,{annotation:t,viewportId:i,renderingEngineId:a,changeType:n})}function Ml(t){H3e({annotation:t})}function zF(t,e=!1){H3e({annotation:t,contourHoleProcessingEnabled:e})}function H3e(t){const e=ge.ANNOTATION_COMPLETED;dt(pt,e,t)}const qNt=Object.freeze(Object.defineProperty({__proto__:null,triggerAnnotationAddedForElement:G3e,triggerAnnotationAddedForFOR:W3e,triggerAnnotationCompleted:Ml,triggerAnnotationModified:ji,triggerAnnotationRemoved:c9,triggerContourAnnotationCompleted:zF},Symbol.toStringTag,{value:"Module"}));let q3e;function Vd(){return q3e}function GF(t){q3e=t}function yf(t,e){const n=Vd(),r=n.getGroupKey(e);return n.getAnnotations(r,t)}function as(t){return Vd().getAnnotation(t)}function K3e(){return Vd().getAllAnnotations()}function l9(t){const{annotationUID:e,parentAnnotationUID:n}=t;if(!n)return;const r=as(n),i=r.childAnnotationUIDs.indexOf(e);r.childAnnotationUIDs.splice(i,1),t.parentAnnotationUID=void 0}function T3(t,e){const{annotationUID:n}=t,{annotationUID:r}=e;l9(e),t.childAnnotationUIDs||(t.childAnnotationUIDs=[]),!t.childAnnotationUIDs.includes(r)&&(t.childAnnotationUIDs.push(r),e.parentAnnotationUID=n)}function Y3e(t){return t.parentAnnotationUID?as(t.parentAnnotationUID):void 0}function u9(t){return t.childAnnotationUIDs?.map(e=>as(e))??[]}function Ao(t,e){t.annotationUID||(t.annotationUID=ya());const n=Vd();if(e instanceof HTMLDivElement){const r=n.getGroupKey(e);n.addAnnotation(t,r),G3e(t,e)}else n.addAnnotation(t,void 0),W3e(t);return t.annotationUID}function KNt(t,e){const n=Vd(),r=n.getGroupKey(e);return n.getNumberOfAnnotations(r,t)}function rc(t){if(!t)return;const e=Vd(),n=e.getAnnotation(t);n&&(n.childAnnotationUIDs?.forEach(r=>rc(r)),e.removeAnnotation(t),c9({annotation:n,annotationManagerUID:e.uid}))}function YNt(){const t=Vd(),e=t.removeAllAnnotations();for(const n of e)c9({annotation:n,annotationManagerUID:t.uid})}function XNt(t,e){const n=Vd(),r=n.getGroupKey(e),i=n.removeAnnotations(r,t);for(const a of i)c9({annotation:a,annotationManagerUID:n.uid})}function X3e(t){let e=t;for(;e;)e.invalidated=!0,e=e.parentAnnotationUID?as(e.parentAnnotationUID):void 0}const ZNt=Object.freeze(Object.defineProperty({__proto__:null,addAnnotation:Ao,addChildAnnotation:T3,clearParentAnnotation:l9,getAllAnnotations:K3e,getAnnotation:as,getAnnotationManager:Vd,getAnnotations:yf,getChildAnnotations:u9,getNumberOfAnnotations:KNt,getParentAnnotation:Y3e,invalidateAnnotation:X3e,removeAllAnnotations:YNt,removeAnnotation:rc,removeAnnotations:XNt,setAnnotationManager:GF},Symbol.toStringTag,{value:"Module"}));function zu(t){const e=t.toolName;if(!e)throw new Error(`No Tool Found for the ToolClass ${t.name}`);Tt.tools[e]||(Tt.tools[e]={toolClass:t})}function f9(t){return!!(t&&Tt.tools[t])}function D1(t,e){const n=e||t.currentTarget,{viewport:r}=yt(n)||{};if(!r)return;const i=ePt(t),a=JNt(t),o=QNt(n,a),s=r.canvasToWorld(o);return{page:a,client:i,canvas:o,world:s}}function QNt(t,e){const n=t.getBoundingClientRect();return[e[0]-n.left-window.pageXOffset,e[1]-n.top-window.pageYOffset]}function JNt(t){return[t.pageX,t.pageY]}function ePt(t){return[t.clientX,t.clientY]}function Z3e(t){const e=t.currentTarget,{viewportId:n,renderingEngineId:r}=yt(e),i=D1(t,e),a={page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]},o={event:t,eventName:ge.MOUSE_DOUBLE_CLICK,viewportId:n,renderingEngineId:r,camera:{},element:e,startPoints:i,lastPoints:i,currentPoints:i,deltaPoints:a};!dt(e,ge.MOUSE_DOUBLE_CLICK,o)&&(t.stopImmediatePropagation(),t.preventDefault())}const Zte=ge.MOUSE_MOVE;function E3(t){const e=t.currentTarget,n=yt(e);if(!n)return;const{renderingEngineId:r,viewportId:i}=n,a=D1(t);!dt(e,Zte,{renderingEngineId:r,viewportId:i,camera:{},element:e,currentPoints:a,eventName:Zte,event:t})&&(t.stopImmediatePropagation(),t.preventDefault())}const{MOUSE_DOWN:Qte,MOUSE_DOWN_ACTIVATE:tPt,MOUSE_CLICK:nPt,MOUSE_UP:rPt,MOUSE_DRAG:Jte}=ge,iPt=400,aPt=150,oPt=3,sPt={mouseButton:void 0,element:null,renderingEngineId:void 0,viewportId:void 0,isClickEvent:!0,clickDelay:200,preventClickTimeout:null,startPoints:{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]},lastPoints:{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]}};let vn={mouseButton:void 0,renderingEngineId:void 0,viewportId:void 0,isClickEvent:!0,clickDelay:200,element:null,preventClickTimeout:null,startPoints:{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]},lastPoints:{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]}};const qa={doubleClickTimeout:null,mouseDownEvent:null,mouseUpEvent:null,ignoreDoubleClick:!1};function Q3e(t){if(qa.doubleClickTimeout){if(t.buttons===qa.mouseDownEvent.buttons)return;qa.mouseDownEvent=t,l6();return}qa.doubleClickTimeout=setTimeout(l6,t.buttons===1?iPt:aPt),qa.mouseDownEvent=t,qa.ignoreDoubleClick=!1,vn.element=t.currentTarget,vn.mouseButton=t.buttons;const e=yt(vn.element),{renderingEngineId:n,viewportId:r}=e;vn.renderingEngineId=n,vn.viewportId=r,vn.preventClickTimeout=setTimeout(lPt,vn.clickDelay),vn.element.removeEventListener("mousemove",E3);const i=D1(t,vn.element);vn.startPoints=Bg(i),vn.lastPoints=Bg(i),document.addEventListener("mouseup",WF),document.addEventListener("mousemove",J3e)}function cPt(t){const e=d9(vn.startPoints,vn.startPoints),n={event:t,eventName:Qte,element:vn.element,mouseButton:vn.mouseButton,renderingEngineId:vn.renderingEngineId,viewportId:vn.viewportId,camera:{},startPoints:vn.startPoints,lastPoints:vn.startPoints,currentPoints:vn.startPoints,deltaPoints:e};vn.lastPoints=Bg(n.lastPoints),dt(n.element,Qte,n)&&dt(n.element,tPt,n)}function J3e(t){if(!yt(vn.element)?.viewport)return;const n=D1(t,vn.element),r=r4e(vn.element,vn.lastPoints),i=d9(n,r);if(qa.doubleClickTimeout)if(t4e(i.canvas))l6();else return;const a={event:t,eventName:Jte,mouseButton:vn.mouseButton,renderingEngineId:vn.renderingEngineId,viewportId:vn.viewportId,camera:{},element:vn.element,startPoints:Bg(vn.startPoints),lastPoints:Bg(r),currentPoints:n,deltaPoints:i};!dt(vn.element,Jte,a)&&(t.stopImmediatePropagation(),t.preventDefault()),vn.lastPoints=Bg(n)}function WF(t){if(clearTimeout(vn.preventClickTimeout),qa.doubleClickTimeout)qa.mouseUpEvent?Ok():(qa.mouseUpEvent=t,vn.element.addEventListener("mousemove",e4e));else{const e=vn.isClickEvent?nPt:rPt,n=D1(t,vn.element),r=d9(n,vn.lastPoints),i={event:t,eventName:e,mouseButton:vn.mouseButton,element:vn.element,renderingEngineId:vn.renderingEngineId,viewportId:vn.viewportId,camera:{},startPoints:Bg(vn.startPoints),lastPoints:Bg(vn.lastPoints),currentPoints:n,deltaPoints:r};dt(i.element,e,i),Ok()}document.removeEventListener("mousemove",J3e)}function e4e(t){const e=D1(t,vn.element),n=r4e(vn.element,vn.lastPoints),r=d9(e,n);t4e(r.canvas)&&(l6(),E3(t))}function t4e(t){return Math.abs(t[0])+Math.abs(t[1])>oPt}function lPt(){vn.isClickEvent=!1}function l6(){qa.ignoreDoubleClick=!0;const t=qa.mouseDownEvent,e=qa.mouseUpEvent;n4e(),cPt(t),e&&WF(e)}function n4e(){qa.doubleClickTimeout&&(clearTimeout(qa.doubleClickTimeout),qa.doubleClickTimeout=null),qa.mouseDownEvent=null,qa.mouseUpEvent=null}function Ok(){document.removeEventListener("mouseup",WF),vn.element?.removeEventListener("mousemove",e4e),vn.element?.addEventListener("mousemove",E3),n4e(),vn=JSON.parse(JSON.stringify(sPt))}function Bg(t){return JSON.parse(JSON.stringify(t))}function r4e(t,e){const{viewport:n}=yt(t)||{};if(!n)return e;const r=n.canvasToWorld(e.canvas);return{page:e.page,client:e.client,canvas:e.canvas,world:r}}function d9(t,e){return!t||!e?{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]}:{page:tI(t.page,e.page),client:tI(t.client,e.client),canvas:tI(t.canvas,e.canvas),world:uPt(t.world,e.world)}}function tI(t,e){return[t[0]-e[0],t[1]-e[1]]}function uPt(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function fPt(){return vn.mouseButton}function i4e(t){qa.ignoreDoubleClick?(qa.ignoreDoubleClick=!1,t.stopImmediatePropagation(),t.preventDefault()):Ok()}function a4e(t){t.removeEventListener("dblclick",Z3e),t.removeEventListener("mousedown",Q3e),t.removeEventListener("mousemove",E3),t.removeEventListener("dblclick",i4e,{capture:!0})}function dPt(t){a4e(t),t.addEventListener("dblclick",Z3e),t.addEventListener("mousedown",Q3e),t.addEventListener("mousemove",E3),t.addEventListener("dblclick",i4e,{capture:!0})}const o4e={enable:dPt,disable:a4e},hPt=2e3,Ky={mouse:0,touch:1};let ene,tne;function s4e(t,e){const n=Date.now();if(t!==ene){if(n-tne<=hPt)return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),!1;ene=t}tne=n}const c4e=s4e.bind(null,Ky.mouse),l4e=s4e.bind(null,Ky.touch);function nne(t,e,n){const r=n?c4e:l4e;e.forEach(function(i){t.addEventListener(i,r,{passive:!1})})}function rne(t,e,n){const r=n?c4e:l4e;e.forEach(function(i){t.removeEventListener(i,r)})}const u4e=["mousedown","mouseup","mousemove"],f4e=["touchstart","touchend"];function d4e(t){rne(t,u4e,Ky.mouse),rne(t,f4e,Ky.touch)}function gPt(t){d4e(t),nne(t,u4e,Ky.mouse),nne(t,f4e,Ky.touch)}const h4e={enable:gPt,disable:d4e};function h9(t,e){const n=e||t.currentTarget,r=t.type==="touchend"?t.changedTouches:t.touches;return Object.keys(r).map(i=>{const a=vPt(r[i]),o=mPt(r[i]),s=pPt(n,o),{viewport:c}=yt(n),l=c.canvasToWorld(s);return{page:o,client:a,canvas:s,world:l,touch:{identifier:i,radiusX:r[i].radiusX,radiusY:r[i].radiusY,force:r[i].force,rotationAngle:r[i].rotationAngle}}})}function pPt(t,e){const n=t.getBoundingClientRect();return[e[0]-n.left-window.pageXOffset,e[1]-n.top-window.pageYOffset]}function mPt(t){return[t.pageX,t.pageY]}function vPt(t){return[t.clientX,t.clientY]}function Dk(t,e){const n=u6(t),r=u6(e);return{page:nI(n.page,r.page),client:nI(n.client,r.client),canvas:nI(n.canvas,r.canvas),world:yPt(n.world,r.world)}}function g4e(t,e){const n=u6(t),r=u6(e);return{page:yy(n.page,r.page),client:yy(n.client,r.client),canvas:yy(n.canvas,r.canvas),world:p4e(n.world,r.world)}}function Mk(t,e){const n=ane(t),r=ane(e);return{page:n.page-r.page,client:n.client-r.client,canvas:n.canvas-r.canvas,world:n.world-r.world}}function ih(t){return JSON.parse(JSON.stringify(t))}function ine(t){return JSON.parse(JSON.stringify(t))}function u6(t){return t.reduce((e,n)=>({page:[e.page[0]+n.page[0]/t.length,e.page[1]+n.page[1]/t.length],client:[e.client[0]+n.client[0]/t.length,e.client[1]+n.client[1]/t.length],canvas:[e.canvas[0]+n.canvas[0]/t.length,e.canvas[1]+n.canvas[1]/t.length],world:[e.world[0]+n.world[0]/t.length,e.world[1]+n.world[1]/t.length,e.world[2]+n.world[2]/t.length]}),{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]})}function md(t){return t.reduce((e,n)=>({page:[e.page[0]+n.page[0]/t.length,e.page[1]+n.page[1]/t.length],client:[e.client[0]+n.client[0]/t.length,e.client[1]+n.client[1]/t.length],canvas:[e.canvas[0]+n.canvas[0]/t.length,e.canvas[1]+n.canvas[1]/t.length],world:[e.world[0]+n.world[0]/t.length,e.world[1]+n.world[1]/t.length,e.world[2]+n.world[2]/t.length],touch:{identifier:null,radiusX:e.touch.radiusX+n.touch.radiusX/t.length,radiusY:e.touch.radiusY+n.touch.radiusY/t.length,force:e.touch.force+n.touch.force/t.length,rotationAngle:e.touch.rotationAngle+n.touch.rotationAngle/t.length}}),{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0],touch:{identifier:null,radiusX:0,radiusY:0,force:0,rotationAngle:0}})}function nI(t,e){return[t[0]-e[0],t[1]-e[1]]}function yPt(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function ane(t){const e=[];for(let n=0;n<t.length;n++)for(let r=0;r<t.length;r++)n<r&&e.push({page:yy(t[n].page,t[r].page),client:yy(t[n].client,t[r].client),canvas:yy(t[n].canvas,t[r].canvas),world:p4e(t[n].world,t[r].world)});return e.reduce((n,r)=>({page:n.page+r.page/e.length,client:n.client+r.client/e.length,canvas:n.canvas+r.canvas/e.length,world:n.world+r.world/e.length}),{page:0,client:0,canvas:0,world:0})}function yy(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))}function p4e(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}Oi.getRuntimeSettings();const{TOUCH_START:one,TOUCH_START_ACTIVATE:xPt,TOUCH_PRESS:sne,TOUCH_DRAG:cne,TOUCH_END:lne,TOUCH_TAP:une,TOUCH_SWIPE:rI}=ge,Jw={page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]},f6={page:0,client:0,canvas:0,world:0},m4e={renderingEngineId:void 0,viewportId:void 0,element:null,startPointsList:[{...Jw,touch:null}],lastPointsList:[{...Jw,touch:null}],isTouchStart:!1,startTime:null,pressTimeout:null,pressDelay:700,pressMaxDistance:5,accumulatedDistance:f6,swipeDistanceThreshold:48,swiped:!1,swipeToleranceMs:300},v4e={renderingEngineId:void 0,viewportId:void 0,element:null,startPointsList:[{...Jw,touch:null}],taps:0,tapTimeout:null,tapMaxDistance:24,tapToleranceMs:300};let Lt=JSON.parse(JSON.stringify(m4e)),ua=JSON.parse(JSON.stringify(v4e));function lp(t,e,n){return dt(t,e,n)}function y4e(t){Lt.element=t.currentTarget;const e=yt(Lt.element),{renderingEngineId:n,viewportId:r}=e;Lt.renderingEngineId=n,Lt.viewportId=r,!Lt.isTouchStart&&(clearTimeout(Lt.pressTimeout),Lt.pressTimeout=setTimeout(()=>wPt(t),Lt.pressDelay),bPt(t),document.addEventListener("touchmove",x4e),document.addEventListener("touchend",w4e))}function wPt(t){if(Lt.accumulatedDistance.canvas>Lt.pressMaxDistance)return;const n={event:t,eventName:sne,renderingEngineId:Lt.renderingEngineId,viewportId:Lt.viewportId,camera:{},element:Lt.element,startPointsList:ih(Lt.startPointsList),lastPointsList:ih(Lt.lastPointsList),startPoints:ine(md(Lt.startPointsList)),lastPoints:ine(md(Lt.lastPointsList))};lp(n.element,sne,n)}function bPt(t){Lt.isTouchStart=!0,Lt.startTime=new Date;const e=h9(t,Lt.element),n=md(e),r=Jw,i=f6,a={event:t,eventName:one,element:Lt.element,renderingEngineId:Lt.renderingEngineId,viewportId:Lt.viewportId,camera:{},startPointsList:e,lastPointsList:e,currentPointsList:e,startPoints:n,lastPoints:n,currentPoints:n,deltaPoints:r,deltaDistance:i};Lt.startPointsList=ih(a.startPointsList),Lt.lastPointsList=ih(a.lastPointsList),lp(a.element,one,a)&&lp(a.element,xPt,a)}function x4e(t){const e=h9(t,Lt.element),n=b4e(Lt.element,Lt.lastPointsList),r=e.length===n.length?Dk(e,n):Jw,i=e.length===n.length?Mk(e,n):f6,a=e.length===n.length?g4e(e,Lt.lastPointsList):f6;Lt.accumulatedDistance={page:Lt.accumulatedDistance.page+a.page,client:Lt.accumulatedDistance.client+a.client,canvas:Lt.accumulatedDistance.canvas+a.canvas,world:Lt.accumulatedDistance.world+a.world};const o={event:t,eventName:cne,renderingEngineId:Lt.renderingEngineId,viewportId:Lt.viewportId,camera:{},element:Lt.element,startPoints:md(Lt.startPointsList),lastPoints:md(n),currentPoints:md(e),startPointsList:ih(Lt.startPointsList),lastPointsList:ih(n),currentPointsList:e,deltaPoints:r,deltaDistance:i};lp(Lt.element,cne,o),CPt(t,r),Lt.lastPointsList=ih(e)}function w4e(t){clearTimeout(Lt.pressTimeout);const e=h9(t,Lt.element),n=b4e(Lt.element,Lt.lastPointsList),r=e.length===n.length?Dk(e,n):Dk(e,e),i=e.length===n.length?Mk(e,n):Mk(e,e),a={event:t,eventName:lne,element:Lt.element,renderingEngineId:Lt.renderingEngineId,viewportId:Lt.viewportId,camera:{},startPointsList:ih(Lt.startPointsList),lastPointsList:ih(n),currentPointsList:e,startPoints:md(Lt.startPointsList),lastPoints:md(n),currentPoints:md(e),deltaPoints:r,deltaDistance:i};lp(a.element,lne,a),SPt(t),Lt=JSON.parse(JSON.stringify(m4e)),document.removeEventListener("touchmove",x4e),document.removeEventListener("touchend",w4e)}function SPt(t){const e=new Date().getTime(),n=Lt.startTime.getTime();if(e-n>ua.tapToleranceMs||(ua.taps===0&&(ua.element=Lt.element,ua.renderingEngineId=Lt.renderingEngineId,ua.viewportId=Lt.viewportId,ua.startPointsList=Lt.startPointsList),ua.taps>0&&!(ua.element==Lt.element&&ua.renderingEngineId==Lt.renderingEngineId&&ua.viewportId==Lt.viewportId)))return;const r=h9(t,ua.element);g4e(r,ua.startPointsList).canvas>ua.tapMaxDistance||(clearTimeout(ua.tapTimeout),ua.taps+=1,ua.tapTimeout=setTimeout(()=>{const a={event:t,eventName:une,element:ua.element,renderingEngineId:ua.renderingEngineId,viewportId:ua.viewportId,camera:{},currentPointsList:r,currentPoints:md(r),taps:ua.taps};lp(a.element,une,a),ua=JSON.parse(JSON.stringify(v4e))},ua.tapToleranceMs))}function CPt(t,e){const n=new Date().getTime(),r=Lt.startTime.getTime();if(Lt.swiped||n-r>Lt.swipeToleranceMs)return;const[i,a]=e.canvas,o={event:t,eventName:rI,renderingEngineId:Lt.renderingEngineId,viewportId:Lt.viewportId,camera:{},element:Lt.element,swipe:null};Math.abs(i)>Lt.swipeDistanceThreshold&&(o.swipe=i>0?qv.RIGHT:qv.LEFT,lp(o.element,rI,o),Lt.swiped=!0),Math.abs(a)>Lt.swipeDistanceThreshold&&(o.swipe=a>0?qv.DOWN:qv.UP,lp(o.element,rI,o),Lt.swiped=!0)}function b4e(t,e){const{viewport:n}=yt(t);return e.map(r=>{const i=n.canvasToWorld(r.canvas);return{page:r.page,client:r.client,canvas:r.canvas,world:i,touch:r.touch}})}function S4e(t){h4e.disable(t),t.removeEventListener("touchstart",y4e)}function _Pt(t){S4e(t),h4e.enable(t),t.addEventListener("touchstart",y4e,{passive:!1})}const C4e={enable:_Pt,disable:S4e},fne=10,dne=40,hne=800;function TPt(t){let e=0,n=0,r=0,i=0;return"detail"in t&&(n=t.detail),"wheelDelta"in t&&(n=-t.wheelDelta/120),"wheelDeltaY"in t&&(n=-t.wheelDeltaY/120),"wheelDeltaX"in t&&(e=-t.wheelDeltaX/120),r=e*fne,i=n*fne,"deltaY"in t&&(i=t.deltaY),"deltaX"in t&&(r=t.deltaX),(r||i)&&t.deltaMode&&(t.deltaMode===1?(r*=dne,i*=dne):(r*=hne,i*=hne)),r&&!e&&(e=r<1?-1:1),i&&!n&&(n=i<1?-1:1),{spinX:e,spinY:n,pixelX:r,pixelY:i}}function _4e(t){const e=t.currentTarget,n=yt(e),{renderingEngineId:r,viewportId:i}=n;if(t.deltaY>-1&&t.deltaY<1)return;t.preventDefault();const{spinX:a,spinY:o,pixelX:s,pixelY:c}=TPt(t),l=o<0?-1:1,u={event:t,eventName:ge.MOUSE_WHEEL,renderingEngineId:r,viewportId:i,element:e,camera:{},detail:t,wheel:{spinX:a,spinY:o,pixelX:s,pixelY:c,direction:l},points:D1(t)};dt(e,ge.MOUSE_WHEEL,u)}function EPt(t){T4e(t),t.addEventListener("wheel",_4e,{passive:!1})}function T4e(t){t.removeEventListener("wheel",_4e)}const E4e={enable:EPt,disable:T4e},OPt={renderingEngineId:void 0,viewportId:void 0,key:void 0,keyCode:void 0,element:null};let Da={renderingEngineId:void 0,viewportId:void 0,key:void 0,keyCode:void 0,element:null};function g9(t){Da.element=t.currentTarget;const e=yt(Da.element),{renderingEngineId:n,viewportId:r}=e;Da.renderingEngineId=n,Da.viewportId=r,Da.key=t.key,Da.keyCode=t.keyCode,t.preventDefault();const i={renderingEngineId:Da.renderingEngineId,viewportId:Da.viewportId,element:Da.element,key:Da.key,keyCode:Da.keyCode};dt(i.element,ge.KEY_DOWN,i),document.addEventListener("keyup",O4e),document.addEventListener("visibilitychange",HF),Da.element.removeEventListener("keydown",g9)}function HF(){document.removeEventListener("visibilitychange",HF),document.visibilityState==="hidden"&&D4e()}function O4e(t){const e={renderingEngineId:Da.renderingEngineId,viewportId:Da.viewportId,element:Da.element,key:Da.key,keyCode:Da.keyCode};document.removeEventListener("keyup",O4e),document.removeEventListener("visibilitychange",HF),Da.element.addEventListener("keydown",g9),Da=structuredClone(OPt),dt(e.element,ge.KEY_UP,e)}function DPt(){return Da.keyCode}function D4e(){Da.keyCode=void 0}function MPt(t){M4e(t),t.addEventListener("keydown",g9)}function M4e(t){t.removeEventListener("keydown",g9)}const U2={enable:MPt,disable:M4e,getModifierKey:DPt},qF=new Map,RPt=t=>{const e=qF.get(t);e&&(e.isDirty=!0)},IPt=t=>{const e=qF.get(t);return e&&!e.isDirty?e.indices:null},NPt=(t,e)=>{qF.set(t,{indices:e,isDirty:!1})};function p9(t,e,n){const r={segmentationId:t,modifiedSlicesToUse:e,segmentIndex:n};RPt(t),dt(pt,ge.SEGMENTATION_DATA_MODIFIED,r)}function m9(t){const e={segmentationId:t};dt(pt,ge.SEGMENTATION_MODIFIED,e)}function PPt(t){const e={segmentationId:t};dt(pt,ge.SEGMENTATION_REMOVED,e)}function GS(t,e,n){const r={segmentationId:e,type:n,viewportId:t};dt(pt,ge.SEGMENTATION_REPRESENTATION_MODIFIED,r)}function gne(t,e,n){const r={viewportId:t,segmentationId:e,type:n};dt(pt,ge.SEGMENTATION_REPRESENTATION_REMOVED,r)}const kPt={renderOutline:!0,outlineWidthAutoGenerated:3,outlineWidth:1,outlineWidthInactive:1,outlineOpacity:1,outlineOpacityInactive:.85,outlineDash:void 0,outlineDashInactive:void 0,outlineDashAutoGenerated:"5,3",activeSegmentOutlineWidthDelta:0,renderFill:!0,fillAlpha:.5,fillAlphaInactive:.3,fillAlphaAutoGenerated:.3};function APt(){return kPt}const LPt={renderOutline:!0,renderOutlineInactive:!0,outlineWidth:3,outlineWidthInactive:2,activeSegmentOutlineWidthDelta:0,renderFill:!0,renderFillInactive:!0,fillAlpha:.5,fillAlphaInactive:.4,outlineOpacity:1,outlineOpacityInactive:.85};function VPt(){return LPt}class $Pt{constructor(){this.config={global:{},segmentations:{},viewportsStyle:{}}}setStyle(e,n){const{viewportId:r,segmentationId:i,type:a,segmentIndex:o}=e,s=this.getStyle(e);let c;if(!r&&!i?c={...s,...n}:c=this.copyActiveToInactiveIfNotProvided({...s,...n},a),!a)throw new Error("Type is required to set a style");if(r){this.config.viewportsStyle[r]||(this.config.viewportsStyle[r]={renderInactiveSegmentations:!1,representations:{}});const l=this.config.viewportsStyle[r].representations;if(i){l[i]||(l[i]={}),l[i][a]||(l[i][a]={});const u=l[i][a];o!==void 0?(u.perSegment||(u.perSegment={}),u.perSegment[o]=c):u.allSegments=c}else{const u="__allSegmentations__";l[u]||(l[u]={}),l[u][a]||(l[u][a]={}),l[u][a].allSegments=c}}else if(i){this.config.segmentations[i]||(this.config.segmentations[i]={}),this.config.segmentations[i][a]||(this.config.segmentations[i][a]={});const l=this.config.segmentations[i][a];o!==void 0?(l.perSegment||(l.perSegment={}),l.perSegment[o]=c):l.allSegments=c}else this.config.global[a]=c}copyActiveToInactiveIfNotProvided(e,n){const r={...e};if(n===Dn.Labelmap){const i=r;i.renderOutlineInactive??=i.renderOutline,i.outlineWidthInactive??=i.outlineWidth,i.renderFillInactive??=i.renderFill,i.fillAlphaInactive??=i.fillAlpha,i.outlineOpacityInactive??=i.outlineOpacity}else if(n===Dn.Contour){const i=r;i.outlineWidthInactive??=i.outlineWidth,i.outlineOpacityInactive??=i.outlineOpacity,i.outlineDashInactive??=i.outlineDash,i.renderOutlineInactive??=i.renderOutline,i.renderFillInactive??=i.renderFill,i.fillAlphaInactive??=i.fillAlpha}return r}getStyle(e){const{viewportId:n,segmentationId:r,type:i,segmentIndex:a}=e;let o=this.getDefaultStyle(i);if(this.config.global[i]&&(o={...o,...this.config.global[i]}),this.config.segmentations[r]?.[i]&&(o={...o,...this.config.segmentations[r][i].allSegments},a!==void 0&&this.config.segmentations[r][i].perSegment?.[a]&&(o={...o,...this.config.segmentations[r][i].perSegment[a]})),n&&this.config.viewportsStyle[n]){this.config.viewportsStyle[n].renderInactiveSegmentations;const s="__allSegmentations__";this.config.viewportsStyle[n].representations[s]?.[i]&&(o={...o,...this.config.viewportsStyle[n].representations[s][i].allSegments}),r&&this.config.viewportsStyle[n].representations[r]?.[i]&&(o={...o,...this.config.viewportsStyle[n].representations[r][i].allSegments},a!==void 0&&this.config.viewportsStyle[n].representations[r][i].perSegment?.[a]&&(o={...o,...this.config.viewportsStyle[n].representations[r][i].perSegment[a]}))}return o}getRenderInactiveSegmentations(e){return this.config.viewportsStyle[e]?.renderInactiveSegmentations}setRenderInactiveSegmentations(e,n){this.config.viewportsStyle[e]||(this.config.viewportsStyle[e]={renderInactiveSegmentations:!1,representations:{}}),this.config.viewportsStyle[e].renderInactiveSegmentations=n}getDefaultStyle(e){switch(e){case Dn.Labelmap:return VPt();case Dn.Contour:return APt();case Dn.Surface:return{};default:throw new Error(`Unknown representation type: ${e}`)}}clearSegmentationStyle(e){this.config.segmentations[e]&&delete this.config.segmentations[e]}clearAllSegmentationStyles(){this.config.segmentations={}}clearViewportStyle(e){this.config.viewportsStyle[e]&&delete this.config.viewportsStyle[e]}clearAllViewportStyles(){for(const e in this.config.viewportsStyle){const r=this.config.viewportsStyle[e].renderInactiveSegmentations;this.config.viewportsStyle[e]={renderInactiveSegmentations:r,representations:{}}}}resetToGlobalStyle(){this.clearAllSegmentationStyles(),this.clearAllViewportStyles()}hasCustomStyle(e){const{type:n}=e,r=this.getStyle(e),i=this.getDefaultStyle(n);return!A3e(r,i)}}const xy=new $Pt;function jPt(t){const e={segmentationId:t};dt(pt,ge.SEGMENTATION_ADDED,e)}const pne={colorLUT:[],segmentations:[],viewportSegRepresentations:{}};class UPt{constructor(e){this._stackLabelmapImageIdReferenceMap=new Map,this._labelmapImageIdReferenceMap=new Map,e||=ya(),this.state=Object.freeze(rf(pne)),this.uid=e}getState(){return this.state}updateState(e){const n=rf(this.state);e(n),this.state=Object.freeze(n)}getColorLUT(e){return this.state.colorLUT[e]}getNextColorLUTIndex(){return this.state.colorLUT.length}resetState(){this._stackLabelmapImageIdReferenceMap.clear(),this._labelmapImageIdReferenceMap.clear(),this.state=Object.freeze(rf(pne))}getSegmentation(e){return this.state.segmentations.find(n=>n.segmentationId===e)}updateSegmentation(e,n){this.updateState(r=>{const i=r.segmentations.find(a=>a.segmentationId===e);if(!i){console.warn(`Segmentation with id ${e} not found. Update aborted.`);return}Object.assign(i,n)}),m9(e)}addSegmentation(e){if(this.getSegmentation(e.segmentationId))throw new Error(`Segmentation with id ${e.segmentationId} already exists`);this.updateState(n=>{const r=rf(e);if(r.representationData.Labelmap&&"volumeId"in r.representationData.Labelmap&&!("imageIds"in r.representationData.Labelmap)){const i=this.getLabelmapImageIds(r.representationData);r.representationData.Labelmap.imageIds=i}n.segmentations.push(r)}),jPt(e.segmentationId)}removeSegmentation(e){this.updateState(n=>{const r=n.segmentations.filter(i=>i.segmentationId!==e);n.segmentations.splice(0,n.segmentations.length,...r)}),PPt(e)}addSegmentationRepresentation(e,n,r,i){if(!Ai(e))return;if(this.getSegmentationRepresentations(e,{type:r,segmentationId:n}).length>0){console.debug("A segmentation representation of type",r,"already exists in viewport",e,"for segmentation",n);return}this.updateState(s=>{s.viewportSegRepresentations[e]||(s.viewportSegRepresentations[e]=[],xy.setRenderInactiveSegmentations(e,!0)),r!==Dn.Labelmap?this.addDefaultSegmentationRepresentation(s,e,n,r,i):this.addLabelmapRepresentation(s,e,n,i)}),GS(e,n,r)}addDefaultSegmentationRepresentation(e,n,r,i,a){const o=e.segmentations.find(c=>c.segmentationId===r);if(!o)return;const s={};Object.keys(o.segments).forEach(c=>{s[Number(c)]={visible:!0}}),e.viewportSegRepresentations[n].push({segmentationId:r,type:i,active:!0,visible:!0,colorLUTIndex:a?.colorLUTIndex||0,segments:s,config:{...mne(i),...a}}),this._setActiveSegmentation(e,n,r)}addLabelmapRepresentation(e,n,r,i=mne(Dn.Labelmap)){if(!Ai(n))return;const o=this.getSegmentation(r);if(!o)return;const{representationData:s}=o;if(!s.Labelmap)return this.addDefaultSegmentationRepresentation(e,n,r,Dn.Labelmap,i);this.processLabelmapRepresentationAddition(n,r),this.addDefaultSegmentationRepresentation(e,n,r,Dn.Labelmap,i)}async processLabelmapRepresentationAddition(e,n){const r=Ai(e);if(!r)return;const i=this.getSegmentation(n);if(!i)return;const a=r.viewport instanceof Tu,{representationData:o}=i,s="volumeId"in o.Labelmap;r.viewport,!a&&!s&&this.updateLabelmapSegmentationImageReferences(e,i.segmentationId)}_updateLabelmapSegmentationReferences(e,n,r,i){const a=n.getCurrentImageId();let o=!1;for(const s of r)n.isReferenceViewable({referencedImageId:s},{asOverlay:!0})&&(o=!0,this._stackLabelmapImageIdReferenceMap.get(e).set(a,s),this._updateLabelmapImageIdReferenceMap({segmentationId:e,referenceImageId:a,labelmapImageId:s}));return i&&i(n,e,r),o?this._stackLabelmapImageIdReferenceMap.get(e).get(a):void 0}updateLabelmapSegmentationImageReferences(e,n){const r=this.getSegmentation(n);if(!r)return;this._stackLabelmapImageIdReferenceMap.has(n)||this._stackLabelmapImageIdReferenceMap.set(n,new Map);const{representationData:i}=r;if(!i.Labelmap)return;const a=this.getLabelmapImageIds(i),s=Ai(e).viewport;return this._updateLabelmapSegmentationReferences(n,s,a,null)}_updateAllLabelmapSegmentationImageReferences(e,n){const r=this.getSegmentation(n);if(!r)return;this._stackLabelmapImageIdReferenceMap.has(n)||this._stackLabelmapImageIdReferenceMap.set(n,new Map);const{representationData:i}=r;if(!i.Labelmap)return;const a=this.getLabelmapImageIds(i),s=Ai(e).viewport;this._updateLabelmapSegmentationReferences(n,s,a,(c,l,u)=>{c.getImageIds().forEach((d,h)=>{for(const m of u)c.isReferenceViewable({referencedImageId:m,sliceIndex:h},{asOverlay:!0,withNavigation:!0})&&(this._stackLabelmapImageIdReferenceMap.get(l).set(d,m),this._updateLabelmapImageIdReferenceMap({segmentationId:l,referenceImageId:d,labelmapImageId:m}))})})}getLabelmapImageIds(e){const n=e.Labelmap;let r;if(n.imageIds)r=n.imageIds;else if(!r&&n.volumeId){const i=n.volumeId;r=Ct.getVolume(i).imageIds}return r}getLabelmapImageIdsForImageId(e,n){const r=this._generateMapKey({segmentationId:n,referenceImageId:e});return this._labelmapImageIdReferenceMap.get(r)}getCurrentLabelmapImageIdsForViewport(e,n){const r=Ai(e);if(!r)return;const a=r.viewport.getCurrentImageId();return this.getLabelmapImageIdsForImageId(a,n)}getCurrentLabelmapImageIdForViewport(e,n){const r=Ai(e);if(!r||!this._stackLabelmapImageIdReferenceMap.has(n))return;const a=r.viewport.getCurrentImageId();return this._stackLabelmapImageIdReferenceMap.get(n).get(a)}getStackSegmentationImageIdsForViewport(e,n){if(!this.getSegmentation(n))return[];this._updateAllLabelmapSegmentationImageReferences(e,n);const{viewport:i}=Ai(e),a=i.getImageIds(),o=this._stackLabelmapImageIdReferenceMap.get(n);return a.map(s=>o.get(s))}removeSegmentationRepresentationsInternal(e,n){const r=[];return this.updateState(i=>{if(!i.viewportSegRepresentations[e])return;const a=i.viewportSegRepresentations[e];let o=!1;if(!n||Object.values(n).every(s=>s===void 0))r.push(...a),delete i.viewportSegRepresentations[e];else{const{segmentationId:s,type:c}=n;i.viewportSegRepresentations[e]=a.filter(l=>{const u=s&&c&&l.segmentationId===s&&l.type===c||s&&!c&&l.segmentationId===s||!s&&c&&l.type===c;return u&&(r.push(l),l.active&&(o=!0)),!u}),i.viewportSegRepresentations[e].length===0?delete i.viewportSegRepresentations[e]:o&&(i.viewportSegRepresentations[e][0].active=!0)}}),r}removeSegmentationRepresentations(e,n){const r=this.removeSegmentationRepresentationsInternal(e,n);r.forEach(a=>{gne(e,a.segmentationId,a.type)});const i=this.getSegmentationRepresentations(e);return i.length>0&&i[0].active&&GS(e,i[0].segmentationId,i[0].type),r}removeSegmentationRepresentation(e,n,r){const i=this.removeSegmentationRepresentationsInternal(e,n);return r||i.forEach(({segmentationId:a,type:o})=>{gne(e,a,o)}),i}_updateLabelmapImageIdReferenceMap({segmentationId:e,referenceImageId:n,labelmapImageId:r}){const i=this._generateMapKey({segmentationId:e,referenceImageId:n});if(!this._labelmapImageIdReferenceMap.has(i)){this._labelmapImageIdReferenceMap.set(i,[r]);return}const a=this._labelmapImageIdReferenceMap.get(i),o=Array.from(new Set([...a,r]));this._labelmapImageIdReferenceMap.set(i,o)}_setActiveSegmentation(e,n,r){const i=e.viewportSegRepresentations[n];i&&i.forEach(a=>{a.active=a.segmentationId===r})}setActiveSegmentation(e,n){this.updateState(r=>{const i=r.viewportSegRepresentations[e];i&&i.forEach(a=>{a.active=a.segmentationId===n})}),GS(e,n)}getActiveSegmentation(e){if(!this.state.viewportSegRepresentations[e])return;const n=this.state.viewportSegRepresentations[e].find(r=>r.active);if(n)return this.getSegmentation(n.segmentationId)}getSegmentationRepresentations(e,n={}){const r=this.state.viewportSegRepresentations[e];return r?!n.type&&!n.segmentationId?r:r.filter(i=>{const a=n.type?i.type===n.type:!0,o=n.segmentationId?i.segmentationId===n.segmentationId:!0;return a&&o}):[]}getSegmentationRepresentation(e,n){return this.getSegmentationRepresentations(e,n)[0]}getSegmentationRepresentationVisibility(e,n){return this.getSegmentationRepresentation(e,n)?.visible}setSegmentationRepresentationVisibility(e,n,r){this.updateState(i=>{const a=this.getSegmentationRepresentations(e,n);a&&a.forEach(o=>{o.visible=r,Object.entries(o.segments).forEach(([s,c])=>{c.visible=r})})}),GS(e,n.segmentationId,n.type)}addColorLUT(e,n){this.updateState(r=>{r.colorLUT[n]&&console.warn("Color LUT table already exists, overwriting"),r.colorLUT[n]=rf(e)})}removeColorLUT(e){this.updateState(n=>{delete n.colorLUT[e]})}_getStackIdForImageIds(e){return e.map(n=>n.slice(-Math.round(n.length*.15))).join("_")}getAllViewportSegmentationRepresentations(){return Object.entries(this.state.viewportSegRepresentations).map(([e,n])=>({viewportId:e,representations:n}))}getSegmentationRepresentationsBySegmentationId(e){const n=[];return Object.entries(this.state.viewportSegRepresentations).forEach(([r,i])=>{const a=i.filter(o=>o.segmentationId===e);a.length>0&&n.push({viewportId:r,representations:a})}),n}_generateMapKey({segmentationId:e,referenceImageId:n}){return`${e}-${n}`}}function mne(t){const e=yh.newInstance(),n=l1.newInstance();return n.addPoint(0,0),t===Dn.Labelmap?{cfun:e,ofun:n}:{}}const $d=new UPt("DEFAULT");function Vm(t,e={}){return $d.getSegmentationRepresentations(t,e)}function FPt(t,e){const n=$d;if(!e.segmentationId||!e.type)throw new Error("getSegmentationRepresentation: No segmentationId or type provided, you need to provide at least one of them");return n.getSegmentationRepresentations(t,e)?.[0]}function BPt(t,e){const n=yt(t),{viewport:r}=n,a=r.getActors().filter(o=>o.representationUID&&typeof o.representationUID=="string"&&o.representationUID.startsWith(e));r.removeActors(a.map(o=>o.uid))}function R4e(t,e,n){const r=Ai(t);if(!r)return;const{renderingEngine:i,viewport:a}=r;if(!i||!a)return;const s=a.getActors().filter(n);return s.length>0?s[0]:void 0}function zPt(t,e){const n=Ai(t);if(!n)return;const{renderingEngine:r,viewport:i}=n;if(!r||!i)return;const o=i.getActors().filter(e);return o.length>0?o:void 0}function GPt(t,e){return WPt(t,e)?.uid}function ew(t,e){return zPt(t,n=>n.representationUID?.startsWith(`${e}-${Dn.Labelmap}`))}function WPt(t,e){return R4e(t,e,n=>n.representationUID?.startsWith(`${e}-${Dn.Labelmap}`))}function HPt(t,e,n){return R4e(t,e,r=>r.representationUID===I4e(e,n))}function I4e(t,e){return`${t}-${Dn.Surface}-${e}`}function qPt(t,e,n){const r=yt(t),{viewport:i}=r,o=HPt(i.id,n,e.segmentIndex)?.actor,s=e.visible;if(o){if(o.setVisibility(s),!s)return;const x=o.getMapper(),S=x.getInputData(),C=e.points,_=e.polys,T=S.getPoints().getData(),O=S.getPolys().getData();if(C.length===T.length&&_.length===O.length)return;const M=nh.newInstance();M.getPoints().setData(C,3);const I=f1.newInstance({values:Float32Array.from(_)});M.setPolys(I),x.setInputData(M),x.modified(),i.getRenderer().resetCameraClippingRange();return}const c=e.points,l=e.polys,u=e.color,f=nh.newInstance();f.getPoints().setData(c,3);const d=f1.newInstance({values:Float32Array.from(l)});f.setPolys(d);const h=hbe.newInstance({});let m;h.setInputData(f);const p=gDt.newInstance();p.setMapper(h),p.getProperty().setColor(u[0]/255,u[1]/255,u[2]/255),p.getProperty().setLineWidth(2);const y=I4e(n,e.segmentIndex);i.addActor({uid:ya(),actor:p,clippingFilter:m,representationUID:y}),i.resetCamera(),i.getRenderer().resetCameraClippingRange(),i.render()}function zc(t){return $d.getSegmentation(t)}function KF(t){return $d.getColorLUT(t)}let Rk={};function KPt(t){Rk=t}let vne=!1;function ah(){if(!Rk.addons?.polySeg)return console.warn("PolySeg add-on not configured. This will prevent automatic conversion between segmentation representations (labelmap, contour, surface). To enable these features, install @cornerstonejs/polymorphic-segmentation and register it during initialization: cornerstoneTools.init({ addons: { polySeg } })."),null;const t=Rk.addons.polySeg;return vne||(t.init(),vne=!0),t}function YPt({segmentationId:t,type:e,data:n}){const r=zc(t);if(!r)throw new Error(`Segmentation ${t} not found`);switch(r.representationData[e]&&console.warn(`Representation data of type ${e} already exists for segmentation ${t}, overwriting it.`),e){case Dn.Labelmap:n&&(r.representationData[e]=n);break;case Dn.Contour:n&&(r.representationData[e]=n);break;case Dn.Surface:n&&(r.representationData[e]=n);break;default:throw new Error(`Invalid representation type ${e}`)}}function N4e(t){const e=typeof t;return t!==null&&(e==="object"||e==="function")}function P4e(t,e,n){let r,i,a,o,s,c,l=0,u=!1,f=!1,d=!0;const h=!e&&e!==0&&typeof window.requestAnimationFrame=="function";if(typeof t!="function")throw new TypeError("Expected a function");e=Number(e)||0,N4e(n)&&(u=!!n.leading,f="maxWait"in n,a=f?Math.max(Number(n.maxWait)||0,e):a,d="trailing"in n?!!n.trailing:d);function m(k){const L=r,$=i;return r=i=void 0,l=k,o=t.apply($,L),o}function p(k,L){return h?window.requestAnimationFrame(k):setTimeout(k,L)}function y(k){if(h)return window.cancelAnimationFrame(k);clearTimeout(k)}function x(k){return l=k,s=p(_,e),u?m(k):o}function S(k){const L=k-c,$=k-l,W=e-L;return f?Math.min(W,a-$):W}function C(k){const L=k-c,$=k-l;return c===void 0||L>=e||L<0||f&&$>=a}function _(){const k=Date.now();if(C(k))return T(k);s=p(_,S(k))}function T(k){return s=void 0,d&&r?m(k):(r=i=void 0,o)}function O(){s!==void 0&&y(s),l=0,r=c=i=s=void 0}function M(){return s===void 0?o:T(Date.now())}function I(){return s!==void 0}function V(...k){const L=Date.now(),$=C(L);if(r=k,i=this,c=L,$){if(s===void 0)return x(c);if(f)return s=p(_,e),m(c)}return s===void 0&&(s=p(_,e)),o}return V.cancel=O,V.flush=M,V.pending=I,V}const KC=new Map;async function YF(t,e,n,r,i){const a=await n();YPt({segmentationId:t,type:e,data:a}),i?.(),KC.has(t)||KC.set(t,[]);const o=KC.get(t);return o.includes(e)||o.push(e),XPt(r),m9(t),a}function XPt(t){const e=n=>{ZPt(n,t)};t._debouncedUpdateFunction=e,pt.removeEventListener(ge.SEGMENTATION_DATA_MODIFIED,t._debouncedUpdateFunction),pt.addEventListener(ge.SEGMENTATION_DATA_MODIFIED,t._debouncedUpdateFunction)}const ZPt=P4e((t,e)=>{const n=t.detail.segmentationId,r=KC.get(n);!r||!r.length||(e(n),r.length&&m9(n))},300);function XF(t,e){const n=FPt(t,e);return n?Object.entries(n.segments).reduce((i,[a,o])=>(o.visible||i.add(Number(a)),i),new Set):new Set}function QPt(t,e,n=!1){const r=Ai(t);if(!r)return;const{viewport:i}=r;BPt(i.element,e),n&&i.render()}async function JPt(t,e){const{segmentationId:n,type:r}=e,i=zc(n);if(!i)return;let a=i.representationData[Dn.Surface];if(!a&&ah()?.canComputeRequestedRepresentation(n,Dn.Surface)){const l=ah();if(a=await YF(n,Dn.Surface,()=>l.computeSurfaceData(n,{viewport:t}),()=>l.updateSurfaceData(n,{viewport:t})),!a)throw new Error(`No Surface data found for segmentationId ${n} even we tried to compute it`)}else!a&&!ah()&&console.debug(`No surface data found for segmentationId ${n} and PolySeg add-on is not configured. Unable to convert from other representations to surface. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);if(!a){console.warn(`No Surface data found for segmentationId ${n}. Skipping render.`);return}const{geometryIds:o}=a;o?.size||console.warn(`No Surfaces found for segmentationId ${n}. Skipping render.`);const{colorLUTIndex:s}=e,c=KF(s);o.forEach(l=>{const u=Ct.getGeometry(l);if(!u?.data){console.warn(`No Surfaces found for geometryId ${l}. Skipping render.`);return}const{segmentIndex:f}=u.data,h=XF(t.id,{segmentationId:n,type:r}).has(f),m=u.data,p=c[f];m.color=p.slice(0,3),m.visible=!h,qPt(t.element,m,n)}),t.render()}const ekt={render:JPt,removeRepresentation:QPt};function tkt(t,e,n){const r=t.getImageIds();if(!r||!r.length)return;const i=r.map(a=>{const{imagePositionPatient:o}=Ot("imagePlaneModule",a),s=nkt(e,o,n);return{imageId:a,distance:s}});return i.sort((a,o)=>a.distance-o.distance),i[0].imageId}function nkt(t,e,n){const r=ut();yr(r,t,e);const i=Vt(r,n);return Math.abs(i)}function rkt(t,e){const{segmentation:n}=t.data,{segmentation:r}=e.data;return n.segmentationId===r.segmentationId&&n.segmentIndex===r.segmentIndex}class ikt{constructor(e){this.getGroupKey=n=>{if(typeof n=="string")return n;const i=yt(n);if(!i)throw new Error("Element not enabled, you must have an enabled element if you are not providing a FrameOfReferenceUID");return i.FrameOfReferenceUID},this._imageVolumeModifiedHandler=n=>{const r=n.detail,{FrameOfReferenceUID:i}=r,o=this.annotations[i];o&&Object.keys(o).forEach(s=>{o[s].forEach(l=>{l.invalidated!==void 0&&(l.invalidated=!0)})})},this.getFramesOfReference=()=>Object.keys(this.annotations),this.getAnnotations=(n,r)=>{const i=this.annotations;return i[n]?r?i[n][r]?i[n][r]:[]:i[n]:[]},this.getAnnotation=n=>{const r=this.annotations;for(const i in r){const a=r[i];for(const o in a){const s=a[o];for(const c of s)if(n===c.annotationUID)return c}}},this.getNumberOfAnnotations=(n,r)=>{const i=this.getAnnotations(n,r);if(!i.length)return 0;if(r)return i.length;let a=0;for(const o in i)a+=i[o].length;return a},this.addAnnotation=(n,r)=>{const{metadata:i}=n,{FrameOfReferenceUID:a,toolName:o}=i;r=r||a;const s=this.annotations;let c=s[r];c||(s[r]={},c=s[r]);let l=c[o];l||(c[o]=[],l=c[o]),this.preprocessingFn&&(n=this.preprocessingFn(n)),l.push(n)},this.removeAnnotation=n=>{const{annotations:r}=this;for(const i in r){const a=r[i];for(const o in a){const s=a[o],c=s.findIndex(l=>l.annotationUID===n);c!==-1&&(s.splice(c,1),s.length===0&&delete a[o])}Object.keys(a).length===0&&delete r[i]}},this.removeAnnotations=(n,r)=>{const i=this.annotations,a=[];if(!i[n])return a;if(r){const o=i[n][r];if(o)for(const s of o)this.removeAnnotation(s.annotationUID),a.push(s)}else for(const o in i[n]){const s=i[n][o];for(const c of s)this.removeAnnotation(c.annotationUID),a.push(c)}return a},this.saveAnnotations=(n,r)=>{const i=this.annotations;if(n&&r){const a=i[n];if(!a)return;const o=a[r];return structuredClone(o)}else if(n){const a=i[n];return structuredClone(a)}return structuredClone(i)},this.restoreAnnotations=(n,r,i)=>{const a=this.annotations;if(r&&i){let o=a[r];o||(a[r]={},o=a[r]),o[i]=n}else r?a[r]=n:this.annotations=structuredClone(n)},this.getAllAnnotations=()=>Object.values(this.annotations).map(n=>Object.values(n)).flat(2),this.getNumberOfAllAnnotations=()=>{let n=0;const r=this.annotations;for(const i in r){const a=r[i];for(const o in a){const s=a[o];n+=s.length}}return n},this.removeAllAnnotations=()=>{const n=[];for(const r of this.getAllAnnotations())this.removeAnnotation(r.annotationUID),n.push(r);return n},e||(e=ya()),this.annotations={},this.uid=e,pt.addEventListener(it.IMAGE_VOLUME_MODIFIED,this._imageVolumeModifiedHandler)}setPreprocessingFn(e){this.preprocessingFn=e}}const akt=new ikt("DEFAULT"),YC=new Set;function okt(t,e=!0){const n=ckt();t&&(e?lkt(t,YC,n):ukt(t,YC,n)),fkt(n,YC)}function xf(t){return YC.has(t)}function skt(t){const e=xf(t);return okt(t,e),e}function ckt(){return Object.freeze({added:[],removed:[],locked:[]})}function lkt(t,e,n){if(!e.has(t)){e.add(t),n.added.push(t);const r=as(t);r&&(r.isLocked=!0)}}function ukt(t,e,n){if(e.delete(t)){n.removed.push(t);const r=as(t);r&&(r.isLocked=!1)}}function fkt(t,e){(t.added.length>0||t.removed.length>0)&&(e.forEach(n=>void t.locked.push(n)),dt(pt,ge.ANNOTATION_LOCK_CHANGE,t))}const kg=new Set;function vd(t,e=!0,n=!1){e?dkt(t,n):k4e(t)}function dkt(t,e=!1){const n=A4e();if(!e){L4e(kg,n);const r=as(t);r&&(r.isSelected=!0)}if(t&&!kg.has(t)){kg.add(t),n.added.push(t);const r=as(t);r&&(r.isSelected=!0)}V4e(n,kg)}function k4e(t){const e=A4e();if(t){if(kg.delete(t)){e.removed.push(t);const n=as(t);n.isSelected=!1}}else L4e(kg,e);V4e(e,kg)}function v9(t){return kg.has(t)}function A4e(){return Object.freeze({added:[],removed:[],selection:[]})}function L4e(t,e){t.forEach(n=>{if(t.delete(n)){e.removed.push(n);const r=as(n);r&&(r.isSelected=!1)}})}function V4e(t,e){(t.added.length>0||t.removed.length>0)&&(e.forEach(n=>void t.selection.push(n)),dt(pt,ge.ANNOTATION_SELECTION_CHANGE,t))}const hkt=t=>(t.data||(t.data={}),t.data.handles||(t.data.handles={}),t.data.handles.textBox||(t.data.handles.textBox={}),t),gkt=t=>(t.data||(t.data={}),t.data.cachedStats||(t.data.cachedStats={}),t),eb=new Set;function pkt(t,e=!0){const n=mkt();t&&(e?vkt(t,eb,n):ykt(t,eb,n)),xkt(n)}function Md(t){if(as(t))return!eb.has(t)}function mkt(){return Object.freeze({lastVisible:[],lastHidden:[],hidden:[]})}function vkt(t,e,n){if(e.delete(t)){n.lastVisible.push(t);const r=as(t);r.isVisible=!0}}function ykt(t,e,n){if(!e.has(t)){e.add(t),v9(t)&&k4e(t),n.lastHidden.push(t);const r=as(t);r.isVisible=!1}}function xkt(t){(t.lastHidden.length>0||t.lastVisible.length>0)&&(eb.forEach(e=>void t.hidden.push(e)),dt(pt,ge.ANNOTATION_VISIBILITY_CHANGE,t))}function wkt(t){const e=!eb.has(t);return pkt(t,e),e}const ZF=akt,bkt=t=>{t=hkt(t),t=gkt(t);const e=t.annotationUID,n=skt(e);t.isLocked=n;const r=wkt(e);return t.isVisible=r,t};ZF.setPreprocessingFn(bkt);GF(ZF);function Skt(){GF(ZF)}function h1(t){if(!t.data.segmentation)throw new Error("removeContourSegmentationAnnotation: annotation does not have a segmentation data");const{segmentationId:e,segmentIndex:n}=t.data.segmentation,r=zc(e),{annotationUIDsMap:i}=r?.representationData.Contour||{},a=i?.get(n);a&&(a.delete(t.annotationUID),a.size||i.delete(n))}function g1(t){if(t.parentAnnotationUID)return;if(!t.data.segmentation)throw new Error("addContourSegmentationAnnotation: annotation does not have a segmentation data");const{segmentationId:e,segmentIndex:n}=t.data.segmentation,r=zc(e);r.representationData.Contour||(r.representationData.Contour={annotationUIDsMap:new Map});let{annotationUIDsMap:i}=r.representationData.Contour;i||(i=new Map);let a=i?.get(n);a||(a=new Set,i.set(n,a)),i.set(n,a.add(t.annotationUID))}function $4e(t){const r=$d.getState().viewportSegRepresentations;return Object.entries(r).filter(([,a])=>a.some(o=>o.segmentationId===t)).map(([a])=>a)}var Tl;(function(t){t[t.CounterClockwise=-1]="CounterClockwise",t[t.Unknown=0]="Unknown",t[t.Clockwise=1]="Clockwise"})(Tl||(Tl={}));function Ckt(t,e){return t.minX<=e.maxX&&t.maxX>=e.minX&&t.minY<=e.maxY&&t.maxY>=e.minY}class _kt{}const{PointsManager:Tkt}=Bc;function Ik(t){return{max:[-1/0],min:[1/0],sum:[0],count:0,maxIJK:null,maxLPS:null,minIJK:null,minLPS:null,runMean:[0],m2:[0],m3:[0],m4:[0],allValues:[[]],pointsInShape:t?Tkt.create3(1024):null,sumLPS:[0,0,0]}}function Ekt(t,e,n=null,r=null){Array.isArray(e)&&e.length>1&&t.max.length===1&&(t.max.push(t.max[0],t.max[0]),t.min.push(t.min[0],t.min[0]),t.sum.push(t.sum[0],t.sum[0]),t.runMean.push(0,0),t.m2.push(t.m2[0],t.m2[0]),t.m3.push(t.m3[0],t.m3[0]),t.m4.push(t.m4[0],t.m4[0]),t.allValues.push([],[])),t?.pointsInShape&&n&&t.pointsInShape.push(n);const i=Array.isArray(e)?e:[e];t.count+=1,n&&(t.sumLPS[0]+=n[0],t.sumLPS[1]+=n[1],t.sumLPS[2]+=n[2]),t.max.forEach((a,o)=>{const s=i[o];t.allValues[o].push(s);const c=t.count,l=s-t.runMean[o],u=l/c,f=l*u*(c-1);t.sum[o]+=s,t.runMean[o]+=u,t.m4[o]+=f*u*u*(c*c-3*c+3)+6*u*u*t.m2[o]-4*u*t.m3[o],t.m3[o]+=f*u*(c-2)-3*u*t.m2[o],t.m2[o]+=f,s<t.min[o]&&(t.min[o]=s,o===0&&(t.minIJK=r?[...r]:null,t.minLPS=n?[...n]:null)),s>t.max[o]&&(t.max[o]=s,o===0&&(t.maxIJK=r?[...r]:null,t.maxLPS=n?[...n]:null))})}function Okt(t){if(t.length===0)return 0;const e=[...t].sort((r,i)=>r-i),n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}function Dkt(t,e){const n=t.sum.map(f=>f/t.count),r=t.m2.map(f=>Math.sqrt(f/t.count)),i=t.sumLPS.map(f=>f/t.count),a=t.m3.map((f,d)=>{const h=t.m2[d]/t.count;return h===0?0:f/(t.count*Math.pow(h,1.5))}),o=t.m4.map((f,d)=>{const h=t.m2[d]/t.count;return h===0?0:f/(t.count*h*h)-3}),s=t.allValues.map(f=>Okt(f)),c={max:{name:"max",label:"Max Pixel",value:t.max.length===1?t.max[0]:t.max,unit:e,pointIJK:t.maxIJK?[...t.maxIJK]:null,pointLPS:t.maxLPS?[...t.maxLPS]:null},min:{name:"min",label:"Min Pixel",value:t.min.length===1?t.min[0]:t.min,unit:e,pointIJK:t.minIJK?[...t.minIJK]:null,pointLPS:t.minLPS?[...t.minLPS]:null},mean:{name:"mean",label:"Mean Pixel",value:n.length===1?n[0]:n,unit:e},stdDev:{name:"stdDev",label:"Standard Deviation",value:r.length===1?r[0]:r,unit:e},count:{name:"count",label:"Voxel Count",value:t.count,unit:null},median:{name:"median",label:"Median",value:s.length===1?s[0]:s,unit:e},skewness:{name:"skewness",label:"Skewness",value:a.length===1?a[0]:a,unit:null},kurtosis:{name:"kurtosis",label:"Kurtosis",value:o.length===1?o[0]:o,unit:null},maxLPS:{name:"maxLPS",label:"Max LPS",value:t.maxLPS?Array.from(t.maxLPS):null,unit:null},minLPS:{name:"minLPS",label:"Min LPS",value:t.minLPS?Array.from(t.minLPS):null,unit:null},pointsInShape:t.pointsInShape,center:{name:"center",label:"Center",value:i?[...i]:null,unit:null},array:[]};c.array.push(c.min,c.max,c.mean,c.stdDev,c.median,c.skewness,c.kurtosis,c.count,c.maxLPS,c.minLPS),c.center.value&&c.array.push(c.center);const l=t.pointsInShape!==null,u=Ik(l);return t.max=u.max,t.min=u.min,t.sum=u.sum,t.count=u.count,t.maxIJK=u.maxIJK,t.maxLPS=u.maxLPS,t.minIJK=u.minIJK,t.minLPS=u.minLPS,t.runMean=u.runMean,t.m2=u.m2,t.m3=u.m3,t.m4=u.m4,t.allValues=u.allValues,t.pointsInShape=u.pointsInShape,t.sumLPS=u.sumLPS,c}const dm=class dm extends _kt{static statsInit(e){e.storePointData||(this.state.pointsInShape=null),this.state=Ik(e.storePointData)}};dm.state=Ik(!0),dm.statsCallback=({value:e,pointLPS:n=null,pointIJK:r=null})=>{Ekt(dm.state,e,n,r)},dm.getStatistics=e=>Dkt(dm.state,e?.unit);let tb=dm;function p1(t,e){if(t.length!==e.length)throw Error("Both points should have the same dimensionality");const[n,r,i=0]=t,[a,o,s=0]=e,c=a-n,l=o-r,u=s-i;return c*c+l*l+u*u}function j4e(t,e){return Math.sqrt(p1(t,e))}function Mkt(t,e,n={}){return n.precalculated||Rkt(t,n),n.precalculated(e)}const Rkt=(t,e={})=>{const{xRadius:n,yRadius:r,zRadius:i}=t;(e.invXRadiusSq===void 0||e.invYRadiusSq===void 0||e.invZRadiusSq===void 0)&&(e.invXRadiusSq=n!==0?1/n**2:0,e.invYRadiusSq=r!==0?1/r**2:0,e.invZRadiusSq=i!==0?1/i**2:0);const{invXRadiusSq:a,invYRadiusSq:o,invZRadiusSq:s}=e,{center:c}=t,[l,u,f]=c;return e.precalculated=d=>{const h=d[0]-l;let m=h*h*a;if(m>1)return!1;const p=d[1]-u;if(m+=p*p*o,m>1)return!1;const y=d[2]-f;return m+=y*y*s,m<=1},e};function yne(t){const[e,n,r,i]=t,a=[r[0],n[1]],o=[i[0],e[1]];return[a,o]}function Ikt(t,e,n){let r;const i=p1(t,e);if(t[0]===e[0]&&t[1]===e[1]&&(r=t),!r){const a=((n[0]-t[0])*(e[0]-t[0])+(n[1]-t[1])*(e[1]-t[1]))/i;a<0?r=t:a>1?r=e:r=[t[0]+a*(e[0]-t[0]),t[1]+a*(e[1]-t[1])]}return{point:[...r],distanceSquared:p1(n,r)}}function U4e(t,e,n){return Ikt(t,e,n).distanceSquared}function Ag(t,e,n){if(t.length!==2||e.length!==2||n.length!==2)throw Error("lineStart, lineEnd, and point should have 2 elements of [x, y]");return Math.sqrt(U4e(t,e,n))}const l5=.01;function iI(t,e,n){const r=t[0]<=e[0]?t[0]:e[0],i=t[0]>=e[0]?t[0]:e[0],a=t[1]<=e[1]?t[1]:e[1],o=t[1]>=e[1]?t[1]:e[1];if(!(n[0]>=r-l5&&n[0]<=i+l5&&n[1]>=a-l5&&n[1]<=o+l5))return!1;const c=(e[1]-t[1])*(n[0]-e[0])-(e[0]-t[0])*(n[1]-e[1]);return(c>=0?c:-c)<=l5}function F4e(t){if(t.length<3)return!1;const e=t.length,n=t[0],r=t[e-1],i=p1(n,r);return jT(0,i)}function Xs(t,e,n={closed:void 0}){if(t.length<3)return!1;const r=t.length;let i=0;const{closed:a,holes:o}=n;if(o?.length){for(const l of o)if(Xs(l,e))return!1}const s=!(a===void 0?F4e(t):a),c=t.length-(s?1:2);for(let l=0;l<=c;l++){const u=t[l],f=l===r-1?0:l+1,d=t[f],h=u[0]>=d[0]?u[0]:d[0],m=u[1]>=d[1]?u[1]:d[1],p=u[1]<=d[1]?u[1]:d[1];if(e[0]<=h&&e[1]>=p&&e[1]<m){let S=u[0]===d[0];if(!S){const C=(e[1]-u[1])*(d[0]-u[0])/(d[1]-u[1])+u[0];S=e[0]<=C}i+=S?1:0}}return!!(i%2)}function O3(t,e){for(let n=0,r=e.length;n<r;n++)if(!Xs(t,e[n]))return!1;return!0}function d6(t,e){let n=t;const r=e?.numDimensions||2,i=r===3;if(!Array.isArray(t[0])){const f=t,d=f.length/r;n=new Array(f.length/r);for(let h=0,m=d;h<m;h++)n[h]=[f[h*r],f[h*r+1]],i&&n[h].push(f[h*r+2])}let a=1/0,o=1/0,s=-1/0,c=-1/0,l=1/0,u=-1/0;n=n;for(let f=0,d=n.length;f<d;f++){const[h,m,p]=n[f];a=a<h?a:h,o=o<m?o:m,s=s>h?s:h,c=c>m?c:m,i&&(l=l<p?l:p,u=u>p?u:p)}return i?{minX:a,maxX:s,minY:o,maxY:c,minZ:l,maxZ:u}:{minX:a,maxX:s,minY:o,maxY:c}}function QF(t){const e=t.length;let n=0,r=e-1;for(let i=0;i<e;i++)n+=(t[r][0]+t[i][0])*(t[r][1]-t[i][1]),r=i;return Math.abs(n/2)}function zg(t){if(t.length<3)return 0;const e=t[0];let n=0;for(let r=0,i=t.length;r<i;r++){const a=t[r],o=r===i-1?0:r+1,s=t[o],c=a[0]-e[0],l=a[1]-e[1],u=s[0]-e[0],f=s[1]-e[1];n+=c*f-l*u}return n*=.5,n}function XC(t){return zg(t)>=0?1:-1}function Nkt(t){const e=ut(),n=t[0];for(let r=0,i=t.length;r<i;r++){const a=t[r],o=r===i-1?0:r+1,s=t[o],c=a[0]-n[0],l=a[1]-n[1],u=a[2]-n[2],f=s[0]-n[0],d=s[1]-n[1],h=s[2]-n[2];e[0]+=l*h-u*d,e[1]+=u*f-c*h,e[2]+=c*d-l*f}return gd(e,e,.5),e}function Pkt(t){const e=Nkt(t);return Vr(e,e)}function Nk(t){const e=zg(t);return[0,0,e/Math.abs(e)]}const Ha=1e-7;function aI(t,e){return t[0]*e[1]-t[1]*e[0]}function Zi(t,e){return Lr(t,e,Ha)}function B4e(t,e,n,r){const i=Qo(si(),e,t),a=Qo(si(),r,n),o=aI(i,a),s=Qo(si(),n,t),c=aI(s,i);if(Math.abs(o)<Ha){if(Math.abs(c)<Ha){const f=xg(i,i),d=xg(a,a);if(f<Ha||d<Ha)return Zi(t,n)||Zi(t,r)?t:Zi(e,n)||Zi(e,r)?e:null;const h=xg(Qo(si(),n,t),i)/f,m=xg(Qo(si(),r,t),i)/f,p=xg(Qo(si(),t,n),a)/d,y=xg(Qo(si(),e,n),a)/d,x=S=>S>=-Ha&&S<=1+Ha;if(x(h)){const S=SS(si(),t,i,h);if(Zi(n,S))return n}if(x(m)){const S=SS(si(),t,i,m);if(Zi(r,S))return r}if(x(p)){const S=SS(si(),n,a,p);if(Zi(t,S))return t}if(x(y)){const S=SS(si(),n,a,y);if(Zi(e,S))return e}}return null}const l=aI(s,a)/o,u=c/o;return l>=-Ha&&l<=1+Ha&&u>=-Ha&&u<=1+Ha?[t[0]+l*i[0],t[1]+l*i[1]]:null}var M0;(function(t){t[t.Vertex=0]="Vertex",t[t.Intersection=1]="Intersection"})(M0||(M0={}));var vs;(function(t){t[t.Entering=0]="Entering",t[t.Exiting=1]="Exiting",t[t.Unknown=2]="Unknown"})(vs||(vs={}));function z4e(t,e){if(t.length!==e.length)return!1;const n=t.length;if(n===0)return!0;let r=!0;for(let a=0;a<n;a++)if(!Zi(t[a],e[a])){r=!1;break}if(r)return!0;let i=!0;for(let a=0;a<n;a++)if(!Zi(t[a],e[n-1-a])){i=!1;break}if(i)return!0;for(let a=1;a<n;a++){let o=!0;for(let c=0;c<n;c++)if(!Zi(t[c],e[(c+a)%n])){o=!1;break}if(o)return!0;let s=!0;for(let c=0;c<n;c++)if(!Zi(t[c],e[(n-1-c+a)%n])){s=!1;break}if(s)return!0}return!1}function JF(t,e){if(t.length<3)return[];if(e.length<3)return[t.slice()];const n=e.slice();if(z4e(t,e))return[];const r=zg(t),i=zg(n);Math.sign(r)===Math.sign(i)&&Math.abs(i)>Ha&&n.reverse();const a=[];for(let u=0;u<t.length;u++){const f=t[u],d=t[(u+1)%t.length];for(let h=0;h<n.length;h++){const m=n[h],p=n[(h+1)%n.length],y=B4e(f,d,m,p);if(y){const x=Math.sqrt(Pg(f,d)),S=Math.sqrt(Pg(m,p));a.push({coord:y,seg1Idx:u,seg2Idx:h,alpha1:x<Ha?0:Math.sqrt(Pg(f,y))/x,alpha2:S<Ha?0:Math.sqrt(Pg(m,y))/S})}}}const o=(u,f,d)=>{const h=[];let m=0;for(let y=0;y<u.length;y++){const x=u[y];h.push({id:`${f}_v${m++}`,coordinates:x,type:M0.Vertex,originalPolyIndex:f,originalVertexIndex:y,next:null,prev:null,isIntersection:!1,visited:!1});const S=d.filter(C=>(f===0?C.seg1Idx:C.seg2Idx)===y).sort((C,_)=>(f===0?C.alpha1:C.alpha2)-(f===0?_.alpha1:_.alpha2));for(const C of S){if(h.length>0&&Zi(h[h.length-1].coordinates,C.coord)){h[h.length-1].isIntersection||(h[h.length-1].isIntersection=!0,h[h.length-1].intersectionInfo=C,h[h.length-1].alpha=f===0?C.alpha1:C.alpha2);continue}h.push({id:`${f}_i${m++}`,coordinates:C.coord,type:M0.Intersection,originalPolyIndex:f,next:null,prev:null,isIntersection:!0,visited:!1,alpha:f===0?C.alpha1:C.alpha2,intersectionInfo:C})}}const p=[];if(h.length>0){p.push(h[0]);for(let y=1;y<h.length;y++)Zi(h[y].coordinates,p[p.length-1].coordinates)?h[y].isIntersection&&(p[p.length-1].isIntersection=!0,p[p.length-1].intersectionInfo=h[y].intersectionInfo,p[p.length-1].alpha=h[y].alpha):p.push(h[y])}if(p.length>0)for(let y=0;y<p.length;y++)p[y].next=p[(y+1)%p.length],p[y].prev=p[(y-1+p.length)%p.length];return p},s=o(t,0,a),c=o(n,1,a);s.forEach(u=>{if(u.isIntersection){const f=u.intersectionInfo,d=c.find(h=>h.isIntersection&&Zi(h.coordinates,u.coordinates)&&h.intersectionInfo.seg1Idx===f.seg1Idx&&h.intersectionInfo.seg2Idx===f.seg2Idx);if(d){u.partnerNode=d,d.partnerNode=u;const h=u.prev.coordinates,m=u.coordinates,p=d.next.coordinates;Qo(si(),m,h),Qo(si(),p,m);const y=[(u.prev.coordinates[0]+u.coordinates[0])/2,(u.prev.coordinates[1]+u.coordinates[1])/2];Xs(e,y)?u.intersectionDir=vs.Exiting:u.intersectionDir=vs.Entering}else u.isIntersection=!1}}),s.forEach(u=>delete u.intersectionInfo),c.forEach(u=>delete u.intersectionInfo);const l=[];for(let u=0;u<s.length;u++){const f=s[u];if(f.visited||f.isIntersection||Xs(e,f.coordinates))continue;const d=[];let h=f,m=!0,p=0;const y=(s.length+c.length)*2;do{if(p++>y){console.warn("Subtraction: Max iterations reached, possible infinite loop.");break}h.visited=!0,(d.length===0||!Zi(d[d.length-1],h.coordinates))&&d.push(h.coordinates),h.isIntersection&&(m?h.intersectionDir===vs.Entering&&h.partnerNode&&(h=h.partnerNode,m=!1):h.partnerNode?(h=h.partnerNode,m=!0):console.warn("Subtraction: Intersection on source without partner.")),h=h.next}while(h!==f||!m);d.length>=3&&(Zi(d[0],d[d.length-1])&&d.pop(),d.length>=3&&l.push(d))}return l}function kkt(t,e){if(t.length<3||e.length<3)return[];let n=e.slice();const r=zg(t),i=zg(n);if(Math.abs(r)<Ha||Math.abs(i)<Ha)return[];r<0&&(t=t.slice().reverse()),i<0&&(n=n.slice().reverse());const a=n,o=[];for(let f=0;f<t.length;f++){const d=t[f],h=t[(f+1)%t.length];for(let m=0;m<n.length;m++){const p=n[m],y=n[(m+1)%n.length],x=B4e(d,h,p,y);if(x){const S=Math.sqrt(Pg(d,h)),C=Math.sqrt(Pg(p,y));o.push({coord:[...x],seg1Idx:f,seg2Idx:m,alpha1:S<Ha?0:Math.sqrt(Pg(d,x))/S,alpha2:C<Ha?0:Math.sqrt(Pg(p,x))/C})}}}if(o.length===0)return Xs(a,t[0])&&t.every(f=>Xs(a,f))?[[...t.map(f=>[...f])]]:Xs(t,n[0])&&n.every(f=>Xs(t,f))?[[...n.map(f=>[...f])]]:[];const s=(f,d,h)=>{const m=[];let p=0;for(let x=0;x<f.length;x++){const S=f[x];m.push({id:`${d}_v${p++}`,coordinates:[...S],type:M0.Vertex,originalPolyIndex:d,originalVertexIndex:x,next:null,prev:null,isIntersection:!1,visited:!1,processedInPath:!1,intersectionDir:vs.Unknown});const C=h.filter(_=>(d===0?_.seg1Idx:_.seg2Idx)===x).sort((_,T)=>(d===0?_.alpha1:_.alpha2)-(d===0?T.alpha1:T.alpha2));for(const _ of C){if(m.length>0&&Zi(m[m.length-1].coordinates,_.coord)){const T=m[m.length-1];T.isIntersection||(T.isIntersection=!0,T.intersectionInfo=_,T.alpha=d===0?_.alpha1:_.alpha2,T.type=M0.Intersection);continue}m.push({id:`${d}_i${p++}`,coordinates:[..._.coord],type:M0.Intersection,originalPolyIndex:d,next:null,prev:null,isIntersection:!0,visited:!1,processedInPath:!1,alpha:d===0?_.alpha1:_.alpha2,intersectionInfo:_,intersectionDir:vs.Unknown})}}const y=[];if(m.length>0){y.push(m[0]);for(let x=1;x<m.length;x++)if(!Zi(m[x].coordinates,y[y.length-1].coordinates))y.push(m[x]);else{const S=y[y.length-1];m[x].isIntersection&&m[x].intersectionInfo&&(S.isIntersection=!0,S.intersectionInfo=m[x].intersectionInfo,S.alpha=m[x].alpha,S.type=M0.Intersection)}}if(y.length>1&&Zi(y[0].coordinates,y[y.length-1].coordinates)){const x=y[0],S=y.pop();S.isIntersection&&!x.isIntersection&&S.intersectionInfo&&(x.isIntersection=!0,x.intersectionInfo=S.intersectionInfo,x.alpha=S.alpha,x.type=M0.Intersection)}if(y.length>0)for(let x=0;x<y.length;x++)y[x].next=y[(x+1)%y.length],y[x].prev=y[(x-1+y.length)%y.length];return y},c=s(t,0,o),l=s(n,1,o);if(c.length===0||l.length===0)return[];c.forEach(f=>{if(f.isIntersection&&f.intersectionInfo){const d=f.intersectionInfo,h=l.find(m=>m.isIntersection&&m.intersectionInfo&&Zi(m.coordinates,f.coordinates)&&m.intersectionInfo.seg1Idx===d.seg1Idx&&m.intersectionInfo.seg2Idx===d.seg2Idx);if(h){f.partnerNode=h,h.partnerNode=f;const m=Qo(si(),f.coordinates,f.prev.coordinates),p=Qo(si(),h.next.coordinates,h.coordinates),y=m[0]*p[1]-m[1]*p[0];if(y>Ha)f.intersectionDir=vs.Entering,h.intersectionDir=vs.Exiting;else if(y<-Ha)f.intersectionDir=vs.Exiting,h.intersectionDir=vs.Entering;else{const x=[(f.prev.coordinates[0]+f.coordinates[0])/2,(f.prev.coordinates[1]+f.coordinates[1])/2];Xs(a,x)?(f.intersectionDir=vs.Exiting,h.intersectionDir=vs.Entering):(f.intersectionDir=vs.Entering,h.intersectionDir=vs.Exiting)}}else f.isIntersection=!1,f.intersectionInfo=void 0}});const u=[];for(const f of c){if(!f.isIntersection||f.visited||f.intersectionDir!==vs.Entering)continue;let d=[],h=f,m=!0;const p=f;let y=0;const x=(c.length+l.length)*2;c.forEach(S=>S.processedInPath=!1),l.forEach(S=>S.processedInPath=!1);do{if(y++>x){console.warn("Intersection: Max iterations in path tracing.",p.id,h.id),d=[];break}if(h.processedInPath&&h!==p){console.warn("Intersection: Path processing loop detected, discarding path segment.",p.id,h.id),d=[];break}h.processedInPath=!0,h.visited=!0,(d.length===0||!Zi(d[d.length-1],h.coordinates))&&d.push([...h.coordinates]);let S=!1;h.isIntersection&&h.partnerNode&&(m?(h=h.partnerNode,m=!1,S=!0):(h=h.partnerNode,m=!0,S=!0)),h=h.next}while(h!==p||m&&h.originalPolyIndex!==0||!m&&h.originalPolyIndex!==1);if(y>x||d.length===0||d.length>0&&Zi(d[0],d[d.length-1])&&d.pop(),d.length>=3){const S=zg(d);(r>0&&S<0||r<0&&S>0)&&d.reverse(),u.push(d.map(C=>[...C]))}}return u}function eB(t,e,n,r){let i=!1;const a=t[0]<e[0]?t[0]:e[0],o=t[1]<e[1]?t[1]:e[1],s=t[0]>e[0]?t[0]:e[0],c=t[1]>e[1]?t[1]:e[1],l=n[0]<r[0]?n[0]:r[0],u=n[1]<r[1]?n[1]:r[1],f=n[0]>r[0]?n[0]:r[0],d=n[1]>r[1]?n[1]:r[1];if(a>f||s<l||o>d||c<u)return!1;const h=[WS(t,e,n),WS(t,e,r),WS(n,r,t),WS(n,r,e)];return h[0]!==h[1]&&h[2]!==h[3]?!0:((h[0]===0&&HS(t,n,e)||h[1]===0&&HS(t,r,e)||h[2]===0&&HS(n,t,r)||h[3]===0&&HS(n,e,r))&&(i=!0),i)}function WS(t,e,n){const r=(e[1]-t[1])*(n[0]-e[0])-(e[0]-t[0])*(n[1]-e[1]);return r===0?0:r>0?1:2}function HS(t,e,n){return e[0]<=Math.max(t[0],n[0])&&e[0]>=Math.min(t[0],n[0])&&e[1]<=Math.max(t[1],n[1])&&e[1]>=Math.min(t[1],n[1])}function tB(t,e,n,r=!0){const i=[],a=t.length,o=a-(r?1:2);for(let s=0;s<=o;s++){const c=t[s],l=s===a-1?0:s+1,u=t[l];eB(e,n,c,u)&&i.push([s,l])}return i}function G4e(t,e,n,r=!0){let i,a;r?(a=t.length-1,i=0):(a=0,i=1);for(let o=i;o<t.length;o++){const s=t[a],c=t[o];if(eB(e,n,s,c))return[a,o];a=o}}function nB(t,e){for(let n=0,r=t.length;n<r;n++){const i=t[n],a=n===r-1?0:n+1,o=t[a];if(G4e(e,i,o)?.length===2)return!0}return!1}const Akt=.01;function W4e(t,e,n,r){const i=[e[0]-t[0],e[1]-t[1]],a=[r[0]-n[0],r[1]-n[1]],o=a[1]*i[0]-a[0]*i[1];if((o>=0?o:-o)<Akt){const m=[t[0]<e[0]?t[0]:e[0],t[0]>e[0]?t[0]:e[0],t[1]<e[1]?t[1]:e[1],t[1]>e[1]?t[1]:e[1]],p=[n[0]<r[0]?n[0]:r[0],n[0]>r[0]?n[0]:r[0],n[1]<r[1]?n[1]:r[1],n[1]>r[1]?n[1]:r[1]];if(!(m[0]<=p[1]&&m[1]>=p[0]&&m[2]<=p[3]&&m[3]>=p[2])||!(iI(t,e,n)||iI(t,e,r)||iI(n,r,t)))return;const S=m[0]>p[0]?m[0]:p[0],C=m[1]<p[1]?m[1]:p[1],_=m[2]>p[2]?m[2]:p[2],T=m[3]<p[3]?m[3]:p[3],O=(S+C)*.5,M=(_+T)*.5;return[O,M]}let c=t[1]-n[1],l=t[0]-n[0];const u=a[0]*c-a[1]*l,f=i[0]*c-i[1]*l;c=u/o,l=f/o;const d=t[0]+c*i[0],h=t[1]+c*i[1];return[d,h]}var $m;(function(t){t[t.Vertex=0]="Vertex",t[t.Intersection=1]="Intersection"})($m||($m={}));var jm;(function(t){t[t.Outside=-1]="Outside",t[t.Edge=0]="Edge",t[t.Inside=1]="Inside"})(jm||(jm={}));var Kv;(function(t){t[t.Exiting=-1]="Exiting",t[t.Unknown=0]="Unknown",t[t.Entering=1]="Entering"})(Kv||(Kv={}));function xne(t){for(let e=0,n=t.length;e<n;e++){const r=t[e];r.next||(r.next=t[e===n-1?0:e+1])}}function Lkt(t,e){const n=[],r=[],i=new Map;let o=Xs(e,t[0])?Kv.Exiting:Kv.Entering;for(let s=0,c=t.length;s<c;s++){const l=t[s],u=Xs(e,l),f={type:$m.Vertex,coordinates:l,position:u?jm.Inside:jm.Outside,visited:!1,next:null};n.push(f);const d=t[s===c-1?0:s+1],h=tB(e,l,d).map(m=>{const p=m[0],y=e[m[0]],x=e[m[1]],S=W4e(l,d,y,x),C=p1(l,S);return{sourceLineSegmentId:p,coordinate:S,targetStartPointDistSquared:C}});h.sort((m,p)=>m.targetStartPointDistSquared-p.targetStartPointDistSquared),h.forEach(m=>{const{sourceLineSegmentId:p,coordinate:y}=m,x={type:$m.Intersection,coordinates:y,position:jm.Edge,direction:o,visited:!1,next:null},S={...x,direction:Kv.Unknown,cloned:!0};o===Kv.Entering?x.next=S:S.next=x;let C=i.get(p);C||(C=[],i.set(p,C)),n.push(x),C.push(S),o*=-1})}for(let s=0,c=e.length;s<c;s++){const l=s,u=e[s],f={type:$m.Vertex,coordinates:u,visited:!1,next:null};r.push(f);const d=i.get(l);d?.length&&d.map(h=>({intersectionPoint:h,lineSegStartDistSquared:p1(u,h.coordinates)})).sort((h,m)=>h.lineSegStartDistSquared-m.lineSegStartDistSquared).map(({intersectionPoint:h})=>h).forEach(h=>r.push(h))}return xne(n),xne(r),{targetPolylinePoints:n,sourcePolylinePoints:r}}function Vkt(t){for(let e=0,n=t.length;e<n;e++){const r=t[e];if(!r.visited&&r.position===jm.Outside&&r.type===$m.Vertex)return r}for(let e=0,n=t.length;e<n;e++){const r=t[e];if(!r.visited&&r.position===jm.Outside)return r}}function rB(t,e){const n=Nk(t),r=Nk(e),i=Vt(r,n);if(jT(1,i)||(e=e.slice().reverse()),!nB(e,t)&&O3(e,t))return e.slice();const{targetPolylinePoints:s}=Lkt(t,e),c=Vkt(s);if(!c)return t.slice();const l=[c.coordinates];let u=c.next,f=0;const d=t.length+e.length+1e3;for(;u!==c&&f<d;){if(f++,u.type===$m.Intersection&&u.cloned){u=u.next;continue}if(l.push(u.coordinates),u=u.next,!u){console.warn("Broken linked list detected in mergePolylines, breaking loop");break}}return f>=d&&console.warn("Maximum iterations reached in mergePolylines, possible infinite loop detected"),l}const $kt=.1;function H4e(t,e=$kt){const n=t.length;if(n<3)return t;const r=e*e,i=[[0,n-1]],a=new Array(n).fill(!1);let o=2;for(a[0]=!0,a[n-1]=!0;i.length;){const[c,l]=i.pop();if(l-c===1)continue;const u=t[c],f=t[l];let d=-1/0,h=-1;for(let m=c+1;m<l;m++){const p=t[m],y=U4e(u,f,p);y>d&&(d=y,h=m)}d<r||(a[h]=!0,o++,i.push([h,l]),i.push([c,h]))}const s=new Array(o);for(let c=0,l=0;c<n;c++)a[c]&&(s[l++]=t[c]);return s}function q4e(t,e,n,r=!0){const i=[],a=tB(t,e,n,r);for(let o=0;o<a.length;o++){const s=t[a[o][0]],c=t[a[o][1]],l=W4e(e,n,s,c);i.push(l)}return i}function jkt(t,e,n,r=!0){let i,a;r?(a=t.length-1,i=0):(a=0,i=1);const o=[];for(let u=i;u<t.length;u++){const f=t[a],d=t[u];eB(e,n,f,d)&&o.push([a,u]),a=u}if(o.length===0)return;const s=[];o.forEach(u=>{const f=[t[u[0]],t[u[1]]],d=[(f[0][0]+f[1][0])/2,(f[0][1]+f[1][1])/2];s.push(Ka(d,e))});const c=Math.min(...s),l=s.indexOf(c);return{segment:o[l],distance:c}}const Ev=.001,Ukt=(t,e)=>{let n,r,i;if(t instanceof Ms){const o=t.getImageData();if(!o)return;r=o.direction.slice(0,3),i=o.direction.slice(3,6),n=o.spacing}else{const o=t.getImageData(),{direction:s,spacing:c}=o,{viewPlaneNormal:l,viewUp:u}=t.getCamera(),f=s.slice(0,3),d=s.slice(3,6),h=s.slice(6,9),m=ut();Tr(m,u,l);const p=Math.abs(Vt(m,f)),y=Math.abs(Vt(m,d)),x=Math.abs(Vt(m,h));let S;if(Math.abs(1-p)<Ev)S=c[0],r=f;else if(Math.abs(1-y)<Ev)S=c[1],r=d;else if(Math.abs(1-x)<Ev)S=c[2],r=h;else throw new Error("No support yet for oblique plane planar contours");const C=Math.abs(Vt(u,f)),_=Math.abs(Vt(u,d)),T=Math.abs(Vt(u,h));let O;if(Math.abs(1-C)<Ev)O=c[0],i=f;else if(Math.abs(1-_)<Ev)O=c[1],i=d;else if(Math.abs(1-T)<Ev)O=c[2],i=h;else throw new Error("No support yet for oblique plane planar contours");n=[S,O]}return{spacing:[n[0]/e,n[1]/e],xDir:r,yDir:i}},Fkt=(t,e,n)=>JU(t,e)<n,Bkt=(t,e,n,r)=>{const{xDir:i,yDir:a,spacing:o}=r,s=yt(t),{viewport:c}=s;if(!e.length)return e.push(n),console.log(">>>>> !canvasPoints. :: RETURN"),1;const l=c.canvasToWorld(e[e.length-1]),u=c.canvasToWorld(n),f=ut();Xi(f,u,l);const d=Math.abs(Vt(f,i)),h=Math.abs(Vt(f,a)),m=Math.max(Math.floor(d/o[0]),Math.floor(h/o[0]));if(m>1){const p=e[e.length-1],y=JU(p,n),x=si();Qo(x,n,p),hy(x,x[0]/y,x[1]/y);const S=y/m;for(let C=1;C<=m;C++)e.push([p[0]+S*x[0]*C,p[1]+S*x[1]*C])}else e.push(n);return m},zkt=(t,e,n,r)=>{const i=[t[0]-e[0],t[1]-e[1]],a=[n[0]-e[0],n[1]-e[1]],o=i[0]*a[0]+i[1]*a[1];if(o<0)return!1;const s=Math.sqrt(a[0]*a[0]+a[1]*a[1]);if(s===0)return!1;const c=o/s,l=[a[0]/s,a[1]/s],u=[l[0]*c,l[1]*c],f=[e[0]+u[0],e[1]+u[1]];return!(Ka(t,f)>r||Ka(e,f)>Ka(e,n))},Gkt=1e-6;function K4e(t){let e;const n=UF(t,50);for(let o=0;o<3;o++)if(n.every((s,c,l)=>Math.abs(s[o]-l[0][o])<Gkt)){e=o;break}if(e===void 0)throw new Error("Cannot find a shared dimension index for polyline, probably oblique plane");const r=[],i=(e+1)%3,a=(e+2)%3;for(let o=0;o<t.length;o++)r.push([t[o][i],t[o][a]]);return{sharedDimensionIndex:e,projectedPolyline:r}}function Wkt(t,e,n={}){const{sharedDimensionIndex:r,projectedPolyline:i}=K4e(e),{holes:a}=n,o=[];if(a)for(let c=0;c<a.length;c++){const l=a[c],u=[];for(let f=0;f<l.length;f++)u.push([l[f][(r+1)%3],l[f][(r+2)%3]]);o.push(u)}const s=[t[(r+1)%3],t[(r+2)%3]];return Xs(i,s,{holes:o})}function Hkt(t){if(t.length<3)return t.slice();const e=t.map(a=>[a[0],a[1]]).sort((a,o)=>a[0]===o[0]?a[1]-o[1]:a[0]-o[0]);function n(a,o,s){return(o[0]-a[0])*(s[1]-a[1])-(o[1]-a[1])*(s[0]-a[0])}const r=[];for(const a of e){for(;r.length>=2&&n(r[r.length-2],r[r.length-1],a)<=0;)r.pop();r.push(a)}const i=[];for(let a=e.length-1;a>=0;a--){const o=e[a];for(;i.length>=2&&n(i[i.length-2],i[i.length-1],o)<=0;)i.pop();i.push(o)}return r.pop(),i.pop(),r.concat(i)}const M1=Object.freeze(Object.defineProperty({__proto__:null,addCanvasPointsToArray:Bkt,arePolylinesIdentical:z4e,containsPoint:Xs,containsPoints:O3,convexHull:Hkt,decimate:H4e,getAABB:d6,getArea:QF,getClosestLineSegmentIntersection:jkt,getFirstLineSegmentIntersectionIndexes:G4e,getLineSegmentIntersectionsCoordinates:q4e,getLineSegmentIntersectionsIndexes:tB,getNormal2:Nk,getNormal3:Pkt,getSignedArea:zg,getSubPixelSpacingAndXYDirections:Ukt,getWindingDirection:XC,intersectPolyline:nB,intersectPolylines:kkt,isClosed:F4e,isPointInsidePolyline3D:Wkt,mergePolylines:rB,pointCanProjectOnLine:zkt,pointsAreWithinCloseContourProximity:Fkt,projectTo2D:K4e,subtractPolylines:JF},Symbol.toStringTag,{value:"Module"}));function qkt(t,e,n,r){const i=[t,e],a=[t+n,e],o=[t+n,e],s=[t+n,e+r],c=[t+n,e+r],l=[t,e+r],u=[t,e+r];return{top:[i,a],right:[o,s],bottom:[c,l],left:[u,[t,e]]}}function Kkt(t,e){if(t.length!==4||e.length!==2)throw Error("rectangle:[left, top, width, height] or point: [x,y] not defined correctly");const[n,r,i,a]=t;let o=655535;const s=qkt(n,r,i,a);return Object.keys(s).forEach(c=>{const[l,u]=s[c],f=Ag(l,u,e);f<o&&(o=f)}),o}function wne(t,e){let n=[0,0],r=Number.MAX_SAFE_INTEGER;return t.forEach(function(i){const a=Ykt(e,i);a<r&&(r=a,n=[...i])}),n}function Ykt(t,e){const[n,r]=t,[i,a]=e;return Math.sqrt(Math.pow(n-i,2)+Math.pow(r-a,2))}function Xkt(t,e){const[n,r]=t,[i,a]=e,o=yr(ut(),r,n),s=yr(ut(),i,a),c=Vt(o,s),l=ec(o),u=ec(s),f=c/(l*u);return Math.acos(f)*180/Math.PI}function Zkt(t,e){const[n,r]=t,[i,a]=e,o=Wy(si(),r,n),s=Wy(si(),i,a),c=xg(o,s),l=Pee(o),u=Pee(s),f=c/(l*u);return Math.acos(f)*(180/Math.PI)}function ZC(t,e){return t[0].length===3?Xkt(t,e):Zkt(t,e)}function jd(t,e,n,r){const{canvasToWorld:i,worldToCanvas:a}=n,{data:o}=t,{targetWindingDirection:s}=e;let{points:c}=e,l=XC(c);r?.decimate?.enabled&&(c=H4e(e.points,r?.decimate?.epsilon));let{closed:u}=e;const f=c.length,d=new Array(f);XC(c);const h=Y3e(t);if(u===void 0){let m=!1;if(c.length>3){const p=p1(c[0],c[f-1]);m=Lr(0,p)}u=m}if(r?.updateWindingDirection!==!1){let m=h?h.data.contour.windingDirection*-1:s;m===void 0&&(m=l),m!==l&&c.reverse();const p=(o.handles?.points??[]).map(a);p.length>2&&XC(p)!==m&&o.handles.points.reverse(),l=m}for(let m=0;m<f;m++)d[m]=i(c[m]);o.contour.polyline=d,o.contour.closed=u,o.contour.windingDirection=l,X3e(t)}const Qkt="viewport-element";function Jkt(t){const e=yt(t),{viewportId:n,renderingEngineId:r}=e,i=`${n}:${r}`,a=eAt(t);return Object.keys(Tt.svgNodeCache[i]).forEach(o=>{Tt.svgNodeCache[i][o].touched=!1}),{svgLayerElement:a,svgNodeCacheForCanvas:Tt.svgNodeCache,getSvgNode:tAt.bind(this,i),appendNode:nAt.bind(this,a,i),setNodeTouched:rAt.bind(this,i),clearUntouched:iAt.bind(this,a,i)}}function eAt(t){const e=`.${Qkt}`;return t.querySelector(e)?.querySelector(":scope > .svg-layer")}function tAt(t,e){if(Tt.svgNodeCache[t]&&Tt.svgNodeCache[t][e])return Tt.svgNodeCache[t][e].domRef}function nAt(t,e,n,r){if(!Tt.svgNodeCache[e])return null;Tt.svgNodeCache[e][r]={touched:!0,domRef:n},t.appendChild(n)}function rAt(t,e){Tt.svgNodeCache[t]&&Tt.svgNodeCache[t][e]&&(Tt.svgNodeCache[t][e].touched=!0)}function iAt(t,e){Tt.svgNodeCache[e]&&Object.keys(Tt.svgNodeCache[e]).forEach(n=>{const r=Tt.svgNodeCache[e][n];!r.touched&&r.domRef&&(t.removeChild(r.domRef),delete Tt.svgNodeCache[e][n])})}function aAt(t,e){const n=Jkt(t);e(n),n.clearUntouched()}function _p(t,e,n){return`${t}::${e}::${n}`}function Rd(t,e){Object.keys(t).forEach(n=>{const r=e.getAttribute(n),i=t[n];i===void 0||i===""?e.removeAttribute(n):r!==i&&e.setAttribute(n,i)})}function R1(t,e){Object.keys(t).forEach(n=>{const r=t[n];r!==void 0&&r!==""&&e.setAttribute(n,r)})}function oAt(t,e,n,r,i,a={},o=""){const{color:s,fill:c,width:l,lineWidth:u,lineDash:f,fillOpacity:d,strokeOpacity:h}=Object.assign({color:"rgb(0, 255, 0)",fill:"transparent",width:"2",lineDash:void 0,lineWidth:void 0,strokeOpacity:1,fillOpacity:1},a),m=u||l,p="http://www.w3.org/2000/svg",y=_p(e,"circle",n),x=t.getSvgNode(y),S={cx:`${r[0]}`,cy:`${r[1]}`,r:`${i}`,stroke:s,fill:c,"stroke-width":m,"stroke-dasharray":f,"fill-opacity":d,"stroke-opacity":h};if(x)Rd(S,x),t.setNodeTouched(y);else{const C=document.createElementNS(p,"circle");o!==""&&C.setAttribute("data-id",o),R1(S,C),t.appendNode(C,y)}}function sAt(t,e,n,r,i={},a=""){const{color:o,width:s,lineWidth:c,lineDash:l}=Object.assign({color:"rgb(0, 255, 0)",width:"2",lineWidth:void 0,lineDash:void 0},i),u=c||s,f="http://www.w3.org/2000/svg",d=_p(e,"ellipse",n),h=t.getSvgNode(d),[m,p,y,x]=r,S=Math.hypot(y[0]-x[0],y[1]-x[1]),C=Math.hypot(p[0]-m[0],p[1]-m[1]),_=Math.atan2(y[1]-x[1],y[0]-x[0])*180/Math.PI,T=[(y[0]+x[0])/2,(p[1]+m[1])/2],O=S/2,M=C/2,I={cx:`${T[0]}`,cy:`${T[1]}`,rx:`${O}`,ry:`${M}`,stroke:o,fill:"transparent",transform:`rotate(${_} ${T[0]} ${T[1]})`,"stroke-width":u,"stroke-dasharray":l};if(h)Rd(I,h),t.setNodeTouched(d);else{const V=document.createElementNS(f,"ellipse");a!==""&&V.setAttribute("data-id",a),R1(I,V),t.appendNode(V,d)}}function cAt(t,e,n,r,i={},a){const{color:o,handleRadius:s,width:c,lineWidth:l,fill:u,type:f,opacity:d}=Object.assign({color:"rgb(0, 255, 0)",handleRadius:"6",width:"2",lineWidth:void 0,fill:"transparent",type:"circle",opacity:1},i),h=l||c,m="http://www.w3.org/2000/svg",p=_p(e,"handle",`hg-${n}-index-${a}`);let y;if(f==="circle")y={cx:`${r[0]}`,cy:`${r[1]}`,r:s,stroke:o,fill:u,"stroke-width":h,opacity:d};else if(f==="rect"){const C=parseFloat(s)*1.5,_=r[0]-C*.5,T=r[1]-C*.5;y={x:`${_}`,y:`${T}`,width:`${C}`,height:`${C}`,stroke:o,fill:u,"stroke-width":h,rx:`${C*.1}`,opacity:d}}else throw new Error(`Unsupported handle type: ${f}`);const x=t.getSvgNode(p);if(x)Rd(y,x),t.setNodeTouched(p);else{const S=document.createElementNS(m,f);R1(y,S),t.appendNode(S,p)}}function bh(t,e,n,r,i={}){r.forEach((a,o)=>{cAt(t,e,n,a,i,o)})}function R0(t,e,n,r,i,a={},o=""){if(isNaN(r[0])||isNaN(r[1])||isNaN(i[0])||isNaN(i[1]))return;const{color:s="rgb(0, 255, 0)",width:c=10,lineWidth:l,lineDash:u,markerStartId:f=null,markerEndId:d=null,shadow:h=!1,strokeOpacity:m=1}=a,p=l||c,y="http://www.w3.org/2000/svg",x=_p(e,"line",n),S=t.getSvgNode(x),C=t.svgLayerElement.id,_=h?`filter:url(#shadow-${C});`:"",T={x1:`${r[0]}`,y1:`${r[1]}`,x2:`${i[0]}`,y2:`${i[1]}`,stroke:s,style:_,"stroke-width":p,"stroke-dasharray":u,"marker-start":f?`url(#${f})`:"","marker-end":d?`url(#${d})`:"","stroke-opacity":m};if(S)Rd(T,S),t.setNodeTouched(x);else{const O=document.createElementNS(y,"line");o!==""&&O.setAttribute("data-id",o),R1(T,O),t.appendNode(O,x)}}function Yy(t,e,n,r,i){if(r.length<2)return;const{color:a="rgb(0, 255, 0)",width:o=10,fillColor:s="none",fillOpacity:c=0,lineWidth:l,lineDash:u,closePath:f=!1,markerStartId:d=null,markerEndId:h=null}=i,m=l||o,p="http://www.w3.org/2000/svg",y=_p(e,"polyline",n),x=t.getSvgNode(y);let S="";for(const _ of r)S+=`${_[0].toFixed(1)}, ${_[1].toFixed(1)} `;if(f){const _=r[0];S+=`${_[0]}, ${_[1]}`}const C={points:S,stroke:a,fill:s,"fill-opacity":c,"stroke-width":m,"stroke-dasharray":u,"marker-start":d?`url(#${d})`:"","marker-end":h?`url(#${h})`:""};if(x)Rd(C,x),t.setNodeTouched(y);else{const _=document.createElementNS(p,"polyline");R1(C,_),t.appendNode(_,y)}}function Um(t,e,n,r,i){const o=r.length&&r[0].length&&Array.isArray(r[0][0])?r:[r],{color:s="rgb(0, 255, 0)",width:c=10,fillColor:l="none",fillOpacity:u=0,lineWidth:f,lineDash:d,closePath:h=!1}=i,m=f||c,p="http://www.w3.org/2000/svg",y=_p(e,"path",n),x=t.getSvgNode(y);let S="";for(let _=0,T=o.length;_<T;_++){const O=o[_],M=O.length;if(!(M<2)){for(let I=0;I<M;I++){const V=O[I];S+=`${I?"L":"M"} ${V[0].toFixed(1)}, ${V[1].toFixed(1)} `}h&&(S+="Z ")}}if(!S)return;const C={d:S,stroke:s,fill:l,"fill-opacity":u,"stroke-width":m,"stroke-dasharray":d};if(x)Rd(C,x),t.setNodeTouched(y);else{const _=document.createElementNS(p,"path");R1(C,_),t.appendNode(_,y)}}function h6(t,e,n,r,i,a={}){const o=Object.assign({fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",color:"rgb(255, 255, 0)",background:"",padding:25,centerX:!1,centerY:!0},a);return lAt(t,e,n,r,i,o)}function lAt(t,e,n,r=[""],i,a){const{padding:o,color:s,fontFamily:c,fontSize:l,background:u}=a;let f;const[d,h]=[i[0]+o,i[1]+o],m="http://www.w3.org/2000/svg",p=_p(e,"text",n),y=t.getSvgNode(p);if(y){const x=y.querySelector("text"),S=Array.from(x.children);for(let T=0;T<S.length;T++){const O=S[T],M=r[T]||"";O.textContent=M}if(r.length>S.length){for(let T=0;T<r.length-S.length;T++){const O=r[T+S.length],M=bne(O);x.appendChild(M)}y.appendChild(x),t.appendNode(y,p)}const C={fill:s,"font-size":l,"font-family":c},_={transform:`translate(${d} ${h})`};Rd(C,x),Rd(_,y),y.setAttribute("data-annotation-uid",e),f=Sne(y,u),t.setNodeTouched(p)}else{const x=document.createElementNS(m,"g");x.setAttribute("data-annotation-uid",e),x.setAttribute("transform",`translate(${d} ${h})`);const S=uAt(t,a);for(let C=0;C<r.length;C++){const _=r[C],T=bne(_);S.appendChild(T)}x.appendChild(S),t.appendNode(x,p),f=Sne(x,u)}return Object.assign({},f,{x:d,y:h,height:f.height+o,width:f.width+o})}function uAt(t,e){const{color:n,fontFamily:r,fontSize:i}=e,o=document.createElementNS("http://www.w3.org/2000/svg","text"),s="user-select: none; pointer-events: none; -webkit-tap-highlight-color:  rgba(255, 255, 255, 0);",c=`filter:url(#shadow-${t.svgLayerElement.id});`,l=`${s}${c}`;return o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("fill",n),o.setAttribute("font-family",r),o.setAttribute("font-size",i),o.setAttribute("style",l),o.setAttribute("pointer-events","visible"),o}function bne(t){const n=document.createElementNS("http://www.w3.org/2000/svg","tspan");return n.setAttribute("x","0"),n.setAttribute("dy","1.2em"),n.textContent=t,n}function Sne(t,e){let n=t.querySelector("rect.background");if(!e)return n&&t.removeChild(n),t.getBBox();n||(n=document.createElementNS("http://www.w3.org/2000/svg","rect"),n.setAttribute("class","background"),t.insertBefore(n,t.firstChild));const r=t.getBBox(),i={x:`${r.x}`,y:`${r.y}`,width:`${r.width}`,height:`${r.height}`,fill:e};return Rd(i,n),r}function fAt(t,e,n,r,i,a,o={}){const s=r.length>0?wne(r,i):i,c=dAt(a),l=wne(c,s),u=Object.assign({color:"rgb(255, 255, 0)",lineWidth:"1",lineDash:"2,3"},o);R0(t,e,`link-${n}`,s,l,u)}function dAt(t){const{x:e,y:n,height:r,width:i}=t,a=i/2,o=r/2,s=[e+a,n],c=[e,n+o],l=[e+a,n+r],u=[e+i,n+o];return[s,c,l,u]}function F2(t,e,n,r,i,a,o,s={}){const c=Object.assign({handleRadius:"6",centering:{x:!1,y:!0}},s),l=h6(t,e,n,r,i,c);return fAt(t,e,n,a,i,l,c),l}function hAt(t,e,n,r,i={},a=""){const{color:o,width:s,lineWidth:c,lineDash:l}=Object.assign({color:"rgb(0, 255, 0)",width:"2",lineWidth:void 0,lineDash:void 0},i),u=c||s,f="http://www.w3.org/2000/svg",d=_p(e,"rect",n),h=t.getSvgNode(d),[m,p,y,x]=r,S=Math.hypot(m[0]-p[0],m[1]-p[1]),C=Math.hypot(m[0]-y[0],m[1]-y[1]),_=[(x[0]+m[0])/2,(x[1]+m[1])/2],T=[(y[0]+m[0])/2,(y[1]+m[1])/2],O=Math.atan2(_[1]-T[1],_[0]-T[0])*180/Math.PI,M={x:`${_[0]-S/2}`,y:`${_[1]-C/2}`,width:`${S}`,height:`${C}`,stroke:o,fill:"transparent",transform:`rotate(${O} ${_[0]} ${_[1]})`,"stroke-width":u,"stroke-dasharray":l};if(h)Rd(M,h),t.setNodeTouched(d);else{const I=document.createElementNS(f,"rect");a!==""&&I.setAttribute("data-id",a),R1(M,I),t.appendNode(I,d)}}function gAt(t,e){const n=yt(t),{renderingEngineId:r,viewportId:i}=n,a=Is(i,r);if(!a)return[];const o=[],s=Object.keys(a.toolOptions);for(let c=0;c<s.length;c++){const l=s[c],u=a.toolOptions[l];if(u&&e.includes(u.mode)){const f=a.getToolInstance(l);o.push(f)}}return o}const{Active:pAt,Passive:mAt,Enabled:vAt}=vi;class yAt{constructor(){this._needsRender=new Set,this._animationFrameSet=!1,this._animationFrameHandle=null,this._renderFlaggedViewports=()=>{this._throwIfDestroyed();const e=Array.from(this._viewportElements.values());for(let n=0;n<e.length;n++){const r=e[n];if(this._needsRender.has(r)&&(this._triggerRender(r),this._needsRender.delete(r),this._needsRender.size===0))break}this._animationFrameSet=!1,this._animationFrameHandle=null,this._render()},this._viewportElements=new Map}addViewportElement(e,n){this._viewportElements.set(e,n)}removeViewportElement(e,n){this._viewportElements.delete(e),this._needsRender.delete(n),this._reset()}renderViewport(e){this._setViewportsToBeRenderedNextFrame([e])}_throwIfDestroyed(){if(this.hasBeenDestroyed)throw new Error("this.destroy() has been manually called to free up memory, can not longer use this instance. Instead make a new one.")}_setAllViewportsToBeRenderedNextFrame(){[...this._viewportElements.values()].forEach(n=>{this._needsRender.add(n)}),this._renderFlaggedViewports()}_setViewportsToBeRenderedNextFrame(e){const n=[...this._viewportElements.values()];e.forEach(r=>{n.indexOf(r)!==-1&&this._needsRender.add(r)}),this._render()}_render(){this._needsRender.size>0&&this._animationFrameSet===!1&&(this._animationFrameHandle=window.requestAnimationFrame(this._renderFlaggedViewports),this._animationFrameSet=!0)}_triggerRender(e){const n=yt(e);if(!n)return;if(!O1(n.renderingEngineId)){console.warn("rendering Engine has been destroyed");return}const i=gAt(e,[pAt,mAt,vAt]),{renderingEngineId:a,viewportId:o}=n,s={element:e,renderingEngineId:a,viewportId:o};aAt(e,c=>{let l=!1;const u=f=>{if(f.renderAnnotation){const d=f.renderAnnotation(n,c);l=l||d}};i.forEach(u),l&&dt(e,ge.ANNOTATION_RENDERED,{...s})})}_reset(){window.cancelAnimationFrame(this._animationFrameHandle),this._needsRender.clear(),this._animationFrameSet=!1,this._animationFrameHandle=null,this._setAllViewportsToBeRenderedNextFrame()}}const iB=new yAt;function D3(t){iB.renderViewport(t)}function Qt(t){t.length&&t.forEach(e=>{const n=Ai(e);if(!n){console.warn(`Viewport not available for ${e}`);return}const{viewport:r}=n;if(!r){console.warn(`Viewport not available for ${e}`);return}const i=r.element;D3(i)})}function xAt(t,e){const n=t.length,r=[];for(let i=0;i<n;i++){const a=t[i];a.getFrameOfReferenceUID()===e&&r.push(a)}return r}const{Active:wAt,Passive:bAt,Enabled:SAt}=vi;function CAt(t,e){const n=t.length,r=[];for(let i=0;i<n;i++){const a=t[i],o=Is(a.id,a.renderingEngineId);if(!o)continue;_At(o,e)&&r.push(a)}return r}function _At(t,e){const{toolOptions:n}=t,r=n[e];if(!r)return!1;const i=r.mode;return i===wAt||i===bAt||i===SAt}function TAt(t,e,n=.999){return t.filter(r=>{const i=r.getCamera();return Math.abs(Vt(i.viewPlaneNormal,e.viewPlaneNormal))>n})}function ra(t,e,n=!0){const r=yt(t),{renderingEngine:i,FrameOfReferenceUID:a}=r;let o=i.getViewports();o=xAt(o,a),o=CAt(o,e);const s=i.getViewport(r.viewportId);return n&&(o=TAt(o,s.getCamera())),o.map(l=>l.id)}const g6="PlanarFreehandContourSegmentationTool";function aB(t,e){const n=t.length,r=new Array(n);for(let i=0;i<n;i++)r[i]=e.worldToCanvas(t[i]);return r}function EAt(t,e){return u9(e).map(n=>{const r=n,i=aB(r.data.contour.polyline,t);return{annotation:r,polyline:i}})}function Y4e(t,e,n){T3(e,n),h1(n);const{contour:r}=n.data,i=aB(r.polyline,t);jd(n,{points:i,closed:r.closed,targetWindingDirection:e.data.contour.windingDirection===Tl.Clockwise?Tl.CounterClockwise:Tl.Clockwise},t);const{element:a}=t;X4e(t,[e,n])}function OAt(t,e,n,r,i){if(!f9(g6)){console.warn(`${g6} is not registered in cornerstone. Cannot combine polylines.`);return}const a=i[0],o=Xs(n,a),s=EAt(t,e),c=new Set(s),l=new Map,u=(S,C)=>{let _=l.get(S);_||(_=[],l.set(S,_)),_.push(C),c.delete(C)},f=[];if(o){const S=rB(n,i);f.push(S),Array.from(c.keys()).forEach(C=>u(S,C))}else JF(n,i).forEach(C=>{f.push(C),Array.from(c.keys()).forEach(_=>{O3(C,_.polyline)&&u(C,_)})});Array.from(l.values()).forEach(S=>S.forEach(C=>l9(C.annotation)));const{element:d}=t,{metadata:h,data:m}=e,{handles:p,segmentation:y}=m,{textBox:x}=p;rc(r.annotationUID),rc(e.annotationUID),h1(r),h1(e);for(let S=0;S<f.length;S++){const C=f[S];if(!C||C.length<3){console.warn("Skipping creation of new annotation due to invalid polyline:",C);continue}const _=DAt(t,e,C);Ao(_,d),g1(_),ji(_,t.element),l.get(C)?.forEach(T=>T3(_,T.annotation))}X4e(t,[e,r])}function DAt(t,e,n){const r=t.canvasToWorld(n[0]),i=t.canvasToWorld(n[n.length-1]),a={metadata:{...e.metadata,toolName:g6,originalToolName:e.metadata.originalToolName||e.metadata.toolName},data:{cachedStats:{},handles:{points:[r,i],textBox:e.data.handles.textBox?{...e.data.handles.textBox}:void 0},contour:{polyline:[],closed:!0},spline:e.data.spline,segmentation:{...e.data.segmentation}},annotationUID:ya(),highlighted:!0,invalidated:!0,isLocked:!1,isVisible:void 0,interpolationUID:e.interpolationUID,interpolationCompleted:e.interpolationCompleted};return jd(a,{points:n,closed:!0,targetWindingDirection:Tl.Clockwise},t),a}function X4e(t,e){const{element:n}=t,r=new Set([g6]);e.forEach(i=>{r.add(i.metadata.toolName)});for(const i of r.values())if(f9(i)){const a=ra(n,i);Qt(a)}}function y9(t){return!!t.data?.segmentation}function MAt(t,e,n){const r=[],i=d6(e);for(let a=0;a<n.length;a++){const o=n[a],s=RAt(o.data.contour.polyline,t),c=d6(s);if(!Ckt(i,c))continue;const u=nB(e,s),f=!u&&O3(s,e);(u||f)&&r.push({targetAnnotation:o,targetPolyline:s,isContourHole:f})}return r}function RAt(t,e){const n=t.length,r=new Array(n);for(let i=0;i<n;i++)r[i]=e.worldToCanvas(t[i]);return r}const p6="PlanarFreehandContourSegmentationTool";function IAt(t,e,n,r){const i=r.filter(o=>o.isContourHole),a=r.filter(o=>!o.isContourHole);if(i.length>0){const o=i[0];LAt(t,o.targetAnnotation,e),Z4e(t,[e,o.targetAnnotation]);return}if(a.length!==0){if(!f9(p6)){console.warn(`${p6} is not registered in cornerstone. Cannot process multiple intersections.`);return}NAt(t,e,n,a)}}function NAt(t,e,n,r){const{element:i}=t,a=[e],o=[],s=[];r.forEach(({targetAnnotation:d})=>{const h=AAt(t,d);s.push(...h),a.push(d)});const c=n[0];if(r.some(({targetPolyline:d})=>Xs(d,c))){let d=n;r.forEach(({targetPolyline:h})=>{d=rB(d,h)}),o.push(d)}else r.forEach(({targetPolyline:d})=>{const h=JF(d,n);o.push(...h)});a.forEach(d=>{rc(d.annotationUID),h1(d)}),s.forEach(d=>l9(d.annotation));const u=r[0].targetAnnotation,f=[];o.forEach(d=>{if(!d||d.length<3){console.warn("Skipping creation of new annotation due to invalid polyline:",d);return}const h=PAt(t,u,d);Ao(h,i),g1(h),ji(h,t.element),f.push(h)}),kAt(t,s,f),Z4e(t,a)}function PAt(t,e,n){const r=t.canvasToWorld(n[0]),i=t.canvasToWorld(n[n.length-1]),a={metadata:{...e.metadata,toolName:p6,originalToolName:e.metadata.originalToolName||e.metadata.toolName},data:{cachedStats:{},handles:{points:[r,i],textBox:e.data.handles.textBox?{...e.data.handles.textBox}:void 0},contour:{polyline:[],closed:!0},spline:e.data.spline,segmentation:{...e.data.segmentation}},annotationUID:ya(),highlighted:!0,invalidated:!0,isLocked:!1,isVisible:void 0,interpolationUID:e.interpolationUID,interpolationCompleted:e.interpolationCompleted};return jd(a,{points:n,closed:!0,targetWindingDirection:Tl.Clockwise},t),a}function kAt(t,e,n){e.forEach(r=>{const i=n.find(a=>{const o=oB(a.data.contour.polyline,t);return O3(o,r.polyline)});i&&T3(i,r.annotation)})}function AAt(t,e){return u9(e).map(n=>{const r=n,i=oB(r.data.contour.polyline,t);return{annotation:r,polyline:i}})}function LAt(t,e,n){T3(e,n),h1(n);const{contour:r}=n.data,i=oB(r.polyline,t);jd(n,{points:i,closed:r.closed,targetWindingDirection:e.data.contour.windingDirection===Tl.Clockwise?Tl.CounterClockwise:Tl.Clockwise},t)}function oB(t,e){const n=t.length,r=new Array(n);for(let i=0;i<n;i++)r[i]=e.worldToCanvas(t[i]);return r}function Z4e(t,e){const{element:n}=t,r=new Set([p6]);e.forEach(i=>{r.add(i.metadata.toolName)});for(const i of r.values())if(f9(i)){const a=ra(n,i);Qt(a)}}const{isEqual:Cne}=Bc;function Q4e(t){const{metadata:e}=t;return VIt().filter(n=>{if(n.FrameOfReferenceUID===e.FrameOfReferenceUID){const r=n.viewport,{viewPlaneNormal:i,viewUp:a}=r.getCamera();return Cne(i,e.viewPlaneNormal)&&(!e.viewUp||Cne(a,e.viewUp))}}).map(n=>n.viewport)}function VAt(t){if(!t)throw new Error(`No contours found for geometryId ${t.id}`);const e=t.id;if(t.type!==OT.CONTOUR)throw new Error(`Geometry type ${t.type} not supported for rendering.`);if(!t.data){console.warn(`No contours found for geometryId ${e}. Skipping render.`);return}}function $At(t,e,n,r){n.size?t.render():jAt(t,e,r)}function jAt(t,e,n){const{segmentationId:r}=n,i=new Map;e.forEach(a=>{const o=Ct.getGeometry(a);if(!o){console.warn(`No geometry found for geometryId ${a}. Skipping render.`);return}const s=o.data.segmentIndex;VAt(o);const c=xy.getStyle({viewportId:t.id,segmentationId:r,type:Dn.Contour,segmentIndex:s}),l=o.data,u=t.getCamera().viewPlaneNormal;l.contours.forEach(f=>{const{points:d,color:h,id:m}=f,p=tkt(t,d[0],u),y={annotationUID:ya(),data:{contour:{closed:!0,polyline:d},segmentation:{segmentationId:r,segmentIndex:s,color:h,id:m},handles:{}},handles:{},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!0,isVisible:!0,metadata:{referencedImageId:p,toolName:"PlanarFreehandContourSegmentationTool",FrameOfReferenceUID:t.getFrameOfReferenceUID(),viewPlaneNormal:t.getCamera().viewPlaneNormal}},x=t.element;Ao(y,x),g1(y)}),c&&i.set(s,c)}),t.render()}function UAt(t,e,n=!1){const r=zc(e),{annotationUIDsMap:i}=r.representationData.Contour;i.forEach(a=>{a.forEach(o=>{rc(o)})})}function FAt(t){const e=IPt(t);if(e)return e;const n=zc(t);if(!n)throw new Error(`No segmentation found for segmentationId ${t}`);let r;if(n.representationData.Labelmap)r=BAt(n,t);else if(n.representationData.Contour)r=WAt(n);else if(n.representationData.Surface)r=HAt(n);else throw new Error(`Unsupported segmentation type: ${n.representationData}`);return NPt(t,r),r}function BAt(t,e){const n=t.representationData[Dn.Labelmap],r=new Set;return n.imageIds?GAt(r,n.imageIds):zAt(r,e),Array.from(r).map(Number).sort((i,a)=>i-a)}function zAt(t,e){Ct.getVolume(e).voxelManager.forEach(({value:r})=>{r!==0&&t.add(r)})}function GAt(t,e){e.forEach(n=>{Ct.getImage(n).voxelManager.getScalarData().forEach(a=>{a!==0&&t.add(a)})})}function WAt(t){const{annotationUIDsMap:e,geometryIds:n}=t.representationData.Contour||{};if(!n)throw new Error(`No geometryIds found for segmentationId ${t.segmentationId}`);const r=new Set([...e.keys()]);return n.forEach(i=>{const a=Ct.getGeometry(i);r.add(a.data.segmentIndex)}),Array.from(r).sort((i,a)=>i-a)}function HAt(t){const e=t.representationData.Surface?.geometryIds??[];return Array.from(e.keys()).map(Number).sort((n,r)=>n-r)}const Ov=new Map,_ne=new Map;function qAt(t,e,n=!1){const r=Ai(t);if(!r)return;const{viewport:i}=r;UAt(t,e),n&&i.render()}async function KAt(t,e){const{segmentationId:n}=e,r=zc(n);if(!r)return;let i=r.representationData[Dn.Contour];const a=ah();if(!i&&ah()?.canComputeRequestedRepresentation(n,Dn.Contour)&&!Ov.get(t.id)?(Ov.set(t.id,!0),i=await YF(n,Dn.Contour,()=>a.computeContourData(n,{viewport:t}),()=>{}),Ov.set(t.id,!1)):!i&&!ah()&&console.debug(`No contour data found for segmentationId ${n} and PolySeg add-on is not configured. Unable to convert from other representations to contour. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`),!i||!i.geometryIds?.length)return;let o=!1;const s=t.getCamera().viewPlaneNormal;i.annotationUIDsMap&&(o=!XAt(i.annotationUIDsMap,s)),i.geometryIds.length>0&&(o=!YAt(i.geometryIds,s));const c=_ne.get(t.id)||new Set;if(o&&!Ov.get(t.id)&&!c.has(n)&&t.viewportStatus===Ss.RENDERED){Ov.set(t.id,!0);const l=FAt(n),f=(await a.computeSurfaceData(n,{segmentIndices:l,viewport:t})).geometryIds,d=[];for(const y of f.values()){const S=Ct.getGeometry(y).data;d.push({points:S.points,polys:S.polys,segmentIndex:S.segmentIndex,id:S.segmentIndex})}const h=await a.clipAndCacheSurfacesForViewport(d,t),m=a.extractContourData(h),p=a.createAndAddContourSegmentationsFromClippedSurfaces(m,t,n);i.annotationUIDsMap=new Map([...i.annotationUIDsMap,...p]),c.add(n),_ne.set(t.id,c),Ov.set(t.id,!1)}$At(t,i.geometryIds,i.annotationUIDsMap,e)}function YAt(t,e){let n=null,r=null;for(const f of t){const d=Ct.getGeometry(f);if(!d)continue;const h=d.data;if(h.contours?.[0]?.points?.length>=3){n=d,r=h;break}}if(!n||!r)return!1;const a=r.contours[0].points,o=a[0],s=a[1],c=a[2];let l=Tr(ut(),yr(ut(),s,o),yr(ut(),c,o));l=Vr(ut(),l);const u=Vt(l,e);return Math.abs(u)>.9}function XAt(t,e){const n=Array.from(t.values()).flat().map(i=>Array.from(i)).flat(),r=UF(n,3);for(const i of r){const a=as(i);if(a?.metadata){if(!a.metadata.viewPlaneNormal)continue;const o=a.metadata.viewPlaneNormal,s=Math.abs(e[0]*o[0]+e[1]*o[1]+e[2]*o[2]);if(Math.abs(s-1)>.01)return!1}}return!0}const ZAt={render:KAt,removeRepresentation:qAt};function nb(t,e){return $d.getCurrentLabelmapImageIdsForViewport(t,e)}const Tne=new Map,QAt=({cfun:t,ofun:e,actor:n})=>{n.getProperty().setRGBTransferFunction(1,t),n.getProperty().setScalarOpacity(1,e)};async function JAt({viewport:t,volumeInputs:e,segmentationId:n}){const r=t.getDefaultActor(),{actor:i}=r,{uid:a,callback:o}=r,s=t.getVolumeId();if(Tne.get(a)?.added)return{uid:a,actor:i};const c=e,l=Ct.getVolume(c[0].volumeId);if(!l)throw new Error(`imageVolume with id: ${l.volumeId} does not exist`);const{volumeId:u}=c[0],f=await Ybe(u);if(!f)throw new Error(`segImageVolume with id: ${f.volumeId} does not exist`);const h=f.voxelManager.getCompleteScalarDataArray(),{imageData:m}=f,p=Ct.getVolume(s),x=p.voxelManager.getCompleteScalarDataArray(),S=2,C=new Float32Array(S*p.voxelManager.getScalarDataLength()),_=m.getDimensions();for(let V=0;V<_[2];++V)for(let k=0;k<_[1];++k)for(let L=0;L<_[0];++L){const $=L+_[0]*(k+_[1]*V);C[$*S+0]=x[$],C[$*S+1]=h[$]}t.removeActors([a]);const T=i.getMapper(),O=iMt(T);i.setMapper(O),O.setBlendMode(Ug.LABELMAP_EDGE_PROJECTION_BLEND);const M=O.getInputData().getPointData().getArray(0);M.setData(C),M.setNumberOfComponents(2),i.getProperty().setColorMixPreset(1),i.getProperty().setForceNearestInterpolation(1,!0),i.getProperty().setIndependentComponents(!0),t.addActor({actor:i,uid:a,callback:o,referencedId:s,representationUID:`${n}-${Dn.Labelmap}`}),Tne.set(a,{added:!0,segmentationRepresentationUID:`${n}`,originalBlendMode:t.getBlendMode()}),i.set({preLoad:QAt});function I(V){const{segmentationId:k}=V.detail,{representationData:L}=zc(k),{volumeId:$}=L.Labelmap;if($!==f.volumeId)return;const G=Ct.getVolume($).voxelManager,oe=O.getInputData(),U=oe.getPointData().getArray(0),Y=U.getData(),J=2,ne=m.getDimensions(),F=Array.from({length:ne[2]},(ae,re)=>re);for(const ae of F)for(let re=0;re<ne[1];++re)for(let te=0;te<ne[0];++te){const ye=te+ne[0]*(re+ne[1]*ae);Y[ye*J+1]=G.getAtIndex(ye)}U.setData(Y),oe.modified(),t.render()}return pt.addEventListenerDebounced(ge.SEGMENTATION_DATA_MODIFIED,I,200),pt.addEventListener(ge.SEGMENTATION_REPRESENTATION_REMOVED,async V=>{pt.removeEventListener(ge.SEGMENTATION_DATA_MODIFIED,I);const k=t.getActor(a),{element:L,id:$}=t;t.removeActors([a]);const W=await xk({volumeId:a,blendMode:Ug.MAXIMUM_INTENSITY_BLEND,callback:({volumeActor:G})=>{k.callback&&k.callback({volumeActor:G,volumeId:u})}},L,$);t.addActor({actor:W,uid:a}),t.render()}),{uid:a,actor:i}}const{uuidv4:J4e}=Bc;async function eLt(t,e,n,r){const i=yt(t),{renderingEngine:a,viewport:o}=i,{id:s}=o,c=!0,l=!1,u=!0;if(o instanceof Tu){const d=tLt(e,n);Ct.getVolume(d)||await nLt(e);let h=r?.blendMode??Ug.MAXIMUM_INTENSITY_BLEND,m=h===Ug.LABELMAP_EDGE_PROJECTION_BLEND;if(m){const y=o.getVolumeId(),x=Ct.getVolume(y),C=Ct.getVolume(d).dimensions,_=x.dimensions;(C[0]!==_[0]||C[1]!==_[1]||C[2]!==_[2])&&(m=!1,h=Ug.MAXIMUM_INTENSITY_BLEND,console.debug("Dimensions mismatch - falling back to regular volume addition"))}const p=[{volumeId:d,visibility:c,representationUID:`${n}-${Dn.Labelmap}`,useIndependentComponents:m,blendMode:h}];if(!p[0].useIndependentComponents)await iIt(a,p,[s],l,u);else return await JAt({viewport:o,volumeInputs:p,segmentationId:n})}else{const d=nb(o.id,n).map(h=>({imageId:h,representationUID:`${n}-${Dn.Labelmap}-${h}`}));aIt(a,d,[s])}p9(n)}function tLt(t,e){let{volumeId:n}=t;if(!n){n=J4e();const r=zc(e);r.representationData.Labelmap={...r.representationData.Labelmap,volumeId:n},t.volumeId=n,m9(e)}return n}async function nLt(t){const e=t;if(!(e.imageIds.length>0))throw new Error("cannot create labelmap, no imageIds found for the volume labelmap");return await QDt(t.volumeId||J4e(),e.imageIds)}function rLt(t,e){const n=yt(t),{viewport:r}=n;r.removeActors([GPt(r.id,e)])}function sB(t){return $d.getActiveSegmentation(t)}function iLt(t){return sB(t)}function cB(t){const e=zc(t);if(e){const n=Object.keys(e.segments).find(r=>e.segments[r].active);return n?Number(n):void 0}}const oI=255,tw=new Map;let sI=!1;function aLt(t,e,n=!1){const r=Ai(t);if(tw.forEach((a,o)=>{o.includes(e)&&tw.delete(o)}),!r)return;const{viewport:i}=r;rLt(i.element,e),n&&i.render()}async function oLt(t,e){const{segmentationId:n,config:r}=e,i=zc(n);if(!i){console.warn("No segmentation found for segmentationId: ",n);return}let a=i.representationData[Dn.Labelmap],o=ew(t.id,n);if(!a&&ah()?.canComputeRequestedRepresentation(n,Dn.Labelmap)&&!sI){sI=!0;const s=ah();if(a=await YF(n,Dn.Labelmap,()=>s.computeLabelmapData(n,{viewport:t}),()=>null,()=>{$d.processLabelmapRepresentationAddition(t.id,n),setTimeout(()=>{p9(n)},0)}),!a)throw new Error(`No labelmap data found for segmentationId ${n}.`);sI=!1}else!a&&!ah()&&console.debug(`No labelmap data found for segmentationId ${n} and PolySeg add-on is not configured. Unable to convert from other representations to labelmap. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);if(a){if(t instanceof is)o?.length||await One(t,a,n,r),o=ew(t.id,n);else{if(!nb(t.id,n)?.length)return;o||await One(t,a,n,r),o=ew(t.id,n)}if(o?.length)for(const s of o)sLt(t.id,s,e)}}function sLt(t,e,n){const{segmentationId:r}=n,{cfun:i,ofun:a}=n.config,{colorLUTIndex:o}=n,c=iLt(t)?.segmentationId===r,l=xy.getStyle({viewportId:t,type:Dn.Labelmap,segmentationId:r}),u=xy.getRenderInactiveSegmentations(t),f=KF(o),d=Math.min(256,f.length),{outlineWidth:h,renderOutline:m,outlineOpacity:p,activeSegmentOutlineWidthDelta:y}=Ene(l,c),x=XF(t,{segmentationId:r,type:Dn.Labelmap});for(let T=0;T<d;T++){const O=T,M=f[O],V=xy.getStyle({viewportId:t,type:Dn.Labelmap,segmentationId:r,segmentIndex:O}),{fillAlpha:k,outlineWidth:L,renderFill:$,renderOutline:W}=Ene(l,c,V),{forceOpacityUpdate:G,forceColorUpdate:oe}=cLt(t,r,O,{fillAlpha:k,renderFill:$,renderOutline:W,segmentColor:M,outlineWidth:L,segmentsHidden:x,cfun:i,ofun:a});if(oe&&i.addRGBPoint(O,M[0]/oI,M[1]/oI,M[2]/oI),G)if($){const U=x.has(O)?0:M[3]/255*k;a.removePoint(O),a.addPointLong(O,U,.5,1)}else a.addPointLong(O,.01,.5,1)}a.setClamping(!1);const S=e.actor,{preLoad:C}=S.get?.("preLoad")||{preLoad:null};if(C?C({cfun:i,ofun:a,actor:S}):(S.getProperty().setRGBTransferFunction(0,i),S.getProperty().setScalarOpacity(0,a),S.getProperty().setInterpolationTypeToNearest()),m){S.getProperty().setUseLabelOutline(m),S.getProperty().setLabelOutlineOpacity(p);const T=cB(n.segmentationId),O=new Array(d-1);for(let M=1;M<d;M++){if(x.has(M)){O[M-1]=0;continue}O[M-1]=M===T?h+y:h}S.getProperty().setLabelOutlineThickness(O),S.modified(),S.getProperty().modified(),S.getMapper().modified()}else S.getProperty().setLabelOutlineThickness(new Array(d-1).fill(0));const _=c||u;S.setVisibility(_)}function Ene(t,e,n){const i={...t,...n||{}},a=e?i.fillAlpha:i.fillAlphaInactive,o=e?i.outlineWidth:i.outlineWidthInactive,s=e?i.renderFill:i.renderFillInactive,c=e?i.renderOutline:i.renderOutlineInactive,l=e?i.outlineOpacity:i.outlineOpacityInactive,u=i.activeSegmentOutlineWidthDelta;return{fillAlpha:a,outlineWidth:o,renderFill:s,renderOutline:c,outlineOpacity:l,activeSegmentOutlineWidthDelta:u}}function cLt(t,e,n,{fillAlpha:r,renderFill:i,renderOutline:a,segmentColor:o,outlineWidth:s,segmentsHidden:c,cfun:l,ofun:u}){const f=`${t}-${e}-${n}`,d=tw.get(f);if(!d)return tw.set(f,{fillAlpha:r,renderFill:i,renderOutline:a,outlineWidth:s,segmentColor:o.slice(),segmentsHidden:new Set(c),cfunMTime:l.getMTime(),ofunMTime:u.getMTime()}),{forceOpacityUpdate:!0,forceColorUpdate:!0};const{fillAlpha:h,renderFill:m,renderOutline:p,outlineWidth:y,segmentColor:x,segmentsHidden:S,cfunMTime:C,ofunMTime:_}=d,T=x[0]!==o[0]||x[1]!==o[1]||x[2]!==o[2],O=x[3]!==o[3]||h!==r||m!==i||p!==a||y!==s||S!==c;return(O||T)&&tw.set(f,{fillAlpha:r,renderFill:i,renderOutline:a,outlineWidth:s,segmentColor:o.slice(),segmentsHidden:new Set(c),cfunMTime:l.getMTime(),ofunMTime:u.getMTime()}),{forceOpacityUpdate:O,forceColorUpdate:T}}async function One(t,e,n,r){return await eLt(t.element,e,n,r)||void 0}const lLt={render:oLt,removeRepresentation:aLt},{DefaultHistoryMemo:Dv}=jF,ow=class ow{constructor(e,n){const r=ow.mergeDefaultProps(ow.defaults,n),i=Ac(r,e),{configuration:a={},supportedInteractionTypes:o,toolGroupId:s}=i;this.toolGroupId=s,this.supportedInteractionTypes=o||[],this.configuration=Object.assign({},a),this.mode=vi.Disabled}static mergeDefaultProps(e={},n){return n?Ac(e,n):e}get toolName(){return this.getToolName()}getToolName(){return this.constructor.toolName}applyActiveStrategy(e,n){const{strategies:r,activeStrategy:i}=this.configuration;return r[i]?.call(this,e,n)}applyActiveStrategyCallback(e,n,r,...i){const{strategies:a,activeStrategy:o}=this.configuration;if(!a[o])throw new Error(`applyActiveStrategyCallback: active strategy ${o} not found, check tool configuration or spellings`);return a[o][r]?.call(this,e,n,...i)}setConfiguration(e){this.configuration=Ac(this.configuration,e)}setActiveStrategy(e){this.setConfiguration({activeStrategy:e})}getTargetImageData(e){if(e.startsWith("imageId:")){const n=e.split("imageId:")[1],r=ma(n);let i=a6(r);return!i||!i.length||(i=i.filter(a=>a.getCurrentImageId()===n),!i||!i.length)?void 0:i[0].getImageData()}else if(e.startsWith("volumeId:")){const n=V2(e),r=t9(n);return!r||!r.length?void 0:r[0].getImageData()}else if(e.startsWith("videoId:")){const n=ma(e),r=a6(n);return!r||!r.length?void 0:r[0].getImageData()}else throw new Error('getTargetIdImage: targetId must start with "imageId:" or "volumeId:"')}getTargetId(e){const n=e.getViewReferenceId?.();if(n)return n;throw new Error("getTargetId: viewport must have a getViewReferenceId method")}undo(){this.doneEditMemo(),Dv.undo()}redo(){Dv.redo()}static createZoomPanMemo(e){const n={pan:e.getPan(),zoom:e.getZoom()},r={restoreMemo:()=>{const i=e.getPan(),a=e.getZoom();e.setZoom(n.zoom),e.setPan(n.pan),e.render(),n.pan=i,n.zoom=a}};return Dv.push(r),r}doneEditMemo(){this.memo?.commitMemo?.()&&Dv.push(this.memo),this.memo=null}static startGroupRecording(){Dv.startGroupRecording()}static endGroupRecording(){Dv.endGroupRecording()}};ow.defaults={configuration:{strategies:{},defaultStrategy:void 0,activeStrategy:void 0,strategyOptions:{}}};let up=ow;up.toolName="BaseTool";const{isEqual:cI}=Bc,{EPSILON:uLt}=wU,fLt=1-uLt;function dLt(t,e,n){const{viewPlaneNormal:r}=e,i=t.filter(c=>{const{planeRestriction:l,referencedImageId:u}=c.metadata;let{viewPlaneNormal:f}=c.metadata;if(l){const{inPlaneVector1:h,inPlaneVector2:m}=l;return!(h&&!cI(0,Vt(r,h))||m&&!cI(0,Vt(r,m)))}if(!c.metadata.referencedImageId&&!f&&c.metadata.FrameOfReferenceUID){for(const h of c.data.handles.points){const m=yr(ut(),h,e.focalPoint),p=Vt(m,r);if(!cI(p,0))return!1}return c.metadata.viewPlaneNormal=r,c.metadata.cameraFocalPoint=e.focalPoint,!0}if(!f&&u){const{imageOrientationPatient:h}=Ot("imagePlaneModule",u),m=Zn(h[0],h[1],h[2]),p=Zn(h[3],h[4],h[5]);f=ut(),Tr(f,m,p),c.metadata.viewPlaneNormal=f}const d=Math.abs(Vt(r,f))>fLt;return f&&d});if(!i.length)return[];const a=n/2,{focalPoint:o}=e,s=[];for(const c of i){const l=c.data,u=l.handles.points[0]||l.contour?.polyline[0];if(!c.isVisible)continue;const f=ut();if(!u){s.push(c);continue}yr(f,o,u);const d=Vt(f,r);Math.abs(d)<a&&s.push(c)}return s}function eSe(t,e,n={}){if(t instanceof is){const r=t.getCamera(),{spacingInNormalDirection:i}=S3(t,r);return dLt(e,r,i)}if(t instanceof Ms){const r=t.getCurrentImageId();if(!r)return[];const i=r.indexOf(":");n.imageURI=r.substring(i+1)}return e.filter(r=>r.isVisible?r.data.isCanvasAnnotation?!0:t.isReferenceViewable(r.metadata,n):!1)}function hLt(t){if(t){if(t.data&&t.highlighted)return Eg.Highlighted;if(v9(t.annotationUID))return Eg.Selected;if(xf(t.annotationUID))return Eg.Locked;if(t.data&&t.autoGenerated)return Eg.AutoGenerated}return Eg.Default}class x9 extends up{constructor(){super(...arguments),this.onImageSpacingCalibrated=e=>{const{element:n,imageId:r}=e.detail,i=ma(r),a=Vd();a.getFramesOfReference().forEach(s=>{const l=a.getAnnotations(s)[this.getToolName()];!l||!l.length||(l.forEach(u=>{if(!u.metadata?.referencedImageId)return;ma(u.metadata.referencedImageId)===i&&(u.invalidated=!0,u.data.cachedStats={})}),D3(n))})}}filterInteractableAnnotationsForElement(e,n){if(!n?.length)return[];const r=yt(e),{viewport:i}=r;return eSe(i,n)}static createAnnotation(...e){let n={annotationUID:null,highlighted:!0,invalidated:!0,isLocked:!1,isVisible:!0,metadata:{toolName:this.toolName},data:{handles:{points:new Array,activeHandleIndex:null,textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}},cachedStats:{},label:""}};for(const r of e)n=Ac(n,r);return n}createAnnotation(e,n,...r){const i=e.detail,{currentPoints:a,element:o}=i,{world:s}=a,c=yt(o),{viewport:l}=c,u=l.getCamera(),{viewPlaneNormal:f,viewUp:d,position:h}=u,m=this.getReferencedImageId(l,s,f,d),p=l.getViewReference({points:[s]});return x9.createAnnotation({metadata:{toolName:this.getToolName(),...p,referencedImageId:m,viewUp:d,cameraPosition:h},data:{handles:{points:n||[]}}},...r)}getReferencedImageId(e,n,r,i){const a=this.getTargetId(e);let o=a.split(/^[a-zA-Z]+:/)[1];if(e instanceof Tu){const s=V2(a),c=Ct.getVolume(s);o=Zw(c,n,r)}return o}getStyle(e,n,r){return cp(e,n,hLt(r),this.mode)}}x9.toolName="AnnotationDisplayTool";const{DefaultHistoryMemo:gLt}=jF,{PointsManager:pLt}=Bc;class Nc extends x9{static createAnnotationForViewport(e,...n){return this.createAnnotation({metadata:e.getViewReference()},...n)}static createAndAddAnnotation(e,...n){const r=this.createAnnotationForViewport(e,...n);Ao(r,e.element),ji(r,e.element)}constructor(e,n){super(e,n),this.mouseMoveCallback=(r,i)=>{if(!i)return!1;const{element:a,currentPoints:o}=r.detail,s=o.canvas;let c=!1;for(const l of i){if(xf(l.annotationUID)||!Md(l.annotationUID))continue;const{data:u}=l,f=u.handles?u.handles.activeHandleIndex:void 0,d=this._imagePointNearToolOrHandle(a,l,s,6),h=d&&!l.highlighted,m=!d&&l.highlighted;h||m?(l.highlighted=!l.highlighted,c=!0):u.handles&&u.handles.activeHandleIndex!==f&&(c=!0)}return c},this.isSuvScaled=Nc.isSuvScaled,e.configuration?.getTextLines&&(this.configuration.getTextLines=e.configuration.getTextLines),e.configuration?.statsCalculator&&(this.configuration.statsCalculator=e.configuration.statsCalculator)}getHandleNearImagePoint(e,n,r,i){const a=yt(e),{viewport:o}=a,{data:s}=n,{isCanvasAnnotation:c}=s,{points:l,textBox:u}=s.handles;if(u){const{worldBoundingBox:f}=u;if(f){const d={topLeft:o.worldToCanvas(f.topLeft),topRight:o.worldToCanvas(f.topRight),bottomLeft:o.worldToCanvas(f.bottomLeft),bottomRight:o.worldToCanvas(f.bottomRight)};if(r[0]>=d.topLeft[0]&&r[0]<=d.bottomRight[0]&&r[1]>=d.topLeft[1]&&r[1]<=d.bottomRight[1])return s.handles.activeHandleIndex=null,u}}for(let f=0;f<l?.length;f++){const d=l[f],h=c?d.slice(0,2):o.worldToCanvas(d);if(Ka(r,h)<i===!0)return s.handles.activeHandleIndex=f,d}s.handles.activeHandleIndex=null}getLinkedTextBoxStyle(e,n){return{visibility:this.getStyle("textBoxVisibility",e,n),fontFamily:this.getStyle("textBoxFontFamily",e,n),fontSize:this.getStyle("textBoxFontSize",e,n),color:this.getStyle("textBoxColor",e,n),shadow:this.getStyle("textBoxShadow",e,n),background:this.getStyle("textBoxBackground",e,n),lineWidth:this.getStyle("textBoxLinkLineWidth",e,n),lineDash:this.getStyle("textBoxLinkLineDash",e,n)}}static isSuvScaled(e,n,r){if(e instanceof Tu){const a=V2(n);return Ct.getVolume(a)?.scaling?.PT!==void 0}return typeof(r&&Ot("scalingModule",r))?.suvbw=="number"}getAnnotationStyle(e){const{annotation:n,styleSpecifier:r}=e,i=p=>this.getStyle(p,r,n),{annotationUID:a}=n,o=Md(a),s=xf(a),c=i("lineWidth"),l=i("lineDash"),u=i("angleArcLineDash"),f=i("color"),d=i("markerSize"),h=i("shadow"),m=this.getLinkedTextBoxStyle(r,n);return{visibility:o,locked:s,color:f,lineWidth:c,lineDash:l,lineOpacity:1,fillColor:f,fillOpacity:0,shadow:h,textbox:m,markerSize:d,angleArcLineDash:u}}_imagePointNearToolOrHandle(e,n,r,i){if(this.getHandleNearImagePoint(e,n,r,i)||this.isPointNearTool(e,n,r,i,"mouse"))return!0}static createAnnotationState(e,n){const{data:r,annotationUID:i}=e,a={...r,cachedStats:{}};delete a.contour,delete a.spline;const o={annotationUID:i,data:structuredClone(a),deleting:n},s=r.contour;return s&&(o.data.contour={...s,polyline:null,pointsManager:pLt.create3(s.polyline.length,s.polyline)}),o}static createAnnotationMemo(e,n,r){if(!n)return;const{newAnnotation:i,deleting:a=i?!1:void 0}=r||{},{annotationUID:o}=n,s=Nc.createAnnotationState(n,a),c={restoreMemo:()=>{const l=Nc.createAnnotationState(n,a),{viewport:u}=yt(e)||{};if(u?.setViewReference(n.metadata),s.deleting===!0){if(s.deleting=!1,Object.assign(n.data,s.data),n.data.contour){const d=n.data;d.contour.polyline=s.data.contour.pointsManager.points,delete s.data.contour.pointsManager,d.segmentation&&g1(n)}s.data=l.data,Ao(n,e),vd(n.annotationUID,!0),u?.render();return}if(s.deleting===!1){s.deleting=!0,s.data=l.data,vd(n.annotationUID),rc(n.annotationUID),u?.render();return}const f=as(o);if(!f){console.warn("No current annotation");return}Object.assign(f.data,s.data),f.data.contour&&(f.data.contour.polyline=s.data.contour.pointsManager.points),s.data=l.data,f.invalidated=!0,ji(f,e,na.History)},id:o,operationType:"annotation"};return gLt.push(c),c}createMemo(e,n,r){this.memo||=Nc.createAnnotationMemo(e,n,r)}static hydrateBase(e,n,r,i={}){if(!n)return null;const{viewport:a}=n,o=a.getFrameOfReferenceUID(),s=a.getCamera(),c=i.viewplaneNormal??s.viewPlaneNormal,l=i.viewUp??s.viewUp,u=i.toolInstance||new e;let f,d=c,h=l;if(i.referencedImageId)f=i.referencedImageId,d=void 0,h=void 0;else if(a instanceof Ms){const m=P3e(r[0],a);m!==void 0&&(f=a.getImageIds()[m])}else if(a instanceof Tu)f=u.getReferencedImageId(a,r[0],c,l);else throw new Error("Unsupported viewport type");return{FrameOfReferenceUID:o,referencedImageId:f,viewPlaneNormal:d,viewUp:h,instance:u,viewport:a}}}Nc.toolName="AnnotationTool";const{CalibrationTypes:Xp}=Ad,Zp="px",qS="voxels",tSe=[1,2,3,4],mLt=["3,3","4,7"],vLt=["4,3","4,7"],Pk={0:"px",1:"percent",2:"dB",3:"cm",4:"seconds",5:"hertz",6:"dB/seconds",7:"cm/sec",8:"cm²",9:"cm²/s",12:"degrees"},yLt=.001,u5="²",w9=(t,e)=>{const{calibration:n,hasPixelSpacing:r}=t;let i=r?"mm":Zp;const a=r?"mm³":qS;let o=i+u5,s=1,c="";if(!n||!n.type&&!n.sequenceOfUltrasoundRegions)return{unit:i,areaUnit:o,scale:s,volumeUnit:a};if(n.type===Xp.UNCALIBRATED)return{unit:Zp,areaUnit:Zp+u5,scale:s,volumeUnit:qS};if(n.sequenceOfUltrasoundRegions){let u,f;if(Array.isArray(e)&&e.length===2)[u,f]=e;else if(typeof e=="function"){const x=e();u=x[0],f=x[1]}let d=n.sequenceOfUltrasoundRegions.filter(x=>u[0]>=x.regionLocationMinX0&&u[0]<=x.regionLocationMaxX1&&u[1]>=x.regionLocationMinY0&&u[1]<=x.regionLocationMaxY1&&f[0]>=x.regionLocationMinX0&&f[0]<=x.regionLocationMaxX1&&f[1]>=x.regionLocationMinY0&&f[1]<=x.regionLocationMaxY1);if(!d?.length)return{unit:i,areaUnit:o,scale:s,volumeUnit:a};if(d=d.filter(x=>tSe.includes(x.regionDataType)&&mLt.includes(`${x.physicalUnitsXDirection},${x.physicalUnitsYDirection}`)),!d.length)return{unit:Zp,areaUnit:Zp+u5,scale:s,volumeUnit:qS};const h=d[0],m=Math.abs(h.physicalDeltaX),p=Math.abs(h.physicalDeltaY);if(Lr(m,p,yLt))s=1/m,c="US Region",i=Pk[h.physicalUnitsXDirection]||"unknown",o=i+u5;else return{unit:Zp,areaUnit:Zp+u5,scale:s,volumeUnit:qS}}else n.scale&&(s=n.scale);return[Xp.ERMF,Xp.USER,Xp.ERROR,Xp.PROJECTION,Xp.CALIBRATED,Xp.UNKNOWN].includes(n?.type)&&(c=n.type),{unit:i+(c?` ${c}`:""),areaUnit:o+(c?` ${c}`:""),scale:s,volumeUnit:a+(c?` ${c}`:"")}},xLt=(t,e)=>{const[n]=e,{calibration:r}=t;let i=["raw"],a=[null],o="";if(!r||!r.type&&!r.sequenceOfUltrasoundRegions)return{units:i,values:a};if(r.sequenceOfUltrasoundRegions){const s=r.sequenceOfUltrasoundRegions.filter(p=>tSe.includes(p.regionDataType)&&vLt.includes(`${p.physicalUnitsXDirection},${p.physicalUnitsYDirection}`));if(!s?.length)return{units:i,values:a};const c=s.find(p=>n[0]>=p.regionLocationMinX0&&n[0]<=p.regionLocationMaxX1&&n[1]>=p.regionLocationMinY0&&n[1]<=p.regionLocationMaxY1);if(!c)return{units:i,values:a};const{referencePixelX0:l=0,referencePixelY0:u=0}=c,{physicalDeltaX:f,physicalDeltaY:d}=c,h=(n[1]-c.regionLocationMinY0-u)*d,m=(n[0]-c.regionLocationMinX0-l)*f;o="US Region",a=[m,h],i=[Pk[c.physicalUnitsXDirection],Pk[c.physicalUnitsYDirection]]}return{units:i,values:a,calibrationType:o}};function wLt(t,e,n,r){const i=ut();Tr(i,e,t);const a=Zn(...n),o=Zn(...r),s=ut();Xi(s,a,o);const c=ec(s);if(c<1e-4)return{worldWidth:0,worldHeight:0};const l=Vt(s,i)/(c*ec(i)),f=Math.sqrt(1-l*l)*c,d=l*c;return{worldWidth:f,worldHeight:d}}function bLt(t,e,n,r){const i=ut();Tr(i,e,t);const a=Zn(...n),o=Zn(...r),s=ut();Xi(s,a,o);const c=ec(s);if(c<1e-4)return{worldWidth:0,worldHeight:0};const l=Vt(s,i)/(c*ec(i)),f=Math.sqrt(1-l*l)*c,d=l*c;return{worldWidth:f,worldHeight:d}}function B2(t,e,n){let r=!0,i=!0;if(typeof t!="function")throw new TypeError("Expected a function");return N4e(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),P4e(t,e,{leading:r,trailing:i,maxWait:e})}function SLt(t){return t[0]?.length===3}function CLt(t,e){if(!e||e.length===0||e.length===t.length)return t;const n=e[e.length-1]-e[0]+1,r=RM(e.map(a=>t[a][0])),i=RM(e.map(a=>t[a][1]));if(SLt(t)){const a=RM(e.map(o=>t[o][2]));return gZ(zx(r,n),zx(i,n),zx(a,n))}else return gZ(zx(r,n),zx(i,n))}function _Lt(t,e){const n=[],[r,i]=e,a=i-r+1,o=Math.floor(a/t);let s=0,c=Math.round((a-1)/(o-1)*s)+r;for(;c<=i;)n.push(c),s++,c=Math.round((a-1)/(o-1)*s)+r;return n}function TLt(t,e,n,r){const i=n-e+1,a=Math.floor(r/100*i)??1,o=Math.floor(i/a)??1;if(isNaN(i)||!i||!o||i/o<2)return t;const s=Math.max(0,e),c=Math.min(t.length-1,n),l=t.slice(0,s),u=t.slice(c+1,t.length),f=_Lt(o,[s,c]),d=CLt(t,f);return[...l,...d,...u]}function b9(t,e){return e?.autoGenerated?!1:t?.smoothing?.smoothOnAdd===!0||t?.smoothing?.smoothOnEdit===!0}function ELt(t,e){return j4e(t,e)<.001}function OLt(t,e){return j4e(t,e)===0}function DLt(t,e){for(let n=0;n<t.length;n++)for(let r=0;r<e.length;r++)if(OLt(t[n],e[r]))return[n,r]}function Yv(t,e,n){return(t+e+n)%e}function Dne(t,e,n,r){const[,i,a]=t,[,o,s]=e,c=a.length,l=s.length;let u=t[0],f=e[0];if(!a[u]||!s[f]||!a[i]||!s[o])return[void 0,void 0];for(;u!==i&&f!==o;){if(n(s[f],a[u]))return[u,f];u=Yv(u,c,r),f=Yv(f,l,r)}return[void 0,void 0]}function MLt(t,e){const[n,r]=DLt(t,e)||[],i=(c,l)=>ELt(c,l)===!1,[a,o]=Dne([Yv(n,t.length,1),n,t],[Yv(r,e.length,1),r,e],i,1),[s]=Dne([Yv(a,t.length,-1),a,t],[Yv(o,e.length,-1),o,e],i,-1);return[a,s]}function S9(t,e,n){const{interpolation:r,smoothing:i}=t,a=e;if(r){const{knotsRatioPercentageOnAdd:o,knotsRatioPercentageOnEdit:s,smoothOnAdd:c=!1,smoothOnEdit:l=!1}=i,u=n?s:o;if(n?l:c){const[d,h]=n?MLt(e,n):[0,e.length-1];return!e[d]||!e[h]?e:TLt(e,d,h,u)}}return a}const C9=t=>{if(t.shiftKey)return t.ctrlKey?sl.ShiftCtrl:t.altKey?sl.ShiftAlt:t.metaKey?sl.ShiftMeta:sl.Shift;if(t.ctrlKey)return t.altKey?sl.CtrlAlt:t.metaKey?sl.CtrlMeta:sl.Ctrl;if(t.altKey)return t.metaKey&&sl.AltMeta||sl.Alt;if(t.metaKey)return sl.Meta};function lB(t,e){const n=t[0],r=t[t.length-1],i=si();hy(i,r[0]-n[0],r[1]-n[1]),Axe(i,i);const a=si(),o=si();hy(a,-i[1],i[0]),hy(o,i[1],-i[0]);const s=[(n[0]+r[0])/2,(n[1]+r[1])/2],c={dist:0,index:null};for(let f=0;f<t.length;f++){const d=t[f],h=JU(d,s);h>c.dist&&(c.dist=h,c.index=f)}return[t[c.index],s].map(e.canvasToWorld)}function RLt(t,e){const{viewport:n}=t,r=e.data.contour.polyline.map(n.worldToCanvas);return lB(r,n)}const{addCanvasPointsToArray:uB,pointsAreWithinCloseContourProximity:nSe,getFirstLineSegmentIntersectionIndexes:rSe,getSubPixelSpacingAndXYDirections:ILt}=M1;function NLt(t,e,n){this.isDrawing=!0;const r=t.detail,{currentPoints:i,element:a}=r,o=i.canvas,s=yt(a),{viewport:c}=s,l=C9(t.detail.event)===this.configuration.contourHoleAdditionModifierKey,{spacing:u,xDir:f,yDir:d}=ILt(c,this.configuration.subPixelResolution)||{};!u||!f||!d||(this.drawData={canvasPoints:[o],polylineIndex:0,contourHoleProcessingEnabled:l,newAnnotation:!0},this.commonData={annotation:e,viewportIdsToRender:n,spacing:u,xDir:f,yDir:d,movingTextBox:!1},Tt.isInteractingWithTool=!0,a.addEventListener(ge.MOUSE_UP,this.mouseUpDrawCallback),a.addEventListener(ge.MOUSE_DRAG,this.mouseDragDrawCallback),a.addEventListener(ge.MOUSE_CLICK,this.mouseUpDrawCallback),a.addEventListener(ge.TOUCH_END,this.mouseUpDrawCallback),a.addEventListener(ge.TOUCH_DRAG,this.mouseDragDrawCallback),a.addEventListener(ge.TOUCH_TAP,this.mouseUpDrawCallback),ea(a))}function PLt(t){Tt.isInteractingWithTool=!1,t.removeEventListener(ge.MOUSE_UP,this.mouseUpDrawCallback),t.removeEventListener(ge.MOUSE_DRAG,this.mouseDragDrawCallback),t.removeEventListener(ge.MOUSE_CLICK,this.mouseUpDrawCallback),t.removeEventListener(ge.TOUCH_END,this.mouseUpDrawCallback),t.removeEventListener(ge.TOUCH_DRAG,this.mouseDragDrawCallback),t.removeEventListener(ge.TOUCH_TAP,this.mouseUpDrawCallback),rs(t)}function kLt(t){const e=t.detail,{currentPoints:n,element:r}=e,i=n.world,a=n.canvas,o=yt(r),{viewport:s}=o,{annotation:c,viewportIdsToRender:l,xDir:u,yDir:f,spacing:d,movingTextBox:h}=this.commonData,{polylineIndex:m,canvasPoints:p,newAnnotation:y}=this.drawData;this.createMemo(r,c,{newAnnotation:y});const x=p[p.length-1],S=s.canvasToWorld(x),C=ut();Xi(C,i,S);const _=Math.abs(Vt(C,u)),T=Math.abs(Vt(C,f));if(!(_<=d[0]&&T<=d[1])){if(h){this.isDrawing=!1;const{deltaPoints:O}=e,M=O.world,{textBox:I}=c.data.handles,{worldPosition:V}=I;V[0]+=M[0],V[1]+=M[1],V[2]+=M[2],I.hasMoved=!0}else{const O=this.findCrossingIndexDuringCreate(t);if(O!==void 0)this.applyCreateOnCross(t,O);else{const M=uB(r,p,a,this.commonData);this.drawData.polylineIndex=m+M}c.invalidated=!0}Qt(l),c.invalidated&&ji(c,r,na.HandlesUpdated)}}function ALt(t){const{allowOpenContours:e}=this.configuration,{canvasPoints:n,contourHoleProcessingEnabled:r}=this.drawData,i=n[0],a=n[n.length-1],o=t.detail,{element:s}=o;this.doneEditMemo(),this.drawData.newAnnotation=!1,e&&!nSe(i,a,this.configuration.closeContourProximity)?this.completeDrawOpenContour(s,{contourHoleProcessingEnabled:r}):this.completeDrawClosedContour(s,{contourHoleProcessingEnabled:r})}function LLt(t,e){this.removeCrossedLinesOnCompleteDraw();const{canvasPoints:n}=this.drawData,{contourHoleProcessingEnabled:r,minPointsToSave:i}=e??{};if(i&&n.length<i||this.haltDrawing(t,n))return!1;const{annotation:a,viewportIdsToRender:o}=this.commonData,s=yt(t),{viewport:c,renderingEngine:l}=s;uB(t,n,n[0],this.commonData),n.pop();const u=b9(this.configuration,a)?S9(this.configuration,n):n;this.updateContourPolyline(a,{points:u,closed:!0,targetWindingDirection:Tl.Clockwise},c);const{textBox:f}=a.data.handles;return f?.hasMoved||zF(a,r),this.isDrawing=!1,this.drawData=void 0,this.commonData=void 0,Qt(o),this.deactivateDraw(t),!0}function VLt(){const{canvasPoints:t}=this.drawData,e=t.length,n=[t[0],t[e-1]],r=t.slice(0,-1).slice(1),i=rSe(r,n[0],n[1],!1);if(i){const a=i[1];a===1?this.drawData.canvasPoints=t.splice(1):this.drawData.canvasPoints=t.splice(0,a)}}function $Lt(t,e){const{canvasPoints:n}=this.drawData,{contourHoleProcessingEnabled:r}=e??{};if(this.haltDrawing(t,n))return!1;const{annotation:i,viewportIdsToRender:a}=this.commonData,o=yt(t),{viewport:s,renderingEngine:c}=o,l=b9(this.configuration,i)?S9(this.configuration,n):n;this.updateContourPolyline(i,{points:l,closed:!1},s);const{textBox:u}=i.data.handles,f=i.data.contour.polyline;return i.data.handles.points=[f[0],f[f.length-1]],i.data.isOpenUShapeContour&&(i.data.openUShapeContourVectorToPeak=lB(n,s)),u.hasMoved||zF(i,r),this.isDrawing=!1,this.drawData=void 0,this.commonData=void 0,Qt(a),this.deactivateDraw(t),!0}function jLt(t){const e=t.detail,{currentPoints:n,lastPoints:r}=e,i=n.canvas,a=r.canvas,{canvasPoints:o}=this.drawData,s=o.slice(0,-1),c=rSe(s,i,a,!1);return c===void 0?void 0:c[0]}function ULt(t,e){const n=t.detail,{element:r}=n,{canvasPoints:i,contourHoleProcessingEnabled:a}=this.drawData,{annotation:o,viewportIdsToRender:s}=this.commonData;uB(r,i,i[e],this.commonData),i.pop();const c=i.slice(e),l=QF(c);if(Lr(l,0)){i.splice(e+1);return}i.splice(0,e);const u={contourHoleProcessingEnabled:a,minPointsToSave:3};this.completeDrawClosedContour(r,u)&&this.activateClosedContourEdit(t,o,s)}function FLt(t){const{allowOpenContours:e}=this.configuration,{canvasPoints:n,contourHoleProcessingEnabled:r}=this.drawData,i=n[0],a=n[n.length-1];e&&!nSe(i,a,this.configuration.closeContourProximity)?this.completeDrawOpenContour(t,{contourHoleProcessingEnabled:r}):this.completeDrawClosedContour(t,{contourHoleProcessingEnabled:r})}function BLt(t,e){const n=Math.max(e*3,3);return t.length<n}function zLt(t,e){const{subPixelResolution:n}=this.configuration;if(BLt(e,n)){const{annotation:r,viewportIdsToRender:i}=this.commonData,a=yt(t),{renderingEngine:o}=a;return rc(r.annotationUID),this.isDrawing=!1,this.drawData=void 0,this.commonData=void 0,Qt(i),this.deactivateDraw(t),!0}return!1}function GLt(t){t.activateDraw=NLt.bind(t),t.deactivateDraw=PLt.bind(t),t.applyCreateOnCross=ULt.bind(t),t.findCrossingIndexDuringCreate=jLt.bind(t),t.completeDrawOpenContour=$Lt.bind(t),t.removeCrossedLinesOnCompleteDraw=VLt.bind(t),t.mouseDragDrawCallback=kLt.bind(t),t.mouseUpDrawCallback=ALt.bind(t),t.completeDrawClosedContour=LLt.bind(t),t.cancelDrawing=FLt.bind(t),t.haltDrawing=zLt.bind(t)}const{addCanvasPointsToArray:WLt,getFirstLineSegmentIntersectionIndexes:m1}=M1;function HLt(t,e){const n=t.detail,{element:r,currentPoints:i,lastPoints:a}=n,o=i.canvas,s=a.canvas,{editCanvasPoints:c,prevCanvasPoints:l}=this.editData,u=m1(l,o,s,e);if(u)this.editData.startCrossingIndex=u[0],this.removePointsUpUntilFirstCrossing(e);else if(l.length>=2)if(c.length>this.configuration.checkCanvasEditFallbackProximity){const f=c[0],d=[];for(let p=0;p<l.length;p++){const y=l[p],x=Ka(y,f);d.push({distance:x,index:p})}d.sort((p,y)=>p.distance-y.distance);const h=[d[0],d[1]],m=Math.min(h[0].index,h[1].index);this.editData.startCrossingIndex=m}else{const f=si();Qo(f,c[1],c[0]),Axe(f,f);const d=6,h=[c[0][0]-f[0]*d,c[0][1]-f[1]*d],m=m1(l,h,c[0],e);if(m){const p=[h];WLt(r,p,c[0],this.commonData),c.unshift(...p),this.removePointsUpUntilFirstCrossing(e),this.editData.editIndex=c.length-1,this.editData.startCrossingIndex=m[0]}}}function qLt(t){const{editCanvasPoints:e,prevCanvasPoints:n}=this.editData;let r=0;for(let i=0;i<e.length-1;i++){const a=[e[i],e[i+1]],o=!!m1(n,a[0],a[1],t);if(r++,o)break}e.splice(0,r),this.editData.editIndex=e.length-1}function KLt(t,e){const n=t.detail,{currentPoints:r,lastPoints:i}=n,a=r.canvas,o=i.canvas,{prevCanvasPoints:s}=this.editData;return!!m1(s,a,o,e)}function YLt(t){const{prevCanvasPoints:e,editCanvasPoints:n}=this.editData;for(let r=n.length-1;r>0;r--){const i=[n[r],n[r-1]],a=!!m1(e,i[0],i[1],t);if(n.pop(),a)break}}function XLt(){const{editCanvasPoints:t,prevCanvasPoints:e,startCrossingIndex:n}=this.editData;if(n===void 0)return;const r=t[t.length-1],i=[];for(let o=0;o<e.length;o++){const s=e[o],c=Ka(s,r);i.push({distance:c,index:o})}i.sort((o,s)=>o.distance-s.distance);const a=t.slice(0,-1);for(let o=0;o<i.length;o++){const{index:s}=i[o],c=e[s],l=t[t.length-1];if(!m1(a,c,l,!1))return s}return-1}function ZLt(t){const e=t.detail,{currentPoints:n,lastPoints:r}=e,i=n.canvas,a=r.canvas,{editCanvasPoints:o}=this.editData,s=o.slice(0,-2),c=m1(s,i,a,!1);if(!c)return;const l=c[0],u=o.length-l;for(let f=0;f<u;f++)o.pop()}function QLt(t){t.checkForFirstCrossing=HLt.bind(t),t.removePointsUpUntilFirstCrossing=qLt.bind(t),t.checkForSecondCrossing=KLt.bind(t),t.findSnapIndex=XLt.bind(t),t.removePointsAfterSecondCrossing=YLt.bind(t),t.checkAndRemoveCrossesOnEditLine=ZLt.bind(t)}const{getSubPixelSpacingAndXYDirections:JLt,addCanvasPointsToArray:iSe,getArea:Mne}=M1;function eVt(t,e,n){this.isEditingClosed=!0;const r=t.detail,{currentPoints:i,element:a}=r,o=i.canvas,s=yt(a);if(!s)return;const{viewport:c}=s,l=e.data.contour.polyline.map(c.worldToCanvas),{spacing:u,xDir:f,yDir:d}=JLt(c,this.configuration.subPixelResolution);this.editData={prevCanvasPoints:l,editCanvasPoints:[o],startCrossingIndex:void 0,editIndex:0,annotation:e},this.commonData={annotation:e,viewportIdsToRender:n,spacing:u,xDir:f,yDir:d,movingTextBox:!1},Tt.isInteractingWithTool=!0,a.addEventListener(ge.MOUSE_UP,this.mouseUpClosedContourEditCallback),a.addEventListener(ge.MOUSE_DRAG,this.mouseDragClosedContourEditCallback),a.addEventListener(ge.MOUSE_CLICK,this.mouseUpClosedContourEditCallback),a.addEventListener(ge.TOUCH_END,this.mouseUpClosedContourEditCallback),a.addEventListener(ge.TOUCH_DRAG,this.mouseDragClosedContourEditCallback),a.addEventListener(ge.TOUCH_TAP,this.mouseUpClosedContourEditCallback),ea(a)}function tVt(t){Tt.isInteractingWithTool=!1,t.removeEventListener(ge.MOUSE_UP,this.mouseUpClosedContourEditCallback),t.removeEventListener(ge.MOUSE_DRAG,this.mouseDragClosedContourEditCallback),t.removeEventListener(ge.MOUSE_CLICK,this.mouseUpClosedContourEditCallback),t.removeEventListener(ge.TOUCH_END,this.mouseUpClosedContourEditCallback),t.removeEventListener(ge.TOUCH_DRAG,this.mouseDragClosedContourEditCallback),t.removeEventListener(ge.TOUCH_TAP,this.mouseUpClosedContourEditCallback),rs(t)}function nVt(t){const e=t.detail,{currentPoints:n,element:r}=e,i=n.world,a=n.canvas,o=yt(r),{viewport:s}=o,{viewportIdsToRender:c,xDir:l,yDir:u,spacing:f}=this.commonData,{editIndex:d,editCanvasPoints:h,startCrossingIndex:m,annotation:p}=this.editData;this.createMemo(r,p);const y=h[h.length-1],x=s.canvasToWorld(y),S=ut();Xi(S,i,x);const C=Math.abs(Vt(S,l)),_=Math.abs(Vt(S,u));if(C<=f[0]&&_<=f[1])return;m!==void 0&&this.checkAndRemoveCrossesOnEditLine(t);const T=iSe(r,h,a,this.commonData),O=d+T;if(this.editData.editIndex=O,m===void 0&&h.length>1&&this.checkForFirstCrossing(t,!0),this.editData.snapIndex=this.findSnapIndex(),this.editData.snapIndex===-1){this.finishEditAndStartNewEdit(t);return}this.editData.fusedCanvasPoints=this.fuseEditPointsWithClosedContour(t),m!==void 0&&this.checkForSecondCrossing(t,!0)&&(this.removePointsAfterSecondCrossing(!0),this.finishEditAndStartNewEdit(t)),Qt(c)}function rVt(t){const e=t.detail,{element:n}=e,r=yt(n),{viewport:i,renderingEngine:a}=r,{annotation:o,viewportIdsToRender:s}=this.commonData,{fusedCanvasPoints:c,editCanvasPoints:l}=this.editData;jd(o,{points:c,closed:!0,targetWindingDirection:Tl.Clockwise},i),o.autoGenerated&&(o.autoGenerated=!1),ji(o,n);const u=l.pop();this.editData={prevCanvasPoints:c,editCanvasPoints:[u],startCrossingIndex:void 0,editIndex:0,snapIndex:void 0,annotation:o},Qt(s)}function iVt(t){const{prevCanvasPoints:e,editCanvasPoints:n,startCrossingIndex:r,snapIndex:i}=this.editData;if(r===void 0||i===void 0)return;const a=t.detail,{element:o}=a,s=[...n];iSe(o,s,e[i],this.commonData),s.length>n.length&&s.pop();let c,l;r>i?(c=i,l=r):(c=r,l=i);const u=Ka(e[c],s[0]),f=Ka(e[c],s[s.length-1]),d=Ka(e[l],s[0]),h=Ka(e[l],s[s.length-1]),m=[];for(let T=0;T<c;T++){const O=e[T];m.push([O[0],O[1]])}let p=u+h,y=f+d;if(p<y)for(let T=0;T<s.length;T++){const O=s[T];m.push([O[0],O[1]])}else for(let T=s.length-1;T>=0;T--){const O=s[T];m.push([O[0],O[1]])}for(let T=l;T<e.length;T++){const O=e[T];m.push([O[0],O[1]])}const x=[];for(let T=c;T<l;T++){const O=e[T];x.push([O[0],O[1]])}if(p=d+f,y=h+u,p<y)for(let T=0;T<s.length;T++){const O=s[T];x.push([O[0],O[1]])}else for(let T=s.length-1;T>=0;T--){const O=s[T];x.push([O[0],O[1]])}const S=Mne(m),C=Mne(x);return S>C?m:x}function aVt(t){const e=t.detail,{element:n}=e;this.completeClosedContourEdit(n)}function oVt(t){const e=yt(t),{viewport:n}=e,{annotation:r,viewportIdsToRender:i}=this.commonData;this.doneEditMemo();const{fusedCanvasPoints:a,prevCanvasPoints:o}=this.editData;if(a){const s=b9(this.configuration,r)?S9(this.configuration,a,o):a,c=this.configuration?.decimate||{};jd(r,{points:s,closed:!0,targetWindingDirection:Tl.Clockwise},n,{decimate:{enabled:!!c.enabled,epsilon:c.epsilon}}),r.autoGenerated&&(r.autoGenerated=!1),ji(r,t)}this.isEditingClosed=!1,this.editData=void 0,this.commonData=void 0,Qt(i),this.deactivateClosedContourEdit(t)}function sVt(t){this.completeClosedContourEdit(t)}function cVt(t){t.activateClosedContourEdit=eVt.bind(t),t.deactivateClosedContourEdit=tVt.bind(t),t.mouseDragClosedContourEditCallback=nVt.bind(t),t.mouseUpClosedContourEditCallback=aVt.bind(t),t.finishEditAndStartNewEdit=rVt.bind(t),t.fuseEditPointsWithClosedContour=iVt.bind(t),t.cancelClosedContourEdit=sVt.bind(t),t.completeClosedContourEdit=oVt.bind(t)}const{addCanvasPointsToArray:aSe,getSubPixelSpacingAndXYDirections:lVt}=M1;function uVt(t,e,n){this.isEditingOpen=!0;const r=t.detail,{currentPoints:i,element:a}=r,o=i.canvas,s=yt(a),{viewport:c}=s;this.doneEditMemo();const l=e.data.contour.polyline.map(c.worldToCanvas),{spacing:u,xDir:f,yDir:d}=lVt(c,this.configuration.subPixelResolution);this.editData={prevCanvasPoints:l,editCanvasPoints:[o],startCrossingIndex:void 0,editIndex:0},this.commonData={annotation:e,viewportIdsToRender:n,spacing:u,xDir:f,yDir:d,movingTextBox:!1},Tt.isInteractingWithTool=!0,a.addEventListener(ge.MOUSE_UP,this.mouseUpOpenContourEditCallback),a.addEventListener(ge.MOUSE_DRAG,this.mouseDragOpenContourEditCallback),a.addEventListener(ge.MOUSE_CLICK,this.mouseUpOpenContourEditCallback),a.addEventListener(ge.TOUCH_END,this.mouseUpOpenContourEditCallback),a.addEventListener(ge.TOUCH_DRAG,this.mouseDragOpenContourEditCallback),a.addEventListener(ge.TOUCH_TAP,this.mouseUpOpenContourEditCallback),ea(a)}function fVt(t){Tt.isInteractingWithTool=!1,t.removeEventListener(ge.MOUSE_UP,this.mouseUpOpenContourEditCallback),t.removeEventListener(ge.MOUSE_DRAG,this.mouseDragOpenContourEditCallback),t.removeEventListener(ge.MOUSE_CLICK,this.mouseUpOpenContourEditCallback),t.removeEventListener(ge.TOUCH_END,this.mouseUpOpenContourEditCallback),t.removeEventListener(ge.TOUCH_DRAG,this.mouseDragOpenContourEditCallback),t.removeEventListener(ge.TOUCH_TAP,this.mouseUpOpenContourEditCallback),rs(t)}function dVt(t){const e=t.detail,{currentPoints:n,element:r}=e,i=n.world,a=n.canvas,o=yt(r),{viewport:s}=o,{viewportIdsToRender:c,xDir:l,yDir:u,spacing:f}=this.commonData,{editIndex:d,editCanvasPoints:h,startCrossingIndex:m}=this.editData,p=h[h.length-1],y=s.canvasToWorld(p),x=ut();this.createMemo(r,this.commonData.annotation),Xi(x,i,y);const S=Math.abs(Vt(x,l)),C=Math.abs(Vt(x,u));if(S<=f[0]&&C<=f[1])return;m!==void 0&&this.checkAndRemoveCrossesOnEditLine(t);const _=aSe(r,h,a,this.commonData),T=d+_;this.editData.editIndex=T,m===void 0&&h.length>1&&this.checkForFirstCrossing(t,!1),this.editData.snapIndex=this.findSnapIndex(),this.editData.fusedCanvasPoints=this.fuseEditPointsWithOpenContour(t),m!==void 0&&this.checkForSecondCrossing(t,!1)?(this.removePointsAfterSecondCrossing(!1),this.finishEditOpenOnSecondCrossing(t)):this.checkIfShouldOverwriteAnEnd(t)&&this.openContourEditOverwriteEnd(t),Qt(c)}function hVt(t){const e=t.detail,{element:n}=e,r=yt(n),{viewport:i}=r,{annotation:a,viewportIdsToRender:o}=this.commonData,s=this.fuseEditPointsForOpenContourEndEdit();jd(a,{points:s,closed:!1},i);const c=a.data.contour.polyline;a.data.handles.points=[c[0],c[c.length-1]],a.data.handles.activeHandleIndex=1,ji(a,n),this.isEditingOpen=!1,this.editData=void 0,this.commonData=void 0,this.doneEditMemo(),this.deactivateOpenContourEdit(n),this.activateOpenContourEndEdit(t,a,o,null)}function gVt(t){const e=t.detail,{currentPoints:n,lastPoints:r}=e,i=n.canvas,a=r.canvas,{snapIndex:o,prevCanvasPoints:s,startCrossingIndex:c}=this.editData;if(c===void 0||o===void 0)return!1;if(o===-1)return!0;if(o!==0&&o!==s.length-1)return!1;const l=i,u=a,f=s[o],d=si(),h=si();hy(d,l[0]-u[0],l[1]-u[1]),hy(h,l[0]-f[0],l[1]-f[1]);const m=xg(d,h),p=Math.sqrt(d[0]*d[0]+d[1]*d[1]),y=Math.sqrt(h[0]*h[0]+h[1]*h[1]);return Math.acos(m/(p*y))<Math.PI/2}function pVt(){const{snapIndex:t,prevCanvasPoints:e,editCanvasPoints:n,startCrossingIndex:r}=this.editData,i=[];if(t===0)for(let s=e.length-1;s>=r;s--){const c=e[s];i.push([c[0],c[1]])}else for(let s=0;s<r;s++){const c=e[s];i.push([c[0],c[1]])}const a=Ka(e[r],n[0]),o=Ka(e[r],n[n.length-1]);if(a<o)for(let s=0;s<n.length;s++){const c=n[s];i.push([c[0],c[1]])}else for(let s=n.length-1;s>=0;s--){const c=n[s];i.push([c[0],c[1]])}return i}function mVt(t){const{prevCanvasPoints:e,editCanvasPoints:n,startCrossingIndex:r,snapIndex:i}=this.editData;if(r===void 0||i===void 0)return;const a=t.detail,{element:o}=a,s=[...n];aSe(o,s,e[i],this.commonData),s.length>n.length&&s.pop();let c,l;r>i?(c=i,l=r):(c=r,l=i);const u=Ka(e[c],s[0]),f=Ka(e[c],s[s.length-1]),d=Ka(e[l],s[0]),h=Ka(e[l],s[s.length-1]),m=[];for(let x=0;x<c;x++){const S=e[x];m.push([S[0],S[1]])}const p=u+h,y=f+d;if(p<y)for(let x=0;x<s.length;x++){const S=s[x];m.push([S[0],S[1]])}else for(let x=s.length-1;x>=0;x--){const S=s[x];m.push([S[0],S[1]])}for(let x=l;x<e.length;x++){const S=e[x];m.push([S[0],S[1]])}return m}function vVt(t){const e=t.detail,{element:n}=e,r=yt(n),{viewport:i,renderingEngine:a}=r,{annotation:o,viewportIdsToRender:s}=this.commonData,{fusedCanvasPoints:c,editCanvasPoints:l}=this.editData;jd(o,{points:c,closed:!1},i);const u=o.data.contour.polyline;o.data.handles.points=[u[0],u[u.length-1]],ji(o,n);const f=l.pop();this.editData={prevCanvasPoints:c,editCanvasPoints:[f],startCrossingIndex:void 0,editIndex:0},Qt(s)}function yVt(t){const e=t.detail,{element:n}=e;this.completeOpenContourEdit(n)}function xVt(t){const e=yt(t),{viewport:n}=e,{annotation:r,viewportIdsToRender:i}=this.commonData;this.doneEditMemo();const{fusedCanvasPoints:a,prevCanvasPoints:o}=this.editData;if(a){const s=b9(this.configuration)?S9(this.configuration,a,o):a,c=this.configuration?.decimate||{};jd(r,{points:s,closed:!1},n,{decimate:{enabled:!!c.enabled,epsilon:c.epsilon}});const l=r.data.contour.polyline;r.data.handles.points=[l[0],l[l.length-1]],r.data.isOpenUShapeContour&&(r.data.openUShapeContourVectorToPeak=lB(a,n)),ji(r,t)}this.isEditingOpen=!1,this.editData=void 0,this.commonData=void 0,Qt(i),this.deactivateOpenContourEdit(t)}function wVt(t){this.completeOpenContourEdit(t)}function bVt(t){t.activateOpenContourEdit=uVt.bind(t),t.deactivateOpenContourEdit=fVt.bind(t),t.mouseDragOpenContourEditCallback=dVt.bind(t),t.mouseUpOpenContourEditCallback=yVt.bind(t),t.fuseEditPointsWithOpenContour=mVt.bind(t),t.finishEditOpenOnSecondCrossing=vVt.bind(t),t.checkIfShouldOverwriteAnEnd=gVt.bind(t),t.fuseEditPointsForOpenContourEndEdit=pVt.bind(t),t.openContourEditOverwriteEnd=hVt.bind(t),t.cancelOpenContourEdit=wVt.bind(t),t.completeOpenContourEdit=xVt.bind(t)}const{getSubPixelSpacingAndXYDirections:SVt}=M1;function CVt(t,e,n,r){this.isDrawing=!0;const i=t.detail,{element:a}=i,o=yt(a),{viewport:s}=o,{spacing:c,xDir:l,yDir:u}=SVt(s,this.configuration.subPixelResolution),f=e.data.contour.polyline.map(s.worldToCanvas);e.data.handles.activeHandleIndex===0&&f.reverse();let h=!1;r?.worldPosition&&(h=!0),this.drawData={canvasPoints:f,polylineIndex:f.length-1},this.commonData={annotation:e,viewportIdsToRender:n,spacing:c,xDir:l,yDir:u,movingTextBox:h},Tt.isInteractingWithTool=!0,a.addEventListener(ge.MOUSE_UP,this.mouseUpDrawCallback),a.addEventListener(ge.MOUSE_DRAG,this.mouseDragDrawCallback),a.addEventListener(ge.MOUSE_CLICK,this.mouseUpDrawCallback),a.addEventListener(ge.TOUCH_END,this.mouseUpDrawCallback),a.addEventListener(ge.TOUCH_DRAG,this.mouseDragDrawCallback),a.addEventListener(ge.TOUCH_TAP,this.mouseUpDrawCallback),ea(a)}function _Vt(t){t.activateOpenContourEndEdit=CVt.bind(t)}function TVt(t){return(t.childAnnotationUIDs??[]).map(n=>as(n).data.contour.polyline)}function _9(t,e){const n=TVt(t),r=[];return n.forEach(i=>{const a=i.length,o=new Array(a);for(let s=0;s<a;s++)o[s]=e.worldToCanvas(i[s]);r.push(o)}),r}const{pointsAreWithinCloseContourProximity:EVt}=M1;function OVt(t,e){const n={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:t.viewport.id,annotationUID:e.annotationUID},{lineWidth:r,lineDash:i,color:a,fillColor:o,fillOpacity:s}=this.getAnnotationStyle({annotation:e,styleSpecifier:n}),{closed:c}=e.data.contour;return{color:a,width:r,lineDash:i,fillColor:o,fillOpacity:s,closePath:c}}function DVt(t,e,n){t?.viewport?.getImageData()&&(n.data.contour.closed?this.renderClosedContour(t,e,n):n.data.isOpenUShapeContour?(MVt(t,n),this.renderOpenUShapedContour(t,e,n)):this.renderOpenContour(t,e,n))}function MVt(t,e){e.data.openUShapeContourVectorToPeak||(e.data.openUShapeContourVectorToPeak=RLt(t,e))}function RVt(t,e,n){if(n.parentAnnotationUID)return;const{viewport:r}=t,i=this._getRenderingOptions(t,n),a=n.data.contour.polyline.map(l=>r.worldToCanvas(l)),o=_9(n,r),s=[a,...o];Um(e,n.annotationUID,"1",s,i)}function IVt(t,e,n){const{viewport:r}=t,i=this._getRenderingOptions(t,n),a=n.data.contour.polyline.map(c=>r.worldToCanvas(c));Yy(e,n.annotationUID,"1",a,i);const s=n.data.handles.activeHandleIndex;if(this.configuration.alwaysRenderOpenContourHandles?.enabled===!0){const c=this.configuration.alwaysRenderOpenContourHandles.radius,l="0",u=[a[0],a[a.length-1]];s===0?u.shift():s===1&&u.pop(),bh(e,n.annotationUID,l,u,{color:i.color,handleRadius:c})}if(s!==null){const l=s===0?0:a.length-1,u=a[l];bh(e,n.annotationUID,"1",[u],{color:i.color})}}function NVt(t,e,n){const{viewport:r}=t,{openUShapeContourVectorToPeak:i}=n.data,{polyline:a}=n.data.contour;if(this.renderOpenContour(t,e,n),!i)return;const o=r.worldToCanvas(a[0]),s=r.worldToCanvas(a[a.length-1]),c=[r.worldToCanvas(i[0]),r.worldToCanvas(i[1])],l=this._getRenderingOptions(t,n);Yy(e,n.annotationUID,"first-to-last",[o,s],{color:l.color,width:l.width,closePath:!1,lineDash:"2,2"}),Yy(e,n.annotationUID,"midpoint-to-open-contour",[c[0],c[1]],{color:l.color,width:l.width,closePath:!1,lineDash:"2,2"})}function PVt(t,e,n){const r=this._getRenderingOptions(t,n),{allowOpenContours:i}=this.configuration,{canvasPoints:a}=this.drawData;if(r.closePath=!1,Yy(e,n.annotationUID,"1",a,r),i){const o=a[0],s=a[a.length-1];EVt(o,s,this.configuration.closeContourProximity)?Yy(e,n.annotationUID,"2",[s,o],r):bh(e,n.annotationUID,"0",[o],{color:r.color,handleRadius:2})}}function kVt(t,e,n){const{viewport:r}=t,{fusedCanvasPoints:i}=this.editData;if(i===void 0){this.renderClosedContour(t,e,n);return}const a=_9(n,r),o=[i,...a],s=this._getRenderingOptions(t,n),c="preview-1";n.parentAnnotationUID&&s.fillOpacity&&(s.fillOpacity=0),Um(e,n.annotationUID,c,o,s)}function AVt(t,e,n){const{fusedCanvasPoints:r}=this.editData;if(r===void 0){this.renderOpenContour(t,e,n);return}const i=this._getRenderingOptions(t,n);Yy(e,n.annotationUID,"preview-1",r,i)}function LVt(t,e,n){if(n.parentAnnotationUID)return;const{viewport:r}=t,i=this._getRenderingOptions(t,n),a=n.data.contour.polyline.map(m=>r.worldToCanvas(m)),o=_9(n,r),s="1",c=a[0],l=6,u=100,f=[];for(let m=0;m<u;m++){const p=m/u*2*Math.PI,y=c[0]+l*Math.cos(p),x=c[1]+l*Math.sin(p);f.push([y,x])}const d=[[c[0]-l*2,c[1]],[c[0]+l*2,c[1]],[c[0],c[1]-l*2],[c[0],c[1]+l*2]];Um(e,n.annotationUID,s+"-crosshair_v",[d[0],d[1]],i),Um(e,n.annotationUID,s+"-crosshair_h",[d[2],d[3]],i);const h=[f,...o];Um(e,n.annotationUID,s,h,i)}function VVt(t){t.renderContour=DVt.bind(t),t.renderClosedContour=RVt.bind(t),t.renderOpenContour=IVt.bind(t),t.renderPointContourWithMarker=LVt.bind(t),t.renderOpenUShapedContour=NVt.bind(t),t.renderContourBeingDrawn=PVt.bind(t),t.renderClosedContourBeingEdited=kVt.bind(t),t.renderOpenContourBeingEdited=AVt.bind(t),t._getRenderingOptions=OVt.bind(t)}function M3(t){const e=$Vt(t),n=(e.top[1]+e.bottom[1])/2;return[e.right[0],n]}function $Vt(t){const e=[t[0],t[1]].sort(o),n=[t[0],t[1]].sort(s),r=e[e.length-1],i=n[0],a=n[n.length-1];return{top:i,bottom:a,right:r};function o(c,l){return c[0]<l[0]?-1:1}function s(c,l){return c[1]<l[1]?-1:1}}function T9(t,e){if(t instanceof Tu){const n=V2(e),r=Ct.getVolume(n);return!!r?.scaling&&Object.keys(r.scaling).length>0}else if(t instanceof Ms){const{preScale:n}=t.getImageData()||{};return!!n?.scaled}else return!1}function Rne(t,e){let n=0;for(let r=0;r<t.length-1;r++){const i=t[r],a=t[r+1];n+=Math.sqrt(Math.pow(a[0]-i[0],2)+Math.pow(a[1]-i[1],2))}if(e){const r=t[0],i=t[t.length-1];n+=Math.sqrt(Math.pow(i[0]-r[0],2)+Math.pow(i[1]-r[1],2))}return n}class jVt extends Nc{constructor(e,n){super(e,n)}renderAnnotation(e,n){let r=!1;const{viewport:i}=e,{element:a}=i;if(!i.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),r;let o=yf(this.getToolName(),a);if(!o?.length||(o=this.filterInteractableAnnotationsForElement(a,o),!o?.length))return r;const s=this.getTargetId(i),c={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let l=0;l<o.length;l++){const u=o[l];c.annotationUID=u.annotationUID;const f=this.getAnnotationStyle({annotation:u,styleSpecifier:c});if(!f.visibility)continue;const d=this.renderAnnotationInstance({enabledElement:e,targetId:s,annotation:u,annotationStyle:f,svgDrawingHelper:n});r||=d,u.invalidated=!1}return r}createAnnotation(e){const n=super.createAnnotation(e);return Object.assign(n.data,{contour:{polyline:[],closed:!1}}),Object.assign(n,{interpolationUID:"",autoGenerated:!1}),n}addAnnotation(e,n){return Ao(e,n)}cancelAnnotation(e){}moveAnnotation(e,n){const{points:r}=e.data.handles;for(let i=0,a=r.length;i<a;i++){const o=r[i];o[0]+=n[0],o[1]+=n[1],o[2]+=n[2]}e.invalidated=!0,u9(e).forEach(i=>this.moveAnnotation(i,n))}updateContourPolyline(e,n,r,i){const a=this.configuration?.decimate||{};jd(e,n,r,{decimate:{enabled:!!a.enabled,epsilon:a.epsilon},updateWindingDirection:i?.updateWindingDirection})}getPolylinePoints(e){return e.data.contour?.polyline??e.data.polyline}renderAnnotationInstance(e){const{enabledElement:n,annotationStyle:r,svgDrawingHelper:i}=e,a=e.annotation;if(a.parentAnnotationUID)return;const{annotationUID:o}=a,{viewport:s}=n,{worldToCanvas:c}=s,l=this.getPolylinePoints(a).map(x=>c(x)),{lineWidth:u,lineDash:f,color:d,fillColor:h,fillOpacity:m}=r,p=_9(a,s),y=[l,...p];return Um(i,o,"contourPolyline",y,{color:d,lineDash:f,lineWidth:Math.max(.1,u),fillColor:h,fillOpacity:m}),!0}}const v1={...ZNt,...qNt,resetAnnotationManager:Skt},Ine="PlanarFreehandContourSegmentationTool";function fB(t,e=[]){const{viewport:n,sliceData:r,annotation:i}=t,a=new Map,{toolName:o,originalToolName:s}=i.metadata,c=s||o,l=(yf(c,n.element)||[]).filter(u=>!u.metadata.originalToolName||u.metadata.originalToolName===c);if(c!==Ine){const u=yf(Ine,n.element);u?.length&&u.forEach(f=>{const{metadata:d}=f;d.originalToolName===c&&d.originalToolName!==d.toolName&&l.push(f)})}if(!l?.length)return a;for(let u=0;u<r.numberOfSlices;u++){const f=l.filter(h=>h.metadata.sliceIndex===u);if(!f?.length)continue;const d=f.filter(h=>e.every(m=>{const y=(m.parentKey?m.parentKey(h):h)?.[m.key];return Array.isArray(y)?y.every((x,S)=>x===m.value[S]):y===m.value}));d.length&&a.set(u,d)}return a}function UVt(t,e){const n=fB(t,e),r=[];if(!n?.size)return r;for(const i of n.values())i.forEach(a=>{r.push(a)});return r}function oSe(t,e,n){const r=Ac({data:{},metadata:{}},n);return Object.assign(r,{highlighted:!1,invalidated:!0,autoGenerated:!0,annotationUID:void 0,cachedStats:{},childAnnotationUIDs:[],parentAnnotationUID:void 0}),Object.assign(r.data,{handles:{points:e.points||e||[],interpolationSources:e.sources,activeHandleIndex:null,textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}},contour:{...n.data.contour,polyline:t}}),r}function FVt(t,e){const n=fB(e,[{key:"interpolationUID",value:e.interpolationUID}]),r=BVt(n);if(!r){console.warn("No annotations found to interpolate",n);return}const i=zVt(n,t.annotationUID),a=[];for(let o=r[0]+1;o<r[1];o++)if(GVt(n,o)){const s=HVt(o,r,n);(s?.[0]===i||s?.[1]===i)&&WVt(s,a,o)}return{interpolationData:n,interpolationList:a}}function BVt(t){let e=1/0,n=-1/0,r=!1;for(const[i,a]of t.entries())a.length&&(e=Math.min(i,e),n=Math.max(i,n),r=!0);if(r)return[e,n]}function zVt(t,e){for(const[n,r]of t)for(let i=0;i<r.length;i++)if(r[i].annotationUID===e)return n}function GVt(t,e){const n=t.get(e);return!n?.length||n.length===1&&n[0].autoGenerated}function WVt(t,e,n){const[r]=t;e[r]||={pair:t,list:[]},e[r].list.push(n)}function HVt(t,e,n){const r=[];let i=!0;for(let a=t-1;a>=e[0];a--){const o=n.get(a);if(o?.length){if(o[0].autoGenerated)continue;o.length>1&&(i=!1),r.push(a);break}}if(!(!i||!r.length)){for(let a=t+1;a<=e[1];a++){const o=n.get(a);if(o?.length){if(o[0].autoGenerated)continue;o.length>1&&(i=!1),r.push(a);break}}if(!(!i||r.length<2))return r}}const{PointsManager:Nne}=Bc;function qVt(t,e=12){const n=Nne.create3(e);n.sources=[];const{sources:r}=n,{length:i,sources:a=[]}=t,o=5;if(i<o*3)return t.subselect(e);const s=Math.floor(Math.max(2*i/e,o*2));a.forEach(()=>r.push(Nne.create3(e)));const c=KVt(t,o),l=YVt(c,e),u=[];if(l?.length>2){let f=-1;const d=s/3;l.forEach(p=>{const[y,,x]=p,S=Math.ceil((y+x)/2);x-f<d||(S-y>2*d?(Mv(u,f,y,s,i),f=Mv(u,y,S,s,i)):f=Mv(u,f,S,s,i),x-f>d&&(f=Mv(u,f,x,s,i)))});const h=u[0];kk(h+i-f,i)>2*d&&Mv(u,f,h-d,s,i)}else{const f=Math.floor(i/e);Mv(u,-1,i-f,f,i)}return u.forEach(f=>{const d=t.getPointArray(f);n.push(d),a.forEach((h,m)=>r[m].push(h.getPoint(f)))}),n}function KVt(t,e=6){const{length:n}=t,r=ut(),i=ut(),a=new Float32Array(n);for(let o=0;o<n;o++){const s=t.getPoint(o),c=t.getPoint(o-e),l=t.getPoint((o+e)%n);yr(r,s,c),yr(i,l,s);const u=Vt(r,i)/(zT(r)*zT(i));a[o]=u}return a}function YVt(t,e){const{max:n,deviation:r}=XVt(t),{length:i}=t;if(r<.01||i<e*3)return[];const a=[];let o=null,s,c=0;for(let l=0;l<i;l++){const u=t[l];u<n-r?o?(o[2]=l,u<s&&(s=u,c=l),o[1]=c):(s=u,c=l,o=[l,l,l]):o&&(a.push(o),o=null)}return o&&(a[0][0]===0?a[0][0]=o[0]:(o[1]=c,o[2]=i-1,a.push(o))),a}function Mv(t,e,n,r,i){n<e&&(n+=i);const a=n-e,o=Math.ceil(a/r);if(o<=0)return t[t.length-1]!==n&&t.push(kk(n,i)),n;for(let s=1;s<=o;s++){const c=kk(e+s*a/o,i);t.push(c)}return t[t.length-1]}function kk(t,e){return(Math.round(t)+e)%e}function XVt(t){const{length:e}=t;let n=0,r=1/0,i=-1/0,a=0;for(let s=0;s<e;s++){const c=t[s];n+=c,r=Math.min(r,c),i=Math.max(i,c)}const o=n/e;for(let s=0;s<e;s++){const c=t[s]-o;a+=c*c}return{mean:o,max:i,min:r,sumSq:a,deviation:Math.sqrt(a/e)}}function ZVt(t){const{parentAnnotationUID:e,annotationUID:n}=t;if(!e)return t.interpolationUID;const r=v1.getAnnotation(e),{interpolationUID:i}=r,a=r.childAnnotationUIDs.indexOf(n);return t.interpolationUID=`${i}-${a}`,t.interpolationUID}const{PointsManager:f5}=Bc,Pne=.2;function QC(t){if(!t.annotation)return;const{isInterpolationUpdate:e,annotation:n}=t;queueMicrotask(()=>{try{e&&(n.isInterpolationUpdate=!0,n.autoGenerated=!1),QVt(t)}finally{e&&(n.autoGenerated=!0)}})}function QVt(t){const{annotation:e}=t;ZVt(e);const{interpolationData:n,interpolationList:r}=FVt(e,t)||{};if(!n||!r)return;const i={toolName:e.metadata.toolName,toolType:e.metadata.toolName,viewport:t.viewport};for(let l=0;l<r.length;l++)r[l]&&JVt(r[l].list,r[l].pair,n,i);const{id:a,renderingEngineId:o,element:s}=t.viewport,c={annotation:e,element:s,viewportId:a,renderingEngineId:o};r.length&&dt(t.viewport.element,ge.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED,c)}function JVt(t,e,n,r){const i=n.get(e[0])[0],a=n.get(e[1])[0],o=Une(i.data.contour.polyline),s=Une(a.data.contour.polyline),{c1Interp:c,c2Interp:l}=i$t(o,s);c.kIndex=e[0],l.kIndex=e[1],t.forEach(function(u){e$t(c,l,u,e,n,o.x.length>s.x.length,r)})}function e$t(t,e,n,r,i,a,o){const[s,c]=r,l=(n-s)/(c-s),u=i.get(s)[0],f=i.get(c)[0],d=r$t(t,e,l,a),h=l>.5?f:u,m=qVt(d);i.has(n)?n$t(d,m,n,h,o):t$t(d,m,n,h,o)}function t$t(t,e,n,r,i){const a=t.points,{viewport:o}=i,s=oSe(a,e,r),c=o.getViewReference({sliceIndex:n});if(!c)throw new Error(`Can't find slice ${n}`);Object.assign(s.metadata,c),v1.addAnnotation(s,o.element),r.onInterpolationComplete?.(s,r);const{parentAnnotationUID:l}=r;if(l){const u=v1.getAnnotation(l),f=sSe(u,n,i);Y4e(o,f,s)}}function sSe(t,e,n){const{viewport:r}=n,i=v1.getAnnotations(t.metadata.toolName,r.element);for(let a=0;a<i.length;a++){const o=i[a];if(o.interpolationUID===t.interpolationUID&&o.metadata.sliceIndex===e)return o}}function n$t(t,e,n,r,i){const a=sSe(r,n,i),o=t.points,s=oSe(o,e,a);Object.assign(a,{metadata:s.metadata,data:s.data})}function r$t(t,e,n,r){const i=r?t.I:e.I,a=f5.fromXYZ(t),o=f5.fromXYZ(e),{length:s}=a,c=f5.create3(s),l=ut(),u=ut(),f=f5.create3(s);f.kIndex=t.kIndex;const d=f5.create3(s);d.kIndex=e.kIndex;for(let h=0;h<t.x.length;h++)if(i[h]){const m=a.getPoint(h),p=o.getPoint(h);f.push(m),d.push(p),yr(l,p,m),c.push(Ro(u,m,l,n))}return c.sources=[f,d],c}function i$t(t,e){const n=jne(t),r=jne(e),i=Math.max(Math.ceil(n[n.length-1]/Pne),Math.ceil(r[r.length-1]/Pne)),a=$ne(n),o=$ne(r),s=i+e.x.length,c=i+t.x.length,l=Vne(s,a),u=Vne(c,o),f=Lne(s-2,t.x.length),d=Lne(c-2,e.x.length),h=Ane(l,f),m=Ane(u,d),p=kne(t,h),y=kne(e,m);return o$t(p,y),a$t(p,y)}function a$t(t,e){const n={x:[],y:[],z:[],I:[]},r={x:[],y:[],z:[],I:[]};for(let i=0;i<t.x.length;i++)(t.I[i]||e.I[i])&&(n.x.push(t.x[i]),n.y.push(t.y[i]),n.z.push(t.z[i]),n.I.push(t.I[i]),r.x.push(e.x[i]),r.y.push(e.y[i]),r.z.push(e.z[i]),r.I.push(e.I[i]));return{c1Interp:n,c2Interp:r}}function o$t(t,e){const n=t.x.length,r={startingNode:0,totalSquaredXYLengths:1/0};for(let a=0;a<n;a++){let o=a,s=0;for(let c=0;c<n;c++)s+=(t.x[o]-e.x[c])**2+(t.y[o]-e.y[c])**2+(t.z[o]-e.z[c])**2,o++,o===n&&(o=0);s<r.totalSquaredXYLengths&&(r.totalSquaredXYLengths=s,r.startingNode=a)}const i=r.startingNode;KS(t.x,i),KS(t.y,i),KS(t.z,i),KS(t.I,i)}function KS(t,e){e-=t.length*Math.floor(e/t.length);const n=t.splice(0,e);return t.push(...n),t}function kne(t,e){const n={x:[],y:[],z:[],I:[]};for(let r=0;r<t.x.length-1;r++){n.x.push(t.x[r]),n.y.push(t.y[r]),n.z.push(t.z[r]),n.I.push(!0);const i=(t.x[r+1]-t.x[r])/(e[r]+1),a=(t.y[r+1]-t.y[r])/(e[r]+1),o=(t.z[r+1]-t.z[r])/(e[r]+1);for(let s=0;s<e[r]-1;s++)n.x.push(n.x[n.x.length-1]+i),n.y.push(n.y[n.y.length-1]+a),n.z.push(n.z[n.z.length-1]+o),n.I.push(!1)}return n}function Ane(t,e){const n=[];for(let o=0;o<t.length;++o)n[o]=o;n.sort(function(o,s){return t[o]<t[s]?-1:1});const r=[];for(let o=0;o<e.length;o++)r.push(e[n[o]]);const i=r.reduce(function(o,s,c){return s&&o.push(c),o},[]),a=[];for(let o=0;o<i.length-1;o++)a.push(i[o+1]-i[o]);return a}function Lne(t,e){const n=new Array(t+e);return n.fill(!1,0,t),n.fill(!0,t,t+e),n}function Vne(t,e){const n=1/(t-1),r=[n];for(let i=1;i<t-2;i++)r.push(r[r.length-1]+n);return r.concat(e)}function $ne(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n]/t[t.length-1]);return e}function jne(t){const e=[0];for(let n=1;n<t.x.length;n++){const r=Math.sqrt((t.x[n]-t.x[n-1])**2+(t.y[n]-t.y[n-1])**2+(t.z[n]-t.z[n-1])**2);e.push(e[n-1]+r)}return e}function Une(t){const e={x:[],y:[],z:[]};for(let n=0;n<t.length;n++)e.x[n]=t[n][0],e.y[n]=t[n][1],e.z[n]=t[n][2];return e.x.push(e.x[0]),e.y.push(e.y[0]),e.z.push(e.z[0]),e}function Fne(t){const{annotation:e}=t,n=fB(t,[{key:"interpolationUID",value:t.interpolationUID}]),r=e.metadata.sliceIndex;let i=-1,a=t.sliceData.numberOfSlices;for(const[s,c]of n.entries())s===r||!c.find(u=>!u.autoGenerated)||(s<r?i=Math.max(s,i):a=Math.min(s,a));const o=[];for(const[s,c]of n.entries())s<=i||s>=a||s===r||c.forEach(l=>{l.autoGenerated&&(v1.removeAnnotation(l.annotationUID),o.push(l))});if(o.length){const s={annotations:o,element:t.viewport.element,viewportId:t.viewport.id,renderingEngineId:t.viewport.getRenderingEngine().id};dt(t.viewport.element,ge.INTERPOLATED_ANNOTATIONS_REMOVED,s)}if(i>=0&&a<t.sliceData.numberOfSlices){const s=n.get(a)[0],c={viewport:t.viewport,sliceData:{numberOfSlices:t.sliceData.numberOfSlices,imageIndex:s.metadata.sliceIndex},annotation:s,interpolationUID:s.interpolationUID};QC(c)}}function lI(t){const e=Q4e(t);return e.length?e[0]:void 0}const{uuidv4:s$t}=Bc,c$t=[na.HandlesUpdated,na.InterpolationUpdated],lu=class lu{static addTool(e){this.toolNames.includes(e)||this.toolNames.push(e)}static removeTool(e){this.toolNames.includes(e)&&(this.toolNames=this.toolNames.filter(n=>n!==e))}static acceptAutoGenerated(e,n={}){const{toolNames:r,segmentationId:i,segmentIndex:a,sliceIndex:o}=n;for(const s of r||lu.toolNames){const c=v1.getAnnotations(s,e);if(c?.length)for(const l of c){const{interpolationUID:u,data:f,autoGenerated:d,metadata:h}=l;u&&(l.interpolationCompleted=!0),d&&(a&&a!==f.segmentation.segmentIndex||o!==void 0&&h&&o!==h.sliceIndex||i&&i!==f.segmentation.segmentationId||(g1(l),l.autoGenerated=!1))}}}};lu.toolNames=[],lu.handleAnnotationCompleted=e=>{const n=e.detail.annotation;if(!n?.metadata)return;const{toolName:r,originalToolName:i}=n.metadata;if(!lu.toolNames.includes(r)&&!lu.toolNames.includes(i))return;const a=lI(n);if(!a){console.warn("Unable to find viewport for",n);return}const o=uI(a),s={viewport:a,sliceData:o,annotation:n,interpolationUID:n.interpolationUID},c=!!n.interpolationUID;if(n.autoGenerated=!1,c){Fne(s),QC(s);return}const l=[{key:"segmentIndex",value:n.data.segmentation.segmentIndex,parentKey:h=>h.data.segmentation},{key:"viewPlaneNormal",value:n.metadata.viewPlaneNormal,parentKey:h=>h.metadata},{key:"viewUp",value:n.metadata.viewUp,parentKey:h=>h.metadata}];let u=UVt(s,l);const{sliceIndex:f}=n.metadata,d=new Set;u.forEach(h=>{if(h.interpolationCompleted||h.metadata.sliceIndex===f){const{interpolationUID:m}=h;d.add(m)}}),u=u.filter(h=>!d.has(h.interpolationUID)),n.interpolationUID=u[0]?.interpolationUID||s$t(),s.interpolationUID=n.interpolationUID,QC(s)},lu.handleAnnotationUpdate=e=>{const n=e.detail.annotation,{changeType:r=na.HandlesUpdated}=e.detail;if(!n?.metadata)return;const{toolName:i,originalToolName:a}=n.metadata;if(!lu.toolNames.includes(i)&&!lu.toolNames.includes(a)||!c$t.includes(r))return;const o=lI(n);if(!o){console.warn("Unable to find matching viewport for annotation interpolation",n);return}n.autoGenerated&&(g1(n),n.autoGenerated=!1);const s=uI(o),c={viewport:o,sliceData:s,annotation:n,interpolationUID:n.interpolationUID,isInterpolationUpdate:r===na.InterpolationUpdated};QC(c)},lu.handleAnnotationDelete=e=>{const n=e.detail.annotation;if(!n?.metadata)return;const{toolName:r}=n.metadata;if(!lu.toolNames.includes(r)||n.autoGenerated)return;const i=lI(n);if(!i){console.warn("No viewport, can't delete interpolated results",n);return}const a=uI(i),o={viewport:i,sliceData:a,annotation:n,interpolationUID:n.interpolationUID};n.autoGenerated=!1,Fne(o)};let ff=lu;function uI(t){return{numberOfSlices:t.getNumberOfSlices(),imageIndex:t.getCurrentImageIdIndex()}}function l$t(t){t.forEach(e=>{const n=qy(e);if(!n){console.warn(`ToolGroup not available for ${e}`);return}n.getViewportsInfo().forEach(i=>{const{renderingEngineId:a,viewportId:o}=i,s=O1(a);if(!s){console.warn(`RenderingEngine not available for ${a}`);return}const c=s.getViewport(o);D3(c.element)})})}function u$t(t){const e=zc(t);if(!e)throw new Error(`No segmentation state found for ${t}`);const{segments:n}=e;return Object.keys(n).filter(i=>n[i].locked).map(i=>parseInt(i))}function f$t(t,e,n){const r=Vm(t,{segmentationId:e});if(!r||r.length===0)return null;const i=r[0],{colorLUTIndex:a}=i,o=KF(a);let s=o[n];if(!s){if(typeof n!="number")return console.warn(`Can't create colour for LUT index ${n}`),null;s=o[n]=[0,0,0,0]}return s}function d$t(t,e){return $d.getSegmentationRepresentationVisibility(t,e)}function h$t({segmentationId:t,segmentIndex:e,viewportId:n,autoGenerated:r=!1}){const i=f$t(n,t,e),a=d$t(n,{segmentationId:t,type:Dn.Contour}),s=sB(n)?.segmentationId===t,l=xy.getStyle({viewportId:n,segmentationId:t,type:Dn.Contour,segmentIndex:e});let u=1,f,d=1,h=0;r?(u=l.outlineWidthAutoGenerated??u,f=l.outlineDashAutoGenerated??f,d=l.outlineOpacity??d,h=l.fillAlphaAutoGenerated??h):s?(u=l.outlineWidth??u,f=l.outlineDash??f,d=l.outlineOpacity??d,h=l.fillAlpha??h):(u=l.outlineWidthInactive??u,f=l.outlineDashInactive??f,d=l.outlineOpacityInactive??d,h=l.fillAlphaInactive??h),cB(t)===e&&(u+=l.activeSegmentOutlineWidthDelta),u=l.renderOutline?u:0,h=l.renderFill?h:0;const m=`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${d})`,p=`rgb(${i[0]}, ${i[1]}, ${i[2]})`,x=!XF(n,{segmentationId:t,type:Dn.Contour}).has(e);return{color:m,fillColor:p,lineWidth:u,fillOpacity:h,lineDash:f,textbox:{color:m},visibility:a&&x}}const OB=class OB extends jVt{constructor(e,n){super(e,n),this.configuration.interpolation?.enabled&&ff.addTool(this.getToolName())}onSetToolConfiguration(){this.configuration.interpolation?.enabled?ff.addTool(this.getToolName()):ff.removeTool(this.getToolName())}isContourSegmentationTool(){return!0}createAnnotation(e){const n=e.detail,{element:r}=n,i=yt(r);if(!i)return;const{viewport:a}=i,o=super.createAnnotation(e);if(!this.isContourSegmentationTool())return o;const s=sB(a.id);if(!s)throw new Error("No active segmentation detected, create one before using scissors tool");if(!s.representationData.Contour)throw new Error("A contour segmentation must be active");const{segmentationId:c}=s,l=cB(c);return Ac(o,{data:{segmentation:{segmentationId:c,segmentIndex:l}}})}addAnnotation(e,n){const r=super.addAnnotation(e,n);return this.isContourSegmentationTool()&&g1(e),r}cancelAnnotation(e){this.isContourSegmentationTool()&&h1(e),super.cancelAnnotation(e)}getAnnotationStyle(e){const n=super.getAnnotationStyle(e);if(!this.isContourSegmentationTool())return n;const r=this._getContourSegmentationStyle(e);return Ac(n,r)}renderAnnotationInstance(e){const{annotation:n}=e,{invalidated:r}=n,i=super.renderAnnotationInstance(e);if(r&&this.isContourSegmentationTool()){const{segmentationId:a}=n.data.segmentation;p9(a);const s=$4e(a).map(c=>Is(c).id);l$t(s)}return i}_getContourSegmentationStyle(e){const n=e.annotation,{segmentationId:r,segmentIndex:i}=n.data.segmentation,{viewportId:a}=e.styleSpecifier,o=Vm(a,{segmentationId:r});if(!o?.length)return{};o.length>1?o.find(y=>y.segmentationId===r&&y.type===Dn.Contour):o[0];const{autoGenerated:s}=n,l=u$t(r).includes(i),{color:u,fillColor:f,lineWidth:d,fillOpacity:h,lineDash:m,visibility:p}=h$t({segmentationId:r,segmentIndex:i,viewportId:a,autoGenerated:s});return{color:u,fillColor:f,lineWidth:d,fillOpacity:h,lineDash:m,textbox:{color:u},visibility:p,locked:l}}};OB.PreviewSegmentIndex=255;let Ak=OB;function E9(t,e,n){return t==="CT"?"HU":t==="PT"?g$t(e,n):""}function g$t(t,e){return e.isPreScaled?e.isSuvScaled?"SUV":Ot("generalSeriesModule",t)?.modality==="PT"?Ot("petSeriesModule",t)?.units||"unitless":"unknown":"raw"}const{pointCanProjectOnLine:Bne}=M1,{EPSILON:p$t}=wU,m$t=1-p$t,DB=class DB extends Ak{constructor(e={},n={supportedInteractionTypes:["Mouse","Touch"],configuration:{storePointData:!1,shadow:!0,preventHandleOutsideImage:!1,contourHoleAdditionModifierKey:sl.Shift,alwaysRenderOpenContourHandles:{enabled:!1,radius:2},allowOpenContours:!0,closeContourProximity:10,checkCanvasEditFallbackProximity:6,makeClockWise:!0,subPixelResolution:4,smoothing:{smoothOnAdd:!1,smoothOnEdit:!1,knotsRatioPercentageOnAdd:40,knotsRatioPercentageOnEdit:40},interpolation:{enabled:!1,onInterpolationComplete:null},decimate:{enabled:!1,epsilon:.1},displayOnePointAsCrosshairs:!1,calculateStats:!0,getTextLines:v$t,statsCalculator:tb}}){super(e,n),this.isDrawing=!1,this.isEditingClosed=!1,this.isEditingOpen=!1,this.addNewAnnotation=r=>{const i=r.detail,{element:a}=i,o=this.createAnnotation(r);this.addAnnotation(o,a);const s=ra(a,this.getToolName());return this.activateDraw(r,o,s),r.preventDefault(),Qt(s),o},this.handleSelectedCallback=(r,i,a)=>{const o=r.detail,{element:s}=o,c=ra(s,this.getToolName());this.activateOpenContourEndEdit(r,i,c,a)},this.toolSelectedCallback=(r,i)=>{const a=r.detail,{element:o}=a,s=ra(o,this.getToolName());i.data.contour.closed?this.activateClosedContourEdit(r,i,s):this.activateOpenContourEdit(r,i,s),r.preventDefault()},this.isPointNearTool=(r,i,a,o)=>{const s=yt(r),{viewport:c}=s,{polyline:l}=i.data.contour;let u=c.worldToCanvas(l[0]);for(let h=1;h<l.length;h++){const m=u,p=c.worldToCanvas(l[h]);if(Bne(a,m,p,o))return!0;u=p}if(!i.data.contour.closed)return!1;const f=c.worldToCanvas(l[0]),d=c.worldToCanvas(l[l.length-1]);return Bne(a,f,d,o)},this.cancel=r=>{const i=this.isDrawing,a=this.isEditingOpen,o=this.isEditingClosed;i?this.cancelDrawing(r):a?this.cancelOpenContourEdit(r):o&&this.cancelClosedContourEdit(r)},this._calculateCachedStats=(r,i,a,o)=>{const{data:s}=r,{cachedStats:c}=s,{polyline:l,closed:u}=s.contour,f=Object.keys(c);for(let h=0;h<f.length;h++){const m=f[h],p=this.getTargetImageData(m);if(!p)continue;const{imageData:y,metadata:x}=p,S=l.map($=>i.worldToCanvas($)),C={isPreScaled:T9(i,m),isSuvScaled:this.isSuvScaled(i,m,r.metadata.referencedImageId)},_=E9(x.Modality,r.metadata.referencedImageId,C),T=w9(p,()=>{const $=s.contour.polyline,W=$.length,G=new Array(W);for(let te=0;te<W;te++)G[te]=i.worldToCanvas($[te]);const{maxX:oe,maxY:U,minX:Y,minY:J}=d6(G),ne=i.canvasToWorld([Y,J]),F=nd(y,ne),ae=i.canvasToWorld([oe,U]),re=nd(y,ae);return[F,re]}),O=S[0],M=i.canvasToWorld(O),I=i.canvasToWorld([O[0]+1,O[1]]),V=i.canvasToWorld([O[0],O[1]+1]),k=Gy(M,I),L=Gy(M,V);u?this.updateClosedCachedStats({targetId:m,viewport:i,canvasCoordinates:S,points:l,imageData:y,metadata:x,cachedStats:c,modalityUnit:_,calibratedScale:T,deltaInX:k,deltaInY:L}):this.updateOpenCachedStats({metadata:x,canvasCoordinates:S,targetId:m,cachedStats:c,modalityUnit:_,calibratedScale:T,deltaInX:k,deltaInY:L})}const d=r.invalidated;return r.invalidated=!1,d&&ji(r,o.viewport.element,na.StatsUpdated),c},this._renderStats=(r,i,a,o)=>{const{data:s}=r,c=this.getTargetId(i),l={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:a.viewport.id,annotationUID:r.annotationUID},u=this.getLinkedTextBoxStyle(l,r);if(!u.visibility)return;const f=this.configuration.getTextLines(s,c);if(!f||f.length===0)return;const d=s.contour.polyline.map(_=>i.worldToCanvas(_));if(!s.handles.textBox.hasMoved){const _=M3(d);s.handles.textBox.worldPosition=i.canvasToWorld(_)}const h=i.worldToCanvas(s.handles.textBox.worldPosition),p=F2(o,r.annotationUID??"","1",f,h,d,{},u),{x:y,y:x,width:S,height:C}=p;s.handles.textBox.worldBoundingBox={topLeft:i.canvasToWorld([y,x]),topRight:i.canvasToWorld([y+S,x]),bottomLeft:i.canvasToWorld([y,x+C]),bottomRight:i.canvasToWorld([y+S,x+C])}},GLt(this),QLt(this),cVt(this),bVt(this),_Vt(this),VVt(this),this._throttledCalculateCachedStats=B2(this._calculateCachedStats,100,{trailing:!0})}filterInteractableAnnotationsForElement(e,n){if(!n||!n.length)return;const r=yt(e),{viewport:i}=r;let a;if(i instanceof is){const o=i.getCamera(),{spacingInNormalDirection:s}=S3(i,o);a=this.filterAnnotationsWithinSlice(n,o,s)}else a=eSe(i,n);return a}filterAnnotationsWithinSlice(e,n,r){const{viewPlaneNormal:i}=n,a=e.filter(l=>{let u=l.metadata.viewPlaneNormal;if(!l.metadata.referencedImageId&&!u&&l.metadata.FrameOfReferenceUID){for(const d of l.data.contour.polyline){const h=yr(ut(),d,n.focalPoint),m=Vt(h,n.viewPlaneNormal);if(!Lr(m,0))return!1}return l.metadata.viewPlaneNormal=n.viewPlaneNormal,l.metadata.cameraFocalPoint=n.focalPoint,!0}if(!u){const{referencedImageId:d}=l.metadata,{imageOrientationPatient:h}=Ot("imagePlaneModule",d),m=Zn(h[0],h[1],h[2]),p=Zn(h[3],h[4],h[5]);u=ut(),Tr(u,m,p),l.metadata.viewPlaneNormal=u}const f=Math.abs(Vt(i,u))>m$t;return u&&f});if(!a.length)return[];const o=r/2,{focalPoint:s}=n,c=[];for(const l of a){const f=l.data.contour.polyline[0];if(!l.isVisible)continue;const d=ut();yr(d,s,f);const h=Vt(d,i);Math.abs(h)<o&&c.push(l)}return c}isContourSegmentationTool(){return!1}createAnnotation(e){const n=e.detail.currentPoints.world,r=super.createAnnotation(e),i=o=>{o.data.handles.points.length=0};return Ac(r,{data:{contour:{polyline:[[...n]]},label:"",cachedStats:{}},onInterpolationComplete:i})}getAnnotationStyle(e){return super.getAnnotationStyle(e)}renderAnnotationInstance(e){const{enabledElement:n,targetId:r,svgDrawingHelper:i}=e,a=e.annotation;let o=!1;const{viewport:s,renderingEngine:c}=n,l=this.isDrawing,u=this.isEditingOpen,f=this.isEditingClosed;if(!(l||u||f))this.configuration.displayOnePointAsCrosshairs&&a.data.contour.polyline.length===1?this.renderPointContourWithMarker(n,i,a):this.renderContour(n,i,a);else{const d=this.commonData.annotation.annotationUID;if(a.annotationUID===d)if(l)this.renderContourBeingDrawn(n,i,a);else if(f)this.renderClosedContourBeingEdited(n,i,a);else if(u)this.renderOpenContourBeingEdited(n,i,a);else throw new Error(`Unknown ${this.getToolName()} annotation rendering state`);else this.configuration.displayOnePointAsCrosshairs&&a.data.contour.polyline.length===1?this.renderPointContourWithMarker(n,i,a):this.renderContour(n,i,a);o=!0}if(this.configuration.calculateStats)return this._calculateStatsIfActive(a,r,s,c,n),this._renderStats(a,s,n,i),o}_calculateStatsIfActive(e,n,r,i,a){const o=this.commonData?.annotation.annotationUID;if(!(e.annotationUID===o&&!this.commonData?.movingTextBox)&&!this.commonData?.movingTextBox){const{data:s}=e;s.cachedStats[n]?.unit?e.invalidated&&this._throttledCalculateCachedStats(e,r,i,a):(s.cachedStats[n]={Modality:null,area:null,max:null,mean:null,stdDev:null,areaUnit:null,unit:null},this._calculateCachedStats(e,r,i,a))}}updateClosedCachedStats({viewport:e,points:n,imageData:r,metadata:i,cachedStats:a,targetId:o,modalityUnit:s,canvasCoordinates:c,calibratedScale:l,deltaInX:u,deltaInY:f}){const{scale:d,areaUnit:h,unit:m}=l,{voxelManager:p}=e.getImageData(),y=nd(r,n[0]);y[0]=Math.floor(y[0]),y[1]=Math.floor(y[1]),y[2]=Math.floor(y[2]);let x=y[0],S=y[0],C=y[1],_=y[1],T=y[2],O=y[2];for(let ae=1;ae<n.length;ae++){const re=nd(r,n[ae]);re[0]=Math.floor(re[0]),re[1]=Math.floor(re[1]),re[2]=Math.floor(re[2]),x=Math.min(x,re[0]),S=Math.max(S,re[0]),C=Math.min(C,re[1]),_=Math.max(_,re[1]),T=Math.min(T,re[2]),O=Math.max(O,re[2])}const M=nd(r,n[1]);M[0]=Math.floor(M[0]),M[1]=Math.floor(M[1]),M[2]=Math.floor(M[2]);let I=QF(c)/d/d;I*=u*f;let V=Rne(c,closed)/d;V*=Math.sqrt(Math.pow(u,2)+Math.pow(f,2));const k=.01*(S-x),L=.01*(_-C),$=.01*(O-T);x=Math.floor(x-k),S=Math.ceil(S+k),C=Math.floor(C-L),_=Math.ceil(_+L),T=Math.floor(T-$),O=Math.ceil(O+$);const W=[[x,S],[C,_],[T,O]],G=r.indexToWorld([S,_,O]),oe=e.worldToCanvas(G);let U=0,Y=[],J=0,ne;p&&(ne=p.forEach(this.configuration.statsCalculator.statsCallback,{imageData:r,isInObject:(ae,re)=>{let te=!0;const ye=e.worldToCanvas(ae);return ye[1]!=U&&(J=0,U=ye[1],Y=q4e(c,ye,[oe[0],ye[1]]),Y.sort((function(we){return function(Oe,Te){return Oe[we]===Te[we]?0:Oe[we]<Te[we]?-1:1}})(0))),Y.length&&ye[0]>Y[0][0]&&(Y.shift(),J++),J%2===0&&(te=!1),te},boundsIJK:W,returnPoints:this.configuration.storePointData}));const F=this.configuration.statsCalculator.getStatistics();a[o]={Modality:i.Modality,area:I,perimeter:V,mean:F.mean?.value,max:F.max?.value,min:F.min?.value,stdDev:F.stdDev?.value,statsArray:F.array,pointsInShape:ne,areaUnit:h,modalityUnit:s,unit:m}}updateOpenCachedStats({targetId:e,metadata:n,canvasCoordinates:r,cachedStats:i,modalityUnit:a,calibratedScale:o,deltaInX:s,deltaInY:c}){const{scale:l,unit:u}=o;let f=Rne(r,closed)/l;f*=Math.sqrt(Math.pow(s,2)+Math.pow(c,2)),i[e]={Modality:n.Modality,length:f,modalityUnit:a,unit:u}}};DB.toolName="PlanarFreehandROI";let Lk=DB;function v$t(t,e){const n=t.cachedStats[e],{area:r,mean:i,stdDev:a,length:o,perimeter:s,max:c,min:l,isEmptyArea:u,unit:f,areaUnit:d,modalityUnit:h}=n||{},m=[];if(uo(r)){const p=u?"Area: Oblique not supported":`Area: ${Qi(r)} ${d}`;m.push(p)}return uo(i)&&m.push(`Mean: ${Qi(i)} ${h}`),uo(c)&&m.push(`Max: ${Qi(c)} ${h}`),uo(l)&&m.push(`Min: ${Qi(l)} ${h}`),uo(a)&&m.push(`Std Dev: ${Qi(a)} ${h}`),uo(s)&&m.push(`Perimeter: ${Qi(s)} ${f}`),uo(o)&&m.push(`${Qi(o)} ${f}`),m}const MB=class MB extends Lk{constructor(e){const n=Ac({configuration:{calculateStats:!1,allowOpenContours:!1}},e);super(n)}isContourSegmentationTool(){return!0}renderAnnotationInstance(e){const n=e.annotation,{invalidated:r}=n,i=super.renderAnnotationInstance(e);if(r){const{segmentationId:a}=n.data.segmentation;p9(a)}return i}};MB.toolName="PlanarFreehandContourSegmentationTool";let m6=MB;const y$t={[Dn.Labelmap]:lLt,[Dn.Contour]:ZAt,[Dn.Surface]:ekt},YS=m6.toolName;class x$t{constructor(){this._needsRender=new Set,this._pendingRenderQueue=[],this._animationFrameSet=!1,this._animationFrameHandle=null,this._getAllViewports=()=>Ld().flatMap(n=>n.getViewports()),this._renderFlaggedSegmentations=()=>{if(this._throwIfDestroyed(),Array.from(this._needsRender).forEach(n=>{this._triggerRender(n)}),this._needsRender.clear(),this._animationFrameSet=!1,this._animationFrameHandle=null,this._pendingRenderQueue.length>0){const n=this._pendingRenderQueue.shift();n&&n.length>0&&this._setViewportsToBeRenderedNextFrame(n)}}}renderSegmentationsForViewport(e){const n=e?[e]:this._getViewportIdsForSegmentation();this._setViewportsToBeRenderedNextFrame(n)}renderSegmentation(e){const n=this._getViewportIdsForSegmentation(e);this._setViewportsToBeRenderedNextFrame(n)}_getViewportIdsForSegmentation(e){const n=this._getAllViewports(),r=[];for(const i of n){const a=i.id;e?Vm(a,{segmentationId:e})?.length>0&&r.push(a):Vm(a)?.length>0&&r.push(a)}return r}_throwIfDestroyed(){if(this.hasBeenDestroyed)throw new Error("this.destroy() has been manually called to free up memory, can not longer use this instance. Instead make a new one.")}_setViewportsToBeRenderedNextFrame(e){if(this._animationFrameSet){this._pendingRenderQueue.push(e);return}e.forEach(n=>{this._needsRender.add(n)}),this._render()}_render(){this._needsRender.size>0&&this._animationFrameSet===!1&&(this._animationFrameHandle=window.requestAnimationFrame(this._renderFlaggedSegmentations),this._animationFrameSet=!0)}_triggerRender(e){const n=Vm(e);if(!n?.length)return;const{viewport:r}=Ai(e)||{};if(!r)return;const i=[],a=n.map(o=>{o.type===Dn.Contour&&this._addPlanarFreeHandToolIfAbsent(r);const s=y$t[o.type];try{const c=s.render(r,o);i.push(c)}catch(c){console.error(c)}return Promise.resolve({segmentationId:o.segmentationId,type:o.type})});Promise.allSettled(a).then(o=>{const s=o.filter(u=>u.status==="fulfilled").map(u=>u.value);function c(u){const{element:f,viewportId:d}=u.detail;f.removeEventListener(it.IMAGE_RENDERED,c),s.forEach(h=>{const m={viewportId:d,segmentationId:h.segmentationId,type:h.type};dt(pt,ge.SEGMENTATION_RENDERED,{...m})})}r.element.addEventListener(it.IMAGE_RENDERED,c),r.render()})}_addPlanarFreeHandToolIfAbsent(e){YS in Tt.tools||zu(m6);const n=Is(e.id);n.hasTool(YS)||(n.addTool(YS),n.setToolPassive(YS))}}function cSe(t){uSe.renderSegmentationsForViewport(t)}function lSe(t){uSe.renderSegmentation(t)}const uSe=new x$t;function w$t({modifiedSlicesToUse:t,representationData:e,type:n}){const r=Ct.getVolume(e[n].volumeId);if(!r){console.warn("segmentation not found in cache");return}const{imageData:i,vtkOpenGLTexture:a}=r;let o;if(t?.length>0)o=t;else{const s=i.getDimensions()[2];o=[...Array(s).keys()]}o.forEach(s=>{a.setUpdatedFrame(s)}),i.modified()}function b$t({viewportIds:t,segmentationId:e}){t.forEach(n=>{let r=Vm(n,{segmentationId:e});r=r.filter(i=>i.type===Dn.Labelmap),r.forEach(i=>{if(i.segmentationId!==e)return;const a=Ai(n);if(!a)return;const{viewport:o}=a;if(o instanceof is)return;const s=ew(n,e);s?.length&&s.forEach((c,l)=>{const u=c.actor.getMapper().getInputData(),f=nb(n,e),d=Ct.getImage(f[l]);u.modified(),a9(u,d)})})})}const S$t=function(t){const{segmentationId:e,modifiedSlicesToUse:n}=t.detail,{representationData:r}=zc(e),i=$4e(e),a=i.some(c=>{const{viewport:l}=Ai(c);return l instanceof is}),o=i.some(c=>{const{viewport:l}=Ai(c);return l instanceof Ms}),s=a&&o;i.forEach(c=>{const{viewport:l}=Ai(c);l instanceof is&&w$t({modifiedSlicesToUse:s?[]:n,representationData:r,type:Dn.Labelmap}),l instanceof Ms&&b$t({viewportIds:i,segmentationId:e})})},fSe=function(t){const{segmentationId:e}=t.detail,{representationData:n}=zc(e);n.Labelmap&&S$t(t),lSe(e)},dSe=function(t){const{segmentationId:e}=t.detail;lSe(e)};function C$t(t,e){return $d.updateLabelmapSegmentationImageReferences(t,e)}const _$t=function(t){if(!t)return;const e=yt(t);if(!e)return;const{viewport:n}=e;n instanceof Tu||(t.addEventListener(it.PRE_STACK_NEW_IMAGE,rb),t.addEventListener(it.IMAGE_RENDERED,rb))},T$t=function(t){t.removeEventListener(it.PRE_STACK_NEW_IMAGE,rb),t.removeEventListener(it.IMAGE_RENDERED,rb)};function rb(t){const e=t.detail,{viewportId:n,renderingEngineId:r}=e,{viewport:i}=C3(n,r),a=Vm(n);if(!a?.length)return;const o=a.filter(l=>l.type===Dn.Labelmap),s=i.getActors();o.forEach(l=>{const{segmentationId:u}=l;C$t(n,u)});const c=o.flatMap(l=>ew(n,l.segmentationId)).filter(l=>l!==void 0);c.length&&(c.forEach(l=>{o.find(f=>nb(n,f.segmentationId)?.includes(l.referencedId))||i.removeActors([l.uid])}),o.forEach(l=>{const{segmentationId:u}=l,f=i.getCurrentImageId(),d=nb(n,u);if(!d)return;let h=!1;const m=p=>{const y=Ct.getImage(p);if(!y){console.warn("No derived image found in the cache for segmentation representation",l);return}const x=s.find(S=>S.referencedId===p);if(x){const S=x.actor.getMapper().getInputData();S.setDerivedImage?S.setDerivedImage(y):a9(S,y)}else{const{dimensions:S,spacing:C,direction:_}=i.getImageDataMetadata(y),T=Ct.getImage(f)||{imageId:f},{origin:O}=i.getImageDataMetadata(T),M=O,I=y.voxelManager.getConstructor(),V=y.voxelManager.getScalarData(),k=On.newInstance({name:"Pixels",numberOfComponents:1,values:new I(V)}),L=YE.newInstance();L.setDimensions(S[0],S[1],1),L.setSpacing(C),L.setDirection(_),L.setOrigin(M),L.getPointData().setScalars(k),L.modified(),i.addImages([{imageId:p,representationUID:`${u}-${Dn.Labelmap}-${y.imageId}`,callback:({imageActor:$})=>{$.getMapper().setInputData(L)}}]),h=!0;return}};d.forEach(m),h&&cSe(n),i.render(),t.type===it.IMAGE_RENDERED&&i.element.removeEventListener(it.IMAGE_RENDERED,rb)}))}const hSe={enable:_$t,disable:T$t};async function E$t(t){const e=t.detail.annotation;if(!y9(e))return;const n=D$t(e),r=M$t(n,e);if(!r.length){dt(pt,ge.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED,{element:n.element,sourceAnnotation:e});return}const i=aB(e.data.contour.polyline,n),a=MAt(n,i,r);if(!a.length){dt(pt,ge.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED,{element:n.element,sourceAnnotation:e});return}if(a.length>1){IAt(n,e,i,a);return}const{targetAnnotation:o,targetPolyline:s,isContourHole:c}=a[0];if(c){const{contourHoleProcessingEnabled:l=!1}=t.detail;if(!l)return;Y4e(n,o,e)}else OAt(n,o,s,e,i)}function O$t(t,e=!1){const n="PlanarFreehandContourSegmentationTool",r=Is(t.id,t.renderingEngineId);let i;return r?r.hasTool(n)?r.getToolOptions(n)||(i=`Tool ${n} must be in active/passive state in ${r.id} toolGroup`):i=`Tool ${n} not added to ${r.id} toolGroup`:i=`ToolGroup not found for viewport ${t.id}`,i&&!e&&console.warn(i),!i}function D$t(t){const e=Q4e(t);return e.find(r=>O$t(r,!0))??e[0]}function M$t(t,e){const{annotationUID:n}=e;return K3e().filter(i=>i.annotationUID&&i.annotationUID!==n&&y9(i)&&rkt(i,e)&&t.isReferenceViewable(i.metadata))}function R$t(t){const e=t.detail.annotation;h1(e)}function gSe(t){const e=t.detail.annotation;y9(e)&&E$t(t)}function v6(t){if(!t.detail.removed.length)return;Ld().forEach(r=>{const a=r.getViewports().map(o=>o.id);Qt(a)})}function pSe(t){const{viewportId:e}=t.detail;Qt([e])}function I$t(t){const e=t.detail.annotation;y9(e)&&R$t(t)}const mSe=function(t){D3(t.detail.element)},N$t=function(t){t.addEventListener(it.IMAGE_RENDERED,mSe)},P$t=function(t){t.removeEventListener(it.IMAGE_RENDERED,mSe)},vSe={enable:N$t,disable:P$t},{Active:k$t}=vi;function z2(t,e,n){if(Tt.isInteractingWithTool)return!1;const{renderingEngineId:r,viewportId:i}=n.detail,a=Is(i,r);if(!a)return!1;let o;const s=Object.keys(a.toolOptions);for(let c=0;c<s.length;c++){const l=s[c],u=a.toolOptions[l],f=a.getToolInstance(l);if(u.mode===k$t&&typeof f[e]=="function"){o=a.getToolInstance(l);break}}o&&o[e](n)}const ySe=z2.bind(null,"Mouse","mouseClickCallback"),xSe=z2.bind(null,"Mouse","doubleClickCallback");function wSe(t,e,n,r="mouse"){const i=r==="touch"?36:6,a=[];return e.forEach(({tool:o,annotations:s})=>{for(const c of s){if(c.isLocked||!c.isVisible)continue;const l=o.getHandleNearImagePoint(t,c,n,i);if(l){a.push({tool:o,annotation:c,handle:l});break}}}),a}function O9(t,e){const n=[];for(let r=0;r<e.length;r++){const i=e[r];if(!i){console.warn("undefined tool in filterToolsWithAnnotationsForElement");continue}let a=yf(i.constructor.toolName,t);a?.length&&(typeof i.filterInteractableAnnotationsForElement=="function"&&(a=i.filterInteractableAnnotationsForElement(t,a)),a?.length>0&&n.push({tool:i,annotations:a}))}return n}function dB(t,e,n,r="mouse"){const i=r==="touch"?36:6,a=[];return e.forEach(({tool:o,annotations:s})=>{for(const c of s){if(c.isLocked||!c.isVisible)continue;if(o.isPointNearTool(t,c,n,i,r)){a.push({tool:o,annotation:c});break}}}),a}const{Active:A$t}=vi;function D9(t){const{renderingEngineId:e,viewportId:n,event:r}=t.detail,i=C9(r)||U2.getModifierKey(),a=Is(n,e);if(!a)return null;const o=Object.keys(a.toolOptions),s=a.getDefaultMousePrimary(),c=t.detail.buttons??r?.buttons??s;for(let l=0;l<o.length;l++){const u=o[l],f=a.toolOptions[u],d=f.bindings.length&&f.bindings.some(h=>h.mouseButton===c&&h.modifierKey===i);if(f.mode===A$t&&d)return a.getToolInstance(u)}}function Xy(t,e,n){const{renderingEngineId:r,viewportId:i}=t.detail,a=Is(i,r);if(!a)return[];const o=[],s=Object.keys(a.toolOptions);for(let c=0;c<s.length;c++){const l=s[c],u=a.toolOptions[l],f=n!=null&&u.bindings.length&&u.bindings.some(d=>d.mouseButton===n);if(e.includes(u.mode)&&(!n||f)){const d=a.getToolInstance(l);o.push(d)}}return o}function L$t(t,e){const n=new Map,{renderingEngineId:r,viewportId:i}=t.detail,a=Is(i,r);if(!a)return n;const o=Object.keys(a.toolOptions),s=a.getDefaultMousePrimary(),c=t.detail.event,l=c?.buttons??s,u=C9(c)||U2.getModifierKey();for(let f=0;f<o.length;f++){const d=o[f],h=a.getToolInstance(d),m=h.configuration?.actions??{},p=Object.values(m);if(!p?.length||!e.includes(h.mode))continue;const y=p.find(x=>x.bindings?.length&&x.bindings.some(S=>S.mouseButton===l&&S.modifierKey===u));y&&n.set(h,y)}return n}const{Active:V$t,Passive:$$t}=vi;function j$t(t){if(Tt.isInteractingWithTool)return!1;const e=t.detail,{element:n}=e,r=yt(n),{canvas:i}=e.currentPoints;if(!r)return!1;const a=L$t(t,[V$t,$$t]),o=Array.from(a.keys()),s=O9(n,o),c=dB(n,s,i);if(c.length>0){const{tool:l,annotation:u}=c[0],f=a.get(l);return(typeof f.method=="string"?l[f.method]:f.method).call(l,t,u),!0}return!1}const{Active:U$t,Passive:F$t}=vi;function bSe(t){if(Tt.isInteractingWithTool)return;const e=D9(t);if(e&&typeof e.preMouseDownCallback=="function"&&e.preMouseDownCallback(t))return;const n=t.detail.event.buttons===1,r=Xy(t,[U$t],t.detail.event.buttons),i=n?Xy(t,[F$t]):void 0,a=[...r||[],...i||[]];if(j$t(t))return;const s=t.detail,{element:c}=s,l=O9(c,a),u=s.currentPoints.canvas,f=wSe(c,l,u,"mouse"),d=!!t.detail.event.shiftKey;if(f.length>0){const{tool:m,annotation:p,handle:y}=zne(f);Gne(p.annotationUID,d),m.handleSelectedCallback(t,p,y,"Mouse");return}const h=dB(c,l,u,"mouse");if(h.length>0){const{tool:m,annotation:p}=zne(h);Gne(p.annotationUID,d),m.toolSelectedCallback(t,p,"Mouse",u);return}e&&typeof e.postMouseDownCallback=="function"&&e.postMouseDownCallback(t)}function zne(t){if(t.length>1){const e=t.find(n=>{const r=!xf(n.annotation.annotationUID),i=Md(n.annotation.annotationUID);return r&&i});if(e)return e}return t[0]}function Gne(t,e=!1){e?v9(t)?vd(t,!1):vd(t,!0,!0):vd(t,!0,!1)}function SSe(t){if(Tt.isInteractingWithTool)return;const e=D9(t);if(e&&e.addNewAnnotation){const n=e.addNewAnnotation(t,"mouse");vd(n.annotationUID)}}function CSe(t){if(Tt.isInteractingWithTool)return;const e=D9(t);!e||typeof e.mouseDragCallback!="function"||e.mouseDragCallback(t)}const{Active:B$t,Passive:z$t}=vi;function _Se(t){if(Tt.isInteractingWithTool||Tt.isMultiPartToolActive)return;const e=Xy(t,[B$t,z$t]),n=t.detail,{element:r}=n,i=O9(r,e),a=e.filter(s=>!i.some(l=>l.tool.getToolName()===s.getToolName()));let o=!1;for(const{tool:s,annotations:c}of i)typeof s.mouseMoveCallback=="function"&&(o=s.mouseMoveCallback(t,c)||o);a.forEach(s=>{typeof s.mouseMoveCallback=="function"&&s.mouseMoveCallback(t)}),o===!0&&D3(r)}const TSe=z2.bind(null,"Mouse","mouseUpCallback");function ESe(t){if(Tt.isInteractingWithTool)return;t.detail.buttons=ud.Wheel|(t.detail.event.buttons||0);const e=D9(t);if(e)return e.mouseWheelCallback(t)}const G$t=function(t){t.addEventListener(ge.MOUSE_CLICK,ySe),t.addEventListener(ge.MOUSE_DOWN,bSe),t.addEventListener(ge.MOUSE_DOWN_ACTIVATE,SSe),t.addEventListener(ge.MOUSE_DOUBLE_CLICK,xSe),t.addEventListener(ge.MOUSE_DRAG,CSe),t.addEventListener(ge.MOUSE_MOVE,_Se),t.addEventListener(ge.MOUSE_UP,TSe),t.addEventListener(ge.MOUSE_WHEEL,ESe)},W$t=function(t){t.removeEventListener(ge.MOUSE_CLICK,ySe),t.removeEventListener(ge.MOUSE_DOWN,bSe),t.removeEventListener(ge.MOUSE_DOWN_ACTIVATE,SSe),t.removeEventListener(ge.MOUSE_DOUBLE_CLICK,xSe),t.removeEventListener(ge.MOUSE_DRAG,CSe),t.removeEventListener(ge.MOUSE_MOVE,_Se),t.removeEventListener(ge.MOUSE_UP,TSe),t.removeEventListener(ge.MOUSE_WHEEL,ESe)},OSe={enable:G$t,disable:W$t},{Active:H$t}=vi;function DSe(t){const{renderingEngineId:e,viewportId:n}=t.detail,r=fPt(),i=U2.getModifierKey(),a=Is(n,e);if(!a)return null;const o=Object.keys(a.toolOptions),s=a.getDefaultMousePrimary();for(let c=0;c<o.length;c++){const l=o[c],u=a.toolOptions[l];if(u.mode!==H$t)continue;if(u.bindings.length&&u.bindings.some(d=>d.mouseButton===(r??s)&&d.modifierKey===i))return a.getToolInstance(l)}}function q$t(t,e){const n=new Map,{renderingEngineId:r,viewportId:i}=t.detail,a=Is(i,r);if(!a)return n;const o=Object.keys(a.toolOptions),s=t.detail.key;for(let c=0;c<o.length;c++){const l=o[c],u=a.getToolInstance(l),f=u.configuration?.actions;if(!f)continue;const d=Object.values(f);if(!d?.length||!e.includes(u.mode))continue;const h=d.find(m=>m.bindings?.some(p=>p.key===s));h&&n.set(u,h)}return n}function MSe(t){const e=DSe(t);if(e){const{renderingEngineId:r,viewportId:i}=t.detail,a=Is(i,r),o=e.getToolName();Object.keys(a.toolOptions).includes(o)&&a.setViewportsCursorByToolName(o)}const n=q$t(t,[vi.Active]);if(n?.size){const{element:r}=t.detail;for(const[i,a]of[...n.entries()])(typeof a.method=="function"?a.method:i[a.method]).call(i,r,a,t)}}function RSe(t){const e=DSe(t);if(!e)return;const{renderingEngineId:n,viewportId:r}=t.detail,i=Is(r,n);D4e();const a=e.getToolName();Object.keys(i.toolOptions).includes(a)&&i.setViewportsCursorByToolName(a)}const K$t=function(t){t.addEventListener(ge.KEY_DOWN,MSe),t.addEventListener(ge.KEY_UP,RSe)},Y$t=function(t){t.removeEventListener(ge.KEY_DOWN,MSe),t.removeEventListener(ge.KEY_UP,RSe)},ISe={enable:K$t,disable:Y$t},{Active:X$t,Passive:Z$t,Enabled:Q$t}=vi,NSe=function(t){Xy(t,[X$t,Z$t,Q$t]).forEach(n=>{n.onCameraModified&&n.onCameraModified(t)})},J$t=function(t){t.addEventListener(it.CAMERA_MODIFIED,NSe)},ejt=function(t){t.removeEventListener(it.CAMERA_MODIFIED,NSe)},PSe={enable:J$t,disable:ejt},{Active:tjt,Passive:njt,Enabled:rjt}=vi,kSe=function(t){Xy(t,[tjt,njt,rjt]).forEach(n=>{n.onImageSpacingCalibrated&&n.onImageSpacingCalibrated(t)})},ijt=function(t){t.addEventListener(it.IMAGE_SPACING_CALIBRATED,kSe)},ajt=function(t){t.removeEventListener(it.IMAGE_SPACING_CALIBRATED,kSe)},ASe={enable:ijt,disable:ajt},{Active:ojt}=vi;function hB(t){const{renderingEngineId:e,viewportId:n}=t.detail,r=t.detail.event,i=Is(n,e);if(!i)return null;const a=Object.keys(i.toolOptions),o=Object.keys(r.touches).length,s=C9(r)||U2.getModifierKey(),c=i.getDefaultMousePrimary();for(let l=0;l<a.length;l++){const u=a[l],f=i.toolOptions[u],d=f.bindings.length&&f.bindings.some(h=>(h.numTouchPoints===o||o===1&&h.mouseButton===c)&&h.modifierKey===s);if(f.mode===ojt&&d)return i.getToolInstance(u)}}function Wne(t,e,n){const{renderingEngineId:r,viewportId:i}=t.detail,a=Is(i,r);if(!a)return[];const o=[],s=Object.keys(a.toolOptions);for(let c=0;c<s.length;c++){const l=s[c],u=a.toolOptions[l],f=n!=null&&u.bindings.length&&u.bindings.some(d=>d.numTouchPoints===n);if(e.includes(u.mode)&&(!n||f)){const d=a.getToolInstance(l);o.push(d)}}return o}const{Active:sjt,Passive:cjt}=vi;function LSe(t){if(Tt.isInteractingWithTool)return;const e=hB(t);if(e&&typeof e.preTouchStartCallback=="function"&&e.preTouchStartCallback(t))return;const n=Object.keys(t.detail.event.touches).length===1,r=Wne(t,[sjt],Object.keys(t.detail.event.touches).length),i=n?Wne(t,[cjt]):void 0,a=[...r||[],...i||[],e],o=t.detail,{element:s}=o,c=O9(s,a),l=o.currentPoints.canvas,u=wSe(s,c,l,"touch"),f=!1;if(u.length>0){const{tool:h,annotation:m,handle:p}=Hne(u);qne(m.annotationUID,f),h.handleSelectedCallback(t,m,p,"Touch");return}const d=dB(s,c,l,"touch");if(d.length>0){const{tool:h,annotation:m}=Hne(d);qne(m.annotationUID,f),h.toolSelectedCallback(t,m,"Touch",l);return}e&&typeof e.postTouchStartCallback=="function"&&e.postTouchStartCallback(t)}function Hne(t){return t.length>1&&t.find(e=>!xf(e.annotation.annotationUID)&&Md(e.annotation.annotationUID))||t[0]}function qne(t,e=!1){e?v9(t)?vd(t,!1):vd(t,!0,!0):vd(t,!0,!1)}function VSe(t){if(Tt.isInteractingWithTool)return;const e=hB(t);if(e&&e.addNewAnnotation){const n=e.addNewAnnotation(t,"touch");vd(n.annotationUID)}}function $Se(t){if(Tt.isInteractingWithTool)return;const e=hB(t);!e||typeof e.touchDragCallback!="function"||e.touchDragCallback(t)}const jSe=z2.bind(null,"Touch","touchEndCallback"),ljt=z2.bind(null,"Touch","touchTapCallback"),USe=z2.bind(null,"Touch","touchPressCallback"),ujt=function(t){t.addEventListener(ge.TOUCH_START,LSe),t.addEventListener(ge.TOUCH_START_ACTIVATE,VSe),t.addEventListener(ge.TOUCH_DRAG,$Se),t.addEventListener(ge.TOUCH_END,jSe),t.addEventListener(ge.TOUCH_TAP,ljt),t.addEventListener(ge.TOUCH_PRESS,USe)},fjt=function(t){t.removeEventListener(ge.TOUCH_START,LSe),t.removeEventListener(ge.TOUCH_START_ACTIVATE,VSe),t.removeEventListener(ge.TOUCH_DRAG,$Se),t.removeEventListener(ge.TOUCH_END,jSe),t.removeEventListener(ge.TOUCH_PRESS,USe)},FSe={enable:ujt,disable:fjt},djt=function(){pt.addEventListener(ge.ANNOTATION_COMPLETED,ff.handleAnnotationCompleted),pt.addEventListener(ge.ANNOTATION_MODIFIED,ff.handleAnnotationUpdate),pt.addEventListener(ge.ANNOTATION_REMOVED,ff.handleAnnotationDelete)},hjt=function(){pt.removeEventListener(ge.ANNOTATION_COMPLETED,ff.handleAnnotationCompleted),pt.removeEventListener(ge.ANNOTATION_MODIFIED,ff.handleAnnotationUpdate),pt.removeEventListener(ge.ANNOTATION_REMOVED,ff.handleAnnotationDelete)},BSe={enable:djt,disable:hjt},{Active:gjt,Passive:pjt,Enabled:mjt}=vi,zSe=function(t){Xy(t,[gjt,pjt,mjt]).forEach(n=>{n.onResetCamera&&n.onResetCamera(t)})},vjt=function(t){t.addEventListener(it.CAMERA_RESET,zSe)},yjt=function(t){t.removeEventListener(it.CAMERA_RESET,zSe)},GSe={enable:vjt,disable:yjt};function WSe(t){const{element:e,viewportId:n}=t.detail,r=xjt(n);wjt(e),bjt(r,e),iB.addViewportElement(n,e),o4e.enable(e),E4e.enable(e),C4e.enable(e),U2.enable(e),hSe.enable(e),vSe.enable(e),PSe.enable(e),ASe.enable(e),GSe.enable(e),OSe.enable(e),ISe.enable(e),FSe.enable(e),Tt.enabledElements.push(e)}function xjt(t){const e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg"),r=`svg-layer-${t}`;n.classList.add("svg-layer"),n.setAttribute("id",r),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.style.width="100%",n.style.height="100%",n.style.pointerEvents="none",n.style.position="absolute";const i=document.createElementNS(e,"defs"),a=document.createElementNS(e,"filter"),o=document.createElementNS(e,"feOffset"),s=document.createElementNS(e,"feColorMatrix"),c=document.createElementNS(e,"feBlend");return a.setAttribute("id",`shadow-${r}`),a.setAttribute("filterUnits","userSpaceOnUse"),o.setAttribute("result","offOut"),o.setAttribute("in","SourceGraphic"),o.setAttribute("dx","0.5"),o.setAttribute("dy","0.5"),s.setAttribute("result","matrixOut"),s.setAttribute("in","offOut"),s.setAttribute("in2","matrix"),s.setAttribute("values","0.2 0 0 0 0 0 0.2 0 0 0 0 0 0.2 0 0 0 0 0 1 0"),c.setAttribute("in","SourceGraphic"),c.setAttribute("in2","matrixOut"),c.setAttribute("mode","normal"),a.appendChild(o),a.appendChild(s),a.appendChild(c),i.appendChild(a),n.appendChild(i),n}function wjt(t){const{viewportUid:e,renderingEngineUid:n}=t.dataset,r=`${e}:${n}`;Tt.svgNodeCache[r]={}}function bjt(t,e){e.querySelector("div.viewport-element").appendChild(t)}function Sjt(t,e){const n=[];if(!e&&!t)throw new Error("At least one of renderingEngineId or viewportId should be given");for(let r=0;r<Tt.synchronizers.length;r++){const i=Tt.synchronizers[r],a=!i.isDisabled(),o=i.hasSourceViewport(e,t),s=i.hasTargetViewport(e,t);a&&(o||s)&&n.push(i)}return n}const Cjt="viewport-element";function HSe(t){const{element:e,viewportId:n}=t.detail;Ejt(e),Ojt(e),iB.removeViewportElement(n,e),o4e.disable(e),E4e.disable(e),C4e.disable(e),U2.disable(e),hSe.disable(e),vSe.disable(e),PSe.disable(e),ASe.disable(e),GSe.disable(e),OSe.disable(e),ISe.disable(e),FSe.disable(e),_jt(e),Tjt(e),Djt(e)}const _jt=t=>{const e=yt(t);if(!e)return;Sjt(e.viewportId,e.renderingEngineId).forEach(r=>{r.remove(e)})},Tjt=t=>{const e=yt(t);if(!e)return;const{renderingEngineId:n,viewportId:r}=e,i=Is(r,n);i&&i.removeViewports(n,r)};function Ejt(t){const{viewportUid:e,renderingEngineUid:n}=t.dataset,r=`${e}:${n}`;delete Tt.svgNodeCache[r]}function Ojt(t){const e=t.querySelector(`div.${Cjt}`),n=e.querySelector("svg");n&&e.removeChild(n)}const Djt=function(t){const e=Tt.enabledElements.findIndex(n=>n===t);e>-1&&Tt.enabledElements.splice(e,1)},y6=function(t){const{viewportId:e}=t.detail;cSe(e)};let Kne=!1;function Mjt(t={}){Kne||(KPt(t),Rjt(),Njt(),Kne=!0)}function Rjt(){Ijt();const t=it.ELEMENT_ENABLED,e=it.ELEMENT_DISABLED;pt.addEventListener(t,WSe),pt.addEventListener(e,HSe),BSe.enable()}function Ijt(){const t=it.ELEMENT_ENABLED,e=it.ELEMENT_DISABLED;pt.removeEventListener(t,WSe),pt.removeEventListener(e,HSe),BSe.disable()}function Njt(){Pjt(),pt.addEventListener(ge.ANNOTATION_COMPLETED,gSe),pt.addEventListener(ge.ANNOTATION_MODIFIED,pSe),pt.addEventListener(ge.ANNOTATION_SELECTION_CHANGE,v6),pt.addEventListener(ge.ANNOTATION_SELECTION_CHANGE,v6),pt.addEventListener(ge.ANNOTATION_REMOVED,I$t),pt.addEventListener(ge.SEGMENTATION_MODIFIED,dSe),pt.addEventListener(ge.SEGMENTATION_DATA_MODIFIED,fSe),pt.addEventListener(ge.SEGMENTATION_REPRESENTATION_MODIFIED,y6),pt.addEventListener(ge.SEGMENTATION_REPRESENTATION_ADDED,y6)}function Pjt(){pt.removeEventListener(ge.ANNOTATION_COMPLETED,gSe),pt.removeEventListener(ge.ANNOTATION_MODIFIED,pSe),pt.removeEventListener(ge.ANNOTATION_SELECTION_CHANGE,v6),pt.removeEventListener(ge.ANNOTATION_SELECTION_CHANGE,v6),pt.removeEventListener(ge.SEGMENTATION_MODIFIED,dSe),pt.removeEventListener(ge.SEGMENTATION_DATA_MODIFIED,fSe),pt.removeEventListener(ge.SEGMENTATION_REPRESENTATION_MODIFIED,y6),pt.removeEventListener(ge.SEGMENTATION_REPRESENTATION_ADDED,y6)}const{transformWorldToIndex:Yne}=Bc,Jv=class Jv extends Nc{constructor(e={},n={supportedInteractionTypes:["Mouse","Touch"],configuration:{storePointData:!1,shadow:!0,preventHandleOutsideImage:!1,calculateStats:!0,getTextLines:kjt,statsCalculator:tb}}){super(e,n),this.addNewAnnotation=r=>{const i=r.detail,{currentPoints:a,element:o}=i,s=a.world,c=yt(o),{viewport:l}=c;this.isDrawing=!0;const u=this.constructor.createAnnotationForViewport(l,{data:{handles:{points:[[...s],[...s],[...s],[...s]],textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}},cachedStats:{}}});Ao(u,o);const f=ra(o,this.getToolName());return this.editData={annotation:u,viewportIdsToRender:f,handleIndex:3,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(o),ea(o),r.preventDefault(),Qt(f),u},this.isPointNearTool=(r,i,a,o)=>{const s=yt(r),{viewport:c}=s,{data:l}=i,{points:u}=l.handles,f=c.worldToCanvas(u[0]),d=c.worldToCanvas(u[3]),h=this._getRectangleImageCoordinates([f,d]),m=[a[0],a[1]],{left:p,top:y,width:x,height:S}=h;return Kkt([p,y,x,S],m)<=o},this.toolSelectedCallback=(r,i)=>{const a=r.detail,{element:o}=a;i.highlighted=!0;const s=ra(o,this.getToolName());this.editData={annotation:i,viewportIdsToRender:s,movingTextBox:!1},this._activateModify(o),ea(o);const c=yt(o),{renderingEngine:l}=c;Qt(s),r.preventDefault()},this.handleSelectedCallback=(r,i,a)=>{const o=r.detail,{element:s}=o,{data:c}=i;i.highlighted=!0;let l=!1,u;a.worldPosition?l=!0:u=c.handles.points.findIndex(m=>m===a);const f=ra(s,this.getToolName());this.editData={annotation:i,viewportIdsToRender:f,handleIndex:u,movingTextBox:l},this._activateModify(s),ea(s);const d=yt(s),{renderingEngine:h}=d;Qt(f),r.preventDefault()},this._endCallback=r=>{const i=r.detail,{element:a}=i,{annotation:o,viewportIdsToRender:s,newAnnotation:c,hasMoved:l}=this.editData,{data:u}=o;c&&!l||(u.handles.activeHandleIndex=null,this._deactivateModify(a),this._deactivateDraw(a),rs(a),this.doneEditMemo(),this.editData=null,this.isDrawing=!1,this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&rc(o.annotationUID),Qt(s),c&&Ml(o))},this._dragCallback=r=>{this.isDrawing=!0;const i=r.detail,{element:a}=i,{annotation:o,viewportIdsToRender:s,handleIndex:c,movingTextBox:l,newAnnotation:u}=this.editData;this.createMemo(a,o,{newAnnotation:u});const{data:f}=o;if(l){const{deltaPoints:d}=i,h=d.world,{textBox:m}=f.handles,{worldPosition:p}=m;p[0]+=h[0],p[1]+=h[1],p[2]+=h[2],m.hasMoved=!0}else if(c===void 0){const{deltaPoints:d}=i,h=d.world,{points:m}=f.handles;m.forEach(p=>{p[0]+=h[0],p[1]+=h[1],p[2]+=h[2]}),o.invalidated=!0}else{const{currentPoints:d}=i,h=yt(a),{worldToCanvas:m,canvasToWorld:p}=h.viewport,y=d.world,{points:x}=f.handles;x[c]=[...y];let S,C,_,T,O,M,I,V;switch(c){case 0:case 3:S=m(x[0]),T=m(x[3]),C=[T[0],S[1]],_=[S[0],T[1]],M=p(C),I=p(_),x[1]=M,x[2]=I;break;case 1:case 2:C=m(x[1]),_=m(x[2]),S=[_[0],C[1]],T=[C[0],_[1]],O=p(S),V=p(T),x[0]=O,x[3]=V;break}o.invalidated=!0}this.editData.hasMoved=!0,yt(a),Qt(s),o.invalidated&&ji(o,a,na.HandlesUpdated)},this.cancel=r=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(r),this._deactivateModify(r),rs(r);const{annotation:i,viewportIdsToRender:a,newAnnotation:o}=this.editData,{data:s}=i;return i.highlighted=!1,s.handles.activeHandleIndex=null,Qt(a),o&&Ml(i),this.editData=null,i.annotationUID}},this._activateDraw=r=>{Tt.isInteractingWithTool=!0,r.addEventListener(ge.MOUSE_UP,this._endCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragCallback),r.addEventListener(ge.MOUSE_MOVE,this._dragCallback),r.addEventListener(ge.MOUSE_CLICK,this._endCallback),r.addEventListener(ge.TOUCH_END,this._endCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragCallback),r.addEventListener(ge.TOUCH_TAP,this._endCallback)},this._deactivateDraw=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._endCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragCallback),r.removeEventListener(ge.MOUSE_MOVE,this._dragCallback),r.removeEventListener(ge.MOUSE_CLICK,this._endCallback),r.removeEventListener(ge.TOUCH_END,this._endCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragCallback),r.removeEventListener(ge.TOUCH_TAP,this._endCallback)},this._activateModify=r=>{Tt.isInteractingWithTool=!0,r.addEventListener(ge.MOUSE_UP,this._endCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragCallback),r.addEventListener(ge.MOUSE_CLICK,this._endCallback),r.addEventListener(ge.TOUCH_END,this._endCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragCallback),r.addEventListener(ge.TOUCH_TAP,this._endCallback)},this._deactivateModify=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._endCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragCallback),r.removeEventListener(ge.MOUSE_CLICK,this._endCallback),r.removeEventListener(ge.TOUCH_END,this._endCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragCallback),r.removeEventListener(ge.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(r,i)=>{let a=!1;const{viewport:o}=r,{element:s}=o;let c=yf(this.getToolName(),s);if(!c?.length||(c=this.filterInteractableAnnotationsForElement(s,c),!c?.length))return a;const l=this.getTargetId(o),u=o.getRenderingEngine(),f={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:r.viewport.id};for(let d=0;d<c.length;d++){const h=c[d],{annotationUID:m,data:p}=h,{points:y,activeHandleIndex:x}=p.handles,S=y.map(ae=>o.worldToCanvas(ae));f.annotationUID=m;const{color:C,lineWidth:_,lineDash:T}=this.getAnnotationStyle({annotation:h,styleSpecifier:f}),{viewPlaneNormal:O,viewUp:M}=o.getCamera();if(!p.cachedStats[l]||p.cachedStats[l].areaUnit==null)p.cachedStats[l]={Modality:null,area:null,max:null,mean:null,stdDev:null,areaUnit:null},this._calculateCachedStats(h,O,M,u,r);else if(h.invalidated&&(this._throttledCalculateCachedStats(h,O,M,u,r),o instanceof is)){const{referencedImageId:ae}=h.metadata;for(const re in p.cachedStats)re.startsWith("imageId")&&u.getStackViewports().find(we=>{const Oe=ma(ae),Te=we.hasImageURI(Oe),Me=ma(we.getCurrentImageId());return Te&&Me!==Oe})&&delete p.cachedStats[re]}if(!o.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),a;let I;if(!Md(m))continue;!xf(m)&&!this.editData&&x!==null&&x!==void 0&&(I=[S[x]]);const V=!!cp("showHandlesAlways",{});(I||V)&&bh(i,m,"0",V?S:I,{color:C});const k=`${m}-rect`;hAt(i,m,"0",S,{color:C,lineDash:T,lineWidth:_},k),a=!0;const $=this.getLinkedTextBoxStyle(f,h);if(!$.visibility){p.handles.textBox={hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}};continue}const W=this.configuration.getTextLines(p,l);if(!W||W.length===0)continue;if(!p.handles.textBox.hasMoved){const ae=M3(S);p.handles.textBox.worldPosition=o.canvasToWorld(ae)}const G=o.worldToCanvas(p.handles.textBox.worldPosition),U=F2(i,m,"1",W,G,S,{},$),{x:Y,y:J,width:ne,height:F}=U;p.handles.textBox.worldBoundingBox={topLeft:o.canvasToWorld([Y,J]),topRight:o.canvasToWorld([Y+ne,J]),bottomLeft:o.canvasToWorld([Y,J+F]),bottomRight:o.canvasToWorld([Y+ne,J+F])}}return a},this._getRectangleImageCoordinates=r=>{const[i,a]=r;return{left:Math.min(i[0],a[0]),top:Math.min(i[1],a[1]),width:Math.abs(i[0]-a[0]),height:Math.abs(i[1]-a[1])}},this._calculateCachedStats=(r,i,a,o,s)=>{if(!this.configuration.calculateStats)return;const{data:c}=r,{viewport:l}=s,{element:u}=l,f=c.handles.points[0],d=c.handles.points[3],{cachedStats:h}=c,m=Object.keys(h);for(let y=0;y<m.length;y++){const x=m[y],S=this.getTargetImageData(x);if(!S)continue;const{dimensions:C,imageData:_,metadata:T,voxelManager:O}=S,M=Yne(_,f);M[0]=Math.floor(M[0]),M[1]=Math.floor(M[1]),M[2]=Math.floor(M[2]);const I=Yne(_,d);if(I[0]=Math.floor(I[0]),I[1]=Math.floor(I[1]),I[2]=Math.floor(I[2]),this._isInsideVolume(M,I,C)){this.isHandleOutsideImage=!1;const V=Math.min(M[0],I[0]),k=Math.max(M[0],I[0]),L=Math.min(M[1],I[1]),$=Math.max(M[1],I[1]),W=Math.min(M[2],I[2]),G=Math.max(M[2],I[2]),oe=[[V,k],[L,$],[W,G]],{worldWidth:U,worldHeight:Y}=wLt(i,a,f,d),J=[M,I],{scale:ne,areaUnit:F}=w9(S,J),ae=Math.abs(U*Y)/(ne*ne),re={isPreScaled:T9(l,x),isSuvScaled:this.isSuvScaled(l,x,r.metadata.referencedImageId)},te=E9(T.Modality,r.metadata.referencedImageId,re);let ye;O&&(ye=O.forEach(this.configuration.statsCalculator.statsCallback,{boundsIJK:oe,imageData:_,returnPoints:this.configuration.storePointData}));const we=this.configuration.statsCalculator.getStatistics();h[x]={Modality:T.Modality,area:ae,mean:we.mean?.value,stdDev:we.stdDev?.value,max:we.max?.value,min:we.min?.value,statsArray:we.array,pointsInShape:ye,areaUnit:F,modalityUnit:te}}else this.isHandleOutsideImage=!0,h[x]={Modality:T.Modality}}const p=r.invalidated;return r.invalidated=!1,p&&ji(r,u,na.StatsUpdated),h},this._isInsideVolume=(r,i,a)=>wh(r,a)&&wh(i,a),this._throttledCalculateCachedStats=B2(this._calculateCachedStats,100,{trailing:!0})}};Jv.toolName="RectangleROI",Jv.hydrate=(e,n,r)=>{const i=Ai(e);if(!i)return;const{FrameOfReferenceUID:a,referencedImageId:o,viewPlaneNormal:s,instance:c,viewport:l}=Jv.hydrateBase(Jv,i,n,r),{toolInstance:u,...f}=r||{},d={annotationUID:r?.annotationUID||ya(),data:{handles:{points:n,activeHandleIndex:null},label:"",cachedStats:{}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:c.getToolName(),viewPlaneNormal:s,FrameOfReferenceUID:a,referencedImageId:o,...f}};Ao(d,l.element),Qt([l.id])};let I0=Jv;function kjt(t,e){const n=t.cachedStats[e],{area:r,mean:i,max:a,stdDev:o,areaUnit:s,modalityUnit:c,min:l}=n;if(i==null)return;const u=[];return uo(r)&&u.push(`Area: ${Qi(r)} ${s}`),uo(i)&&u.push(`Mean: ${Qi(i)} ${c}`),uo(a)&&u.push(`Max: ${Qi(a)} ${c}`),uo(l)&&u.push(`Min: ${Qi(l)} ${c}`),uo(o)&&u.push(`Std Dev: ${Qi(o)} ${c}`),u}class Og extends up{constructor(e={},n={supportedInteractionTypes:["Mouse","Touch"]}){super(e,n)}touchDragCallback(e){this._dragCallback(e)}mouseDragCallback(e){this._dragCallback(e)}_dragCallback(e){const{element:n,deltaPoints:r}=e.detail,i=yt(n),a=r.world;if(a[0]===0&&a[1]===0&&a[2]===0)return;const o=i.viewport.getCamera(),{focalPoint:s,position:c}=o,l=[c[0]-a[0],c[1]-a[1],c[2]-a[2]],u=[s[0]-a[0],s[1]-a[1],s[2]-a[2]];i.viewport.setCamera({focalPoint:u,position:l}),i.viewport.render()}}Og.toolName="Pan";const fI=4,Xne=1024,Ajt="PT";class Qf extends up{constructor(e={},n={supportedInteractionTypes:["Mouse","Touch"]}){super(e,n),this._getImageDynamicRangeFromMiddleSlice=(r,i)=>{const a=Math.floor(i[2]/2),o=i[0]*i[1];let s,c;r instanceof Float32Array?(s=4,c=Float32Array):r instanceof Uint8Array?(s=1,c=Uint8Array):r instanceof Uint16Array?(s=2,c=Uint16Array):r instanceof Int16Array&&(s=2,c=Int16Array);const l=r.buffer,u=a*o*s,f=new c(l,u,o),{max:d,min:h}=this._getMinMax(f,o);return d-h}}touchDragCallback(e){this.mouseDragCallback(e)}mouseDragCallback(e){const{element:n,deltaPoints:r}=e.detail,i=yt(n),{viewport:a}=i;let o,s,c,l,u,f,d=!1;const h=a.getProperties();if(a instanceof is){o=a.getVolumeId(),f=t9(o),{lower:s,upper:c}=h.voiRange;const m=Ct.getVolume(o);if(!m)throw new Error("Volume not found "+o);l=m.metadata.Modality,d=m.scaling&&Object.keys(m.scaling).length>0}else if(h.voiRange){l=a.modality,{lower:s,upper:c}=h.voiRange;const{preScale:m={scaled:!1}}=a.getImageData?.()||{};d=m.scaled&&m.scalingParameters?.suvbw!==void 0}else throw new Error("Viewport is not a valid type");if(l===Ajt&&d?u=this.getPTScaledNewRange({deltaPointsCanvas:r.canvas,lower:s,upper:c,clientHeight:n.clientHeight,isPreScaled:d,viewport:a,volumeId:o}):u=this.getNewRange({viewport:a,deltaPointsCanvas:r.canvas,volumeId:o,lower:s,upper:c}),!(u.lower>=u.upper)&&(a.setProperties({voiRange:u}),a.render(),a instanceof is)){f.forEach(m=>{a!==m&&m.render()});return}}getPTScaledNewRange({deltaPointsCanvas:e,lower:n,upper:r,clientHeight:i,viewport:a,volumeId:o,isPreScaled:s}){let c=fI;s?c=5/i:c=this._getMultiplierFromDynamicRange(a,o)||fI;const u=e[1]*c;return r-=u,r=s?Math.max(r,.1):r,{lower:n,upper:r}}getNewRange({viewport:e,deltaPointsCanvas:n,volumeId:r,lower:i,upper:a}){const o=this._getMultiplierFromDynamicRange(e,r)||fI,s=n[0]*o,c=n[1]*o;let{windowWidth:l,windowCenter:u}=m3(i,a);l+=s,u+=c,l=Math.max(l,1);const f=e.getProperties().VOILUTFunction;return gy(l,u,f)}_getMultiplierFromDynamicRange(e,n){let r;if(n){const a=Ct.getVolume(n),{voxelManager:o}=e.getImageData(),c=o.getMiddleSliceData().reduce((d,h)=>[Math.min(d[0],h),Math.max(d[1],h)],[1/0,-1/0]),l=a?.metadata?.BitsStored,u=l?2**l:1/0,f=c[1]-c[0];r=Number.isFinite(f)?Math.min(f,u):u}else r=this._getImageDynamicRangeFromViewport(e);const i=r/Xne;return Number.isFinite(i)?i>1?Math.round(i):i:Xne}_getImageDynamicRangeFromViewport(e){const{imageData:n,voxelManager:r}=e.getImageData();if(r?.getRange){const s=r.getRange();return s[1]-s[0]}const i=n.getDimensions();if(n.getRange){const s=n.getRange();return s[1]-s[0]}let a;if(n.getScalarData?a=n.getScalarData():a=n.getPointData().getScalars().getData(),i[2]!==1)return this._getImageDynamicRangeFromMiddleSlice(a,i);let o;if(a.getRange)o=a.getRange();else{const{min:s,max:c}=this._getMinMax(a,a.length);o=[s,c]}return o[1]-o[0]}_getMinMax(e,n){let r=1/0,i=-1/0;for(let a=0;a<n;a++){const o=e[a];o<r&&(r=o),o>i&&(i=o)}return{max:i,min:r}}}Qf.toolName="WindowLevel";class JC extends up{constructor(e={},n={supportedInteractionTypes:["Mouse","Touch"],configuration:{zoomToCenter:!1,minZoomScale:.001,maxZoomScale:3e3,pinchToZoom:!0,pan:!0,invert:!1}}){super(e,n),this.preMouseDownCallback=r=>{const i=r.detail,{element:a,currentPoints:o}=i,s=o.world,l=yt(a).viewport.getCamera(),{focalPoint:u}=l;this.initialMousePosWorld=s;let f=Zn(u[0]-s[0],u[1]-s[1],u[2]-s[2]);return f=Vr(ut(),f),this.dirVec=f,!1},this.preTouchStartCallback=r=>{if(!this.configuration.pinchToZoom)return this.preMouseDownCallback(r)},this._dragParallelProjection=(r,i,a,o=!1)=>{const{element:s,deltaPoints:c}=r.detail,l=o?r.detail.deltaDistance.canvas:c.canvas[1],u=[s.clientWidth,s.clientHeight],{parallelScale:f,focalPoint:d,position:h}=a,m=5/u[1],p=l*m*(this.configuration.invert?-1:1),y=(1-p)*f;let x=d,S=h;if(!this.configuration.zoomToCenter){const M=Gy(d,this.initialMousePosWorld);S=Ro(ut(),h,this.dirVec,-M*p),x=Ro(ut(),d,this.dirVec,-M*p)}const C=i.getImageData();let _=[1,1,1],T=y,O=!1;if(C){_=C.spacing;const{dimensions:M}=C,I=M[0]*_[0],V=M[1]*_[1],k=u[0]/u[1],L=mf().rendering?.useLegacyCameraFOV?1.1:1,$=i.options?.displayArea,W=$?.imageArea?.[0]??L,G=$?.imageArea?.[1]??L,oe=I*W,U=V*G,Y=oe/U;let J;Y>k?J=oe/k*.5:J=U*.5;const{minZoomScale:ne,maxZoomScale:F}=this.configuration,ae=J/F,re=J/ne;y<ae?(T=ae,O=!0):y>re&&(T=re,O=!0)}i.setCamera({parallelScale:T,focalPoint:O?d:x,position:O?h:S})},this._dragPerspectiveProjection=(r,i,a,o=!1)=>{const{element:s,deltaPoints:c}=r.detail,l=o?r.detail.deltaDistance.canvas:c.canvas[1],u=[s.clientWidth,s.clientHeight],{position:f,focalPoint:d,viewPlaneNormal:h}=a,m=hu.distance2BetweenPoints(f,d),p=Math.sqrt(m)/u[1],y=[-h[0],-h[1],-h[2]],x=this.configuration.invert?l/p:l*p;let S=x*y[0];f[0]+=S,d[0]+=S,S=x*y[1],f[1]+=S,d[1]+=S,S=x*y[2],f[2]+=S,d[2]+=S,i.setCamera({position:f,focalPoint:d})},this.initialMousePosWorld=[0,0,0],this.dirVec=[0,0,0],this.configuration.pinchToZoom?this.touchDragCallback=this._pinchCallback.bind(this):this.touchDragCallback=this._dragCallback.bind(this),this.mouseDragCallback=this._dragCallback.bind(this)}mouseWheelCallback(e){this._zoom(e)}_pinchCallback(e){if(e.detail.currentPointsList.length>1){const{element:r,currentPoints:i}=e.detail,a=yt(r),{viewport:o}=a,s=o.getCamera(),c=i.world,{focalPoint:l}=s;this.initialMousePosWorld=c;let u=Zn(l[0]-c[0],l[1]-c[1],l[2]-c[2]);u=Vr(ut(),u),this.dirVec=u,s.parallelProjection?this._dragParallelProjection(e,o,s,!0):this._dragPerspectiveProjection(e,o,s,!0),o.render()}this.configuration.pan&&this._panCallback(e)}_dragCallback(e){const{element:n}=e.detail,r=yt(n),{viewport:i}=r,a=i.getCamera();a.parallelProjection?this._dragParallelProjection(e,i,a):this._dragPerspectiveProjection(e,i,a),i.render()}_zoom(e){const{element:n,points:r}=e.detail,i=yt(n),{viewport:a}=i;a.getCamera();const s=e.detail.wheel.direction,c={detail:{element:n,eventName:ge.MOUSE_WHEEL,renderingEngineId:i.renderingEngineId,viewportId:a.id,camera:{},deltaPoints:{page:r.page,client:r.client,world:r.world,canvas:[0,-s*5]},startPoints:r,lastPoints:r,currentPoints:r}};a.type===Rr.STACK&&this.preMouseDownCallback(c),this._dragCallback(c)}_panCallback(e){const{element:n,deltaPoints:r}=e.detail,i=yt(n),a=r.world,o=i.viewport.getCamera(),{focalPoint:s,position:c}=o,l=[c[0]-a[0],c[1]-a[1],c[2]-a[2]],u=[s[0]-a[0],s[1]-a[1],s[2]-a[2]];i.viewport.setCamera({focalPoint:u,position:l}),i.viewport.render()}}JC.toolName="Zoom";const XS="magnify-viewport";class Dg extends up{constructor(e={},n={supportedInteractionTypes:["Mouse","Touch"],configuration:{magnifySize:10,magnifyWidth:250,magnifyHeight:250}}){super(e,n),this._hasBeenRemoved=!1,this.preMouseDownCallback=r=>{const i=r.detail,{element:a,currentPoints:o}=i,s=yt(a),{viewport:c,renderingEngine:l}=s;if(!(c instanceof Ms))throw new Error("MagnifyTool only works on StackViewports");const u=this._getReferencedImageId(c);if(!u)throw new Error("MagnifyTool: No referenced image id found, reconstructed planes not supported yet");const f=ra(a,this.getToolName());return this.editData={referencedImageId:u,viewportIdsToRender:f,enabledElement:s,renderingEngine:l,currentPoints:o},this._createMagnificationViewport(),this._activateDraw(a),ea(a),r.preventDefault(),Qt(f),!0},this.preTouchStartCallback=r=>{this.preMouseDownCallback(r)},this._createMagnificationViewport=()=>{const{enabledElement:r,referencedImageId:i,viewportIdsToRender:a,renderingEngine:o,currentPoints:s}=this.editData,{viewport:c}=r,{element:l}=c,u=c.getProperties(),{rotation:f}=c.getViewPresentation(),{canvas:d,world:h}=s;let m;if(m=l.querySelector(".magnifyTool"),m===null){const y=document.createElement("div");y.classList.add("magnifyTool"),y.style.display="block",y.style.width=`${this.configuration.magnifyWidth}px`,y.style.height=`${this.configuration.magnifyHeight}px`,y.style.position="absolute",m=y,l.querySelector(".viewport-element").appendChild(y);const S={viewportId:XS,type:Rr.STACK,element:m};o.enableElement(S)}m.style.top=`${d[1]-this.configuration.magnifyHeight/2}px`,m.style.left=`${d[0]-this.configuration.magnifyWidth/2}px`;const p=o.getViewport(XS);p.setStack([i]).then(()=>{if(this._hasBeenRemoved)return;p.setProperties(u),p.setViewPresentation({rotation:f});const{parallelScale:y}=c.getCamera(),{focalPoint:x,position:S,viewPlaneNormal:C}=p.getCamera(),_=Math.sqrt(Math.pow(x[0]-S[0],2)+Math.pow(x[1]-S[1],2)+Math.pow(x[2]-S[2],2)),T=[h[0],h[1],h[2]],O=[T[0]+_*C[0],T[1]+_*C[1],T[2]+_*C[2]];p.setCamera({parallelScale:y*(1/this.configuration.magnifySize),focalPoint:T,position:O}),p.render()}),m.style.display="block",Qt(a)},this._dragCallback=r=>{const i=r.detail,{deltaPoints:a,element:o,currentPoints:s}=i,c=a.world,l=s.canvas,u=yt(o),{renderingEngine:f}=u,d=f.getViewport(XS),h=o.querySelector(".magnifyTool");if(!h)return;h.style.top=`${l[1]-this.configuration.magnifyHeight/2}px`,h.style.left=`${l[0]-this.configuration.magnifyWidth/2}px`;const{focalPoint:m,position:p}=d.getCamera(),y=[p[0]+c[0],p[1]+c[1],p[2]+c[2]],x=[m[0]+c[0],m[1]+c[1],m[2]+c[2]];d.setCamera({focalPoint:x,position:y}),d.render()},this._dragEndCallback=r=>{const{element:i}=r.detail,a=yt(i),{renderingEngine:o}=a;o.disableElement(XS);const s=i.querySelector(".viewport-element"),c=s.querySelector(".magnifyTool");s.removeChild(c),this._deactivateDraw(i),rs(i),this._hasBeenRemoved=!0},this._activateDraw=r=>{Tt.isInteractingWithTool=!0,this._hasBeenRemoved=!1,r.addEventListener(ge.MOUSE_UP,this._dragEndCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragCallback),r.addEventListener(ge.MOUSE_CLICK,this._dragEndCallback),r.addEventListener(ge.TOUCH_END,this._dragEndCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragCallback)},this._deactivateDraw=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._dragEndCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragCallback),r.removeEventListener(ge.MOUSE_CLICK,this._dragEndCallback),r.removeEventListener(ge.TOUCH_END,this._dragEndCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragCallback)}}_getReferencedImageId(e){const n=this.getTargetId(e);let r;return e instanceof Ms&&(r=n.split("imageId:")[1]),r}}Dg.toolName="Magnify";const{transformWorldToIndex:Zne}=Bc,ey=class ey extends Nc{constructor(e={},n={supportedInteractionTypes:["Mouse","Touch"],configuration:{preventHandleOutsideImage:!1,getTextLines:Ljt,actions:{undo:{method:"undo",bindings:[{key:"z"}]},redo:{method:"redo",bindings:[{key:"y"}]}}}}){super(e,n),this.addNewAnnotation=r=>{const i=r.detail,{currentPoints:a,element:o}=i,s=a.world;ea(o),this.isDrawing=!0;const c=this.createAnnotation(r,[[...s],[...s]]);Ao(c,o);const l=ra(o,this.getToolName());return this.editData={annotation:c,viewportIdsToRender:l,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(o),r.preventDefault(),Qt(l),c},this.isPointNearTool=(r,i,a,o)=>{const s=yt(r),{viewport:c}=s,{data:l}=i,[u,f]=l.handles.points,d=c.worldToCanvas(u),h=c.worldToCanvas(f),m={start:{x:d[0],y:d[1]},end:{x:h[0],y:h[1]}};return Ag([m.start.x,m.start.y],[m.end.x,m.end.y],[a[0],a[1]])<=o},this.toolSelectedCallback=(r,i)=>{const a=r.detail,{element:o}=a;i.highlighted=!0;const s=ra(o,this.getToolName());this.editData={annotation:i,viewportIdsToRender:s,movingTextBox:!1},this._activateModify(o),ea(o),Qt(s),r.preventDefault()},this._endCallback=r=>{const i=r.detail,{element:a}=i,{annotation:o,viewportIdsToRender:s,newAnnotation:c,hasMoved:l}=this.editData,{data:u}=o;c&&!l||(u.handles.activeHandleIndex=null,this._deactivateModify(a),this._deactivateDraw(a),rs(a),this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&rc(o.annotationUID),Qt(s),this.doneEditMemo(),c&&Ml(o),this.editData=null,this.isDrawing=!1)},this._dragCallback=r=>{this.isDrawing=!0;const i=r.detail,{element:a}=i,{annotation:o,viewportIdsToRender:s,handleIndex:c,movingTextBox:l,newAnnotation:u}=this.editData,{data:f}=o;if(this.createMemo(a,o,{newAnnotation:u}),l){const{deltaPoints:d}=i,h=d.world,{textBox:m}=f.handles,{worldPosition:p}=m;p[0]+=h[0],p[1]+=h[1],p[2]+=h[2],m.hasMoved=!0}else if(c===void 0){const{deltaPoints:d}=i,h=d.world;f.handles.points.forEach(p=>{p[0]+=h[0],p[1]+=h[1],p[2]+=h[2]}),o.invalidated=!0}else{const{currentPoints:d}=i,h=d.world;f.handles.points[c]=[...h],o.invalidated=!0}this.editData.hasMoved=!0,Qt(s),o.invalidated&&ji(o,a,na.HandlesUpdated)},this.cancel=r=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(r),this._deactivateModify(r),rs(r);const{annotation:i,viewportIdsToRender:a,newAnnotation:o}=this.editData,{data:s}=i;return i.highlighted=!1,s.handles.activeHandleIndex=null,Qt(a),o&&Ml(i),this.editData=null,i.annotationUID}},this._activateModify=r=>{Tt.isInteractingWithTool=!0,r.addEventListener(ge.MOUSE_UP,this._endCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragCallback),r.addEventListener(ge.MOUSE_CLICK,this._endCallback),r.addEventListener(ge.TOUCH_END,this._endCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragCallback),r.addEventListener(ge.TOUCH_TAP,this._endCallback)},this._deactivateModify=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._endCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragCallback),r.removeEventListener(ge.MOUSE_CLICK,this._endCallback),r.removeEventListener(ge.TOUCH_END,this._endCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragCallback),r.removeEventListener(ge.TOUCH_TAP,this._endCallback)},this._activateDraw=r=>{Tt.isInteractingWithTool=!0,r.addEventListener(ge.MOUSE_UP,this._endCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragCallback),r.addEventListener(ge.MOUSE_MOVE,this._dragCallback),r.addEventListener(ge.MOUSE_CLICK,this._endCallback),r.addEventListener(ge.TOUCH_END,this._endCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragCallback),r.addEventListener(ge.TOUCH_TAP,this._endCallback)},this._deactivateDraw=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._endCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragCallback),r.removeEventListener(ge.MOUSE_MOVE,this._dragCallback),r.removeEventListener(ge.MOUSE_CLICK,this._endCallback),r.removeEventListener(ge.TOUCH_END,this._endCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragCallback),r.removeEventListener(ge.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(r,i)=>{let a=!1;const{viewport:o}=r,{element:s}=o;let c=yf(this.getToolName(),s);if(!c?.length||(c=this.filterInteractableAnnotationsForElement(s,c),!c?.length))return a;const l=this.getTargetId(o),u=o.getRenderingEngine(),f={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:r.viewport.id};for(let d=0;d<c.length;d++){const h=c[d],{annotationUID:m,data:p}=h,{points:y,activeHandleIndex:x}=p.handles;f.annotationUID=m;const{color:S,lineWidth:C,lineDash:_,shadow:T}=this.getAnnotationStyle({annotation:h,styleSpecifier:f}),O=y.map(F=>o.worldToCanvas(F));if(!p.cachedStats[l]||p.cachedStats[l].unit==null?(p.cachedStats[l]={length:null,unit:null},this._calculateCachedStats(h,u,r)):h.invalidated&&this._throttledCalculateCachedStats(h,u,r),!o.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),a;let M;if(!Md(m))continue;!xf(m)&&!this.editData&&x!==null&&(M=[O[x]]);const I=!!cp("showHandlesAlways",{});(M||I)&&bh(i,m,"0",O,{color:S,lineDash:_,lineWidth:C});const V=`${m}-line`;if(R0(i,m,"1",O[0],O[1],{color:S,width:C,lineDash:_,shadow:T},V),a=!0,!o.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),a;const L=this.getLinkedTextBoxStyle(f,h);if(!L.visibility){p.handles.textBox={hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}};continue}const $=this.configuration.getTextLines(p,l);if(!p.handles.textBox.hasMoved){const F=M3(O);p.handles.textBox.worldPosition=o.canvasToWorld(F)}const W=o.worldToCanvas(p.handles.textBox.worldPosition),oe=F2(i,m,"1",$,W,O,{},L),{x:U,y:Y,width:J,height:ne}=oe;p.handles.textBox.worldBoundingBox={topLeft:o.canvasToWorld([U,Y]),topRight:o.canvasToWorld([U+J,Y]),bottomLeft:o.canvasToWorld([U,Y+ne]),bottomRight:o.canvasToWorld([U+J,Y+ne])}}return a},this._throttledCalculateCachedStats=B2(this._calculateCachedStats,100,{trailing:!0})}handleSelectedCallback(e,n,r){const i=e.detail,{element:a}=i,{data:o}=n;n.highlighted=!0;let s=!1,c;r.worldPosition?s=!0:c=o.handles.points.findIndex(u=>u===r);const l=ra(a,this.getToolName());this.editData={annotation:n,viewportIdsToRender:l,handleIndex:c,movingTextBox:s},this._activateModify(a),ea(a),Qt(l),e.preventDefault()}_calculateLength(e,n){const r=e[0]-n[0],i=e[1]-n[1],a=e[2]-n[2];return Math.sqrt(r*r+i*i+a*a)}_calculateCachedStats(e,n,r){const i=e.data,{element:a}=r.viewport,o=i.handles.points[0],s=i.handles.points[1],{cachedStats:c}=i,l=Object.keys(c);for(let f=0;f<l.length;f++){const d=l[f],h=this.getTargetImageData(d);if(!h)continue;const{imageData:m,dimensions:p}=h,y=Zne(m,o),x=Zne(m,s),S=[y,x],{scale:C,unit:_}=w9(h,S),T=this._calculateLength(o,s)/C;this._isInsideVolume(y,x,p)?this.isHandleOutsideImage=!1:this.isHandleOutsideImage=!0,c[d]={length:T,unit:_}}const u=e.invalidated;return e.invalidated=!1,u&&ji(e,a,na.StatsUpdated),c}_isInsideVolume(e,n,r){return wh(e,r)&&wh(n,r)}};ey.toolName="Length",ey.hydrate=(e,n,r)=>{const i=Ai(e);if(!i)return;const{FrameOfReferenceUID:a,referencedImageId:o,viewPlaneNormal:s,instance:c,viewport:l}=ey.hydrateBase(ey,i,n,r),{toolInstance:u,...f}=r||{},d={annotationUID:r?.annotationUID||ya(),data:{handles:{points:n}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:c.getToolName(),viewPlaneNormal:s,FrameOfReferenceUID:a,referencedImageId:o,...f}};Ao(d,l.element),Qt([l.id])};let N0=ey;function Ljt(t,e){const n=t.cachedStats[e],{length:r,unit:i}=n;return r==null||isNaN(r)?void 0:[`${Qi(r)} ${i}`]}const{transformWorldToIndex:Vjt}=Bc,bg=class bg extends Nc{constructor(e={},n){super(e,Nc.mergeDefaultProps(bg.probeDefaults,n)),this.addNewAnnotation=r=>{const i=r.detail,{currentPoints:a,element:o}=i,s=a.world,c=yt(o),{viewport:l}=c;this.isDrawing=!0;const u=this.constructor.createAnnotationForViewport(l,{data:{handles:{points:[[...s]]}}});Ao(u,o);const f=ra(o,this.getToolName());return this.editData={annotation:u,newAnnotation:!0,viewportIdsToRender:f},this._activateModify(o),ea(o),r.preventDefault(),Qt(f),u},this._endCallback=r=>{const i=r.detail,{element:a}=i,{annotation:o,viewportIdsToRender:s,newAnnotation:c}=this.editData,{viewportId:l,renderingEngine:u}=yt(a);this.eventDispatchDetail={viewportId:l,renderingEngineId:u.id},this._deactivateModify(a),rs(a),c&&this.createMemo(a,o,{newAnnotation:c}),this.editData=null,this.isDrawing=!1,this.doneEditMemo(),this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&rc(o.annotationUID),Qt(s),c&&Ml(o)},this._dragCallback=r=>{this.isDrawing=!0;const i=r.detail,{currentPoints:a,element:o}=i,s=a.world,{annotation:c,viewportIdsToRender:l,newAnnotation:u}=this.editData,{data:f}=c;this.createMemo(o,c,{newAnnotation:u}),f.handles.points[0]=[...s],c.invalidated=!0,Qt(l)},this.cancel=r=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateModify(r),rs(r);const{annotation:i,viewportIdsToRender:a,newAnnotation:o}=this.editData,{data:s}=i;return i.highlighted=!1,s.handles.activeHandleIndex=null,Qt(a),o&&Ml(i),this.editData=null,i.annotationUID}},this._activateModify=r=>{Tt.isInteractingWithTool=!0,r.addEventListener(ge.MOUSE_UP,this._endCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragCallback),r.addEventListener(ge.MOUSE_CLICK,this._endCallback),r.addEventListener(ge.TOUCH_END,this._endCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragCallback),r.addEventListener(ge.TOUCH_TAP,this._endCallback)},this._deactivateModify=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._endCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragCallback),r.removeEventListener(ge.MOUSE_CLICK,this._endCallback),r.removeEventListener(ge.TOUCH_END,this._endCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragCallback),r.removeEventListener(ge.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(r,i)=>{let a=!1;const{viewport:o}=r,{element:s}=o;let c=yf(this.getToolName(),s);if(!c?.length||(c=this.filterInteractableAnnotationsForElement(s,c),!c?.length))return a;const l=this.getTargetId(o),u=o.getRenderingEngine(),f={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:r.viewport.id};for(let d=0;d<c.length;d++){const h=c[d],m=h.annotationUID,p=h.data,y=p.handles.points[0],x=o.worldToCanvas(y);f.annotationUID=m;const{color:S,lineWidth:C}=this.getAnnotationStyle({annotation:h,styleSpecifier:f});if(p.cachedStats||(p.cachedStats={}),!p.cachedStats[l]||p.cachedStats[l].value===null)p.cachedStats[l]={Modality:null,index:null,value:null},this._calculateCachedStats(h,u,r,na.StatsUpdated);else if(h.invalidated&&(this._calculateCachedStats(h,u,r),o instanceof is)){const{referencedImageId:M}=h.metadata;for(const I in p.cachedStats)I.startsWith("imageId")&&u.getStackViewports().find(L=>{const $=ma(M),W=L.hasImageURI($),G=ma(L.getCurrentImageId());return W&&G!==$})&&delete p.cachedStats[I]}if(!o.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),a;if(!Md(m))continue;bh(i,m,"0",[x],{color:S,lineWidth:C,handleRadius:this.configuration.handleRadius}),a=!0;const T=this.getLinkedTextBoxStyle(f,h);if(!T.visibility)continue;const O=this.configuration.getTextLines(p,l);if(O){const M=[x[0]+this.configuration.textCanvasOffset.x,x[1]+this.configuration.textCanvasOffset.y];h6(i,m,"0",O,[M[0],M[1]],T)}}return a}}isPointNearTool(e,n,r,i){const a=yt(e),{viewport:o}=a,{data:s}=n,c=s.handles.points[0],l=o.worldToCanvas(c);return Ka(r,l)<i}toolSelectedCallback(){}getHandleNearImagePoint(e,n,r,i){const a=yt(e),{viewport:o}=a,{data:s}=n,c=s.handles.points[0],l=o.worldToCanvas(c);if(Ka(r,l)<i===!0)return c}handleSelectedCallback(e,n){const r=e.detail,{element:i}=r;n.highlighted=!0;const a=ra(i,this.getToolName());this.editData={annotation:n,viewportIdsToRender:a},this._activateModify(i),ea(i),Qt(a),e.preventDefault()}_calculateCachedStats(e,n,r,i=na.StatsUpdated){const a=e.data,{renderingEngineId:o,viewport:s}=r,{element:c}=s,l=a.handles.points[0],{cachedStats:u}=a,f=Object.keys(u);for(let h=0;h<f.length;h++){const m=f[h],p={isPreScaled:T9(s,m),isSuvScaled:this.isSuvScaled(s,m,e.metadata.referencedImageId)},y=this.getTargetImageData(m);if(!y)continue;const{dimensions:x,imageData:S,metadata:C,voxelManager:_}=y,T=C.Modality;let O=Vjt(S,l);if(O=wSt(O,O),wh(O,x)){this.isHandleOutsideImage=!1;let M=_.getAtIJKPoint(O);if(m.startsWith("imageId:")){const V=m.split("imageId:")[1],k=ma(V),$=a6(k)[0];O[2]=$.getCurrentImageIdIndex()}let I;if(T==="US"){const V=xLt(y,[O]),k=V.values.every(L=>L!==null);M=k?V.values:M,I=k?V.units:"raw"}else I=E9(T,e.metadata.referencedImageId,p);u[m]={index:O,value:M,Modality:T,modalityUnit:I},e.invalidated=!0}else this.isHandleOutsideImage=!0,u[m]={index:O,Modality:T}}const d=e.invalidated;return e.invalidated=!1,d&&ji(e,c,i),u}};bg.toolName="Probe",bg.probeDefaults={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,preventHandleOutsideImage:!1,getTextLines:$jt,handleRadius:"6",textCanvasOffset:{x:6,y:-6}}},bg.hydrate=(e,n,r)=>{const i=Ai(e);if(!i)return;const{FrameOfReferenceUID:a,referencedImageId:o,viewPlaneNormal:s,viewUp:c,instance:l,viewport:u}=bg.hydrateBase(bg,i,n,r),{toolInstance:f,...d}=r||{},h={annotationUID:r?.annotationUID||ya(),data:{handles:{points:n}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:l.getToolName(),viewPlaneNormal:s,FrameOfReferenceUID:a,referencedImageId:o,...d}};Ao(h,u.element),Qt([u.id])};let P0=bg;function $jt(t,e){const n=t.cachedStats[e],{index:r,value:i,modalityUnit:a}=n;if(i===void 0||!r)return;const o=[];if(o.push(`(${r[0]}, ${r[1]}, ${r[2]})`),i instanceof Array&&a instanceof Array)for(let s=0;s<i.length;s++)o.push(`${Qi(i[s])} ${a[s]}`);else o.push(`${Qi(i)} ${a}`);return o}const{transformWorldToIndex:Qne}=Bc,ty=class ty extends Nc{constructor(e={},n={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,preventHandleOutsideImage:!1,storePointData:!1,centerPointRadius:0,calculateStats:!0,getTextLines:jjt,statsCalculator:tb}}){super(e,n),this.isHandleOutsideImage=!1,this.addNewAnnotation=r=>{const i=r.detail,{currentPoints:a,element:o}=i,s=a.world;this.isDrawing=!0;const c=this.createAnnotation(r,[[...s],[...s],[...s],[...s]]);Ao(c,o);const l=ra(o,this.getToolName());return this.editData={annotation:c,viewportIdsToRender:l,centerWorld:s,newAnnotation:!0,hasMoved:!1},this._activateDraw(o),ea(o),r.preventDefault(),Qt(l),c},this.isPointNearTool=(r,i,a,o)=>{const s=yt(r),{viewport:c}=s,{data:l}=i,{points:u}=l.handles,f=u.map(I=>c.worldToCanvas(I)),[d,h,m,p]=f,y=Math.hypot(m[0]-p[0],m[1]-p[1]),x=Math.hypot(h[0]-d[0],h[1]-d[1]),S=Math.atan2(m[1]-p[1],m[0]-p[0]),C=[(m[0]+p[0])/2,(h[1]+d[1])/2],_={center:C,xRadius:(y-o)/2,yRadius:(x-o)/2,angle:S},T={center:C,xRadius:(y+o)/2,yRadius:(x+o)/2,angle:S},O=this._pointInEllipseCanvas(_,a);return!!(this._pointInEllipseCanvas(T,a)&&!O)},this.toolSelectedCallback=(r,i)=>{const a=r.detail,{element:o}=a;i.highlighted=!0;const s=ra(o,this.getToolName());this.editData={annotation:i,viewportIdsToRender:s,movingTextBox:!1},ea(o),this._activateModify(o);const c=yt(o),{renderingEngine:l}=c;Qt(s),r.preventDefault()},this.handleSelectedCallback=(r,i,a)=>{const o=r.detail,{element:s}=o,{data:c}=i;i.highlighted=!0;let l=!1,u,f,d,h,m,p;if(a.worldPosition)l=!0;else{const{points:x}=c.handles,{viewport:S}=yt(s),{worldToCanvas:C,canvasToWorld:_}=S;u=x.findIndex(O=>O===a);const T=x.map(C);p=T[u],h=Math.abs(T[2][0]-T[3][0]),m=Math.abs(T[0][1]-T[1][1]),f=[(T[2][0]+T[3][0])/2,(T[0][1]+T[1][1])/2],d=_(f)}const y=ra(s,this.getToolName());this.editData={annotation:i,viewportIdsToRender:y,handleIndex:u,canvasWidth:h,canvasHeight:m,centerWorld:d,originalHandleCanvas:p,movingTextBox:l},this._activateModify(s),ea(s),Qt(y),r.preventDefault()},this._endCallback=r=>{const i=r.detail,{element:a}=i,{annotation:o,viewportIdsToRender:s,newAnnotation:c,hasMoved:l}=this.editData,{data:u}=o;c&&!l||(this.doneEditMemo(),o.highlighted=!1,u.handles.activeHandleIndex=null,this._deactivateModify(a),this._deactivateDraw(a),rs(a),this.editData=null,this.isDrawing=!1,this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&rc(o.annotationUID),Qt(s),c&&Ml(o))},this._dragDrawCallback=r=>{this.isDrawing=!0;const i=r.detail,{element:a}=i,{currentPoints:o}=i,s=o.canvas,c=yt(a),{viewport:l}=c,{canvasToWorld:u}=l,{annotation:f,viewportIdsToRender:d,centerWorld:h,newAnnotation:m}=this.editData;this.createMemo(a,f,{newAnnotation:m});const p=l.worldToCanvas(h),{data:y}=f,x=Math.abs(s[0]-p[0]),S=Math.abs(s[1]-p[1]),C=[p[0],p[1]-S],_=[p[0],p[1]+S],T=[p[0]-x,p[1]],O=[p[0]+x,p[1]];y.handles.points=[u(C),u(_),u(T),u(O)],f.invalidated=!0,this.editData.hasMoved=!0,Qt(d),ji(f,a,na.HandlesUpdated)},this._dragModifyCallback=r=>{this.isDrawing=!0;const i=r.detail,{element:a}=i,{annotation:o,viewportIdsToRender:s,handleIndex:c,movingTextBox:l,newAnnotation:u}=this.editData;this.createMemo(a,o,{newAnnotation:u});const{data:f}=o;if(l){const{deltaPoints:m}=i,p=m.world,{textBox:y}=f.handles,{worldPosition:x}=y;x[0]+=p[0],x[1]+=p[1],x[2]+=p[2],y.hasMoved=!0}else if(c===void 0){const{deltaPoints:m}=i,p=m.world;f.handles.points.forEach(x=>{x[0]+=p[0],x[1]+=p[1],x[2]+=p[2]}),o.invalidated=!0}else this._dragHandle(r),o.invalidated=!0;const d=yt(a),{renderingEngine:h}=d;Qt(s),o.invalidated&&ji(o,a,na.HandlesUpdated)},this._dragHandle=r=>{const i=r.detail,{element:a}=i,{viewport:o}=yt(a),{canvasToWorld:s,worldToCanvas:c}=o,{annotation:l,canvasWidth:u,canvasHeight:f,handleIndex:d,centerWorld:h,originalHandleCanvas:m}=this.editData,p=o.worldToCanvas(h),{data:y}=l,{points:x}=y.handles,{currentPoints:S}=i,C=S.canvas;if(d===0||d===1){const _=Math.abs(C[1]-p[1]),T=[p[0],p[1]-_],O=[p[0],p[1]+_];x[0]=s(T),x[1]=s(O);const M=C[0]-m[0],I=u/2+M,V=[p[0]-I,p[1]],k=[p[0]+I,p[1]];x[2]=s(V),x[3]=s(k)}else{const _=Math.abs(C[0]-p[0]),T=[p[0]-_,p[1]],O=[p[0]+_,p[1]];x[2]=s(T),x[3]=s(O);const M=C[1]-m[1],I=f/2+M,V=[p[0],p[1]-I],k=[p[0],p[1]+I];x[0]=s(V),x[1]=s(k)}},this.cancel=r=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(r),this._deactivateModify(r),rs(r);const{annotation:i,viewportIdsToRender:a,newAnnotation:o}=this.editData,{data:s}=i;return i.highlighted=!1,s.handles.activeHandleIndex=null,Qt(a),o&&Ml(i),this.editData=null,i.annotationUID}},this._activateModify=r=>{Tt.isInteractingWithTool=!0,r.addEventListener(ge.MOUSE_UP,this._endCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragModifyCallback),r.addEventListener(ge.MOUSE_CLICK,this._endCallback),r.addEventListener(ge.TOUCH_END,this._endCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragModifyCallback),r.addEventListener(ge.TOUCH_TAP,this._endCallback)},this._deactivateModify=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._endCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragModifyCallback),r.removeEventListener(ge.MOUSE_CLICK,this._endCallback),r.removeEventListener(ge.TOUCH_END,this._endCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragModifyCallback),r.removeEventListener(ge.TOUCH_TAP,this._endCallback)},this._activateDraw=r=>{Tt.isInteractingWithTool=!0,r.addEventListener(ge.MOUSE_UP,this._endCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragDrawCallback),r.addEventListener(ge.MOUSE_MOVE,this._dragDrawCallback),r.addEventListener(ge.MOUSE_CLICK,this._endCallback),r.addEventListener(ge.TOUCH_END,this._endCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragDrawCallback),r.addEventListener(ge.TOUCH_TAP,this._endCallback)},this._deactivateDraw=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._endCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragDrawCallback),r.removeEventListener(ge.MOUSE_MOVE,this._dragDrawCallback),r.removeEventListener(ge.MOUSE_CLICK,this._endCallback),r.removeEventListener(ge.TOUCH_END,this._endCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragDrawCallback),r.removeEventListener(ge.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(r,i)=>{let a=!1;const{viewport:o}=r,{element:s}=o;let c=yf(this.getToolName(),s);if(!c?.length||(c=this.filterInteractableAnnotationsForElement(s,c),!c?.length))return a;const l=this.getTargetId(o),u=o.getRenderingEngine(),f={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:r.viewport.id};for(let d=0;d<c.length;d++){const h=c[d],{annotationUID:m,data:p}=h,{handles:y}=p,{points:x,activeHandleIndex:S}=y;f.annotationUID=m;const{color:C,lineWidth:_,lineDash:T}=this.getAnnotationStyle({annotation:h,styleSpecifier:f}),O=x.map(te=>o.worldToCanvas(te)),M=yne(O),{centerPointRadius:I}=this.configuration;if(!p.cachedStats[l]||p.cachedStats[l].areaUnit==null)p.cachedStats[l]={Modality:null,area:null,max:null,mean:null,stdDev:null,areaUnit:null},this._calculateCachedStats(h,o,u);else if(h.invalidated&&(this._throttledCalculateCachedStats(h,o,u,r),o instanceof is)){const{referencedImageId:te}=h.metadata;for(const ye in p.cachedStats)ye.startsWith("imageId")&&u.getStackViewports().find(Te=>{const Me=ma(te),be=Te.hasImageURI(Me),Ye=ma(Te.getCurrentImageId());return be&&Ye!==Me})&&delete p.cachedStats[ye]}if(!o.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),a;let V;if(!Md(m))continue;!xf(m)&&!this.editData&&S!==null&&(V=[O[S]]);const k=!!cp("showHandlesAlways",{});(V||k)&&bh(i,m,"0",k?O:V,{color:C});const L=`${m}-ellipse`,$="0";if(sAt(i,m,$,O,{color:C,lineDash:T,lineWidth:_},L),I>0&&Math.min(Math.abs(M[0][0]-M[1][0])/2,Math.abs(M[0][1]-M[1][1])/2)>3*I){const ye=this._getCanvasEllipseCenter(O);oAt(i,m,`${$}-center`,ye,I,{color:C,lineDash:T,lineWidth:_})}a=!0;const W=this.getLinkedTextBoxStyle(f,h);if(!W.visibility){p.handles.textBox={hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}};continue}const G=this.configuration.getTextLines(p,l);if(!G||G.length===0)continue;let oe;p.handles.textBox.hasMoved||(oe=M3(M),p.handles.textBox.worldPosition=o.canvasToWorld(oe));const U=o.worldToCanvas(p.handles.textBox.worldPosition),J=F2(i,m,"1",G,U,O,{},W),{x:ne,y:F,width:ae,height:re}=J;p.handles.textBox.worldBoundingBox={topLeft:o.canvasToWorld([ne,F]),topRight:o.canvasToWorld([ne+ae,F]),bottomLeft:o.canvasToWorld([ne,F+re]),bottomRight:o.canvasToWorld([ne+ae,F+re])}}return a},this._calculateCachedStats=(r,i,a)=>{if(!this.configuration.calculateStats)return;const o=r.data,{element:s}=i,{points:c}=o.handles,l=c.map(T=>i.worldToCanvas(T)),{viewPlaneNormal:u,viewUp:f}=i.getCamera(),[d,h]=yne(l),m=i.canvasToWorld(d),p=i.canvasToWorld(h),{cachedStats:y}=o,x=Object.keys(y),S=m,C=p;for(let T=0;T<x.length;T++){const O=x[T],M=this.getTargetImageData(O);if(!M)continue;const{dimensions:I,imageData:V,metadata:k,voxelManager:L}=M,$=Qne(V,S);$[0]=Math.floor($[0]),$[1]=Math.floor($[1]),$[2]=Math.floor($[2]);const W=Qne(V,C);W[0]=Math.floor(W[0]),W[1]=Math.floor(W[1]),W[2]=Math.floor(W[2]),this.isHandleOutsideImage=!this._isInsideVolume($,W,I);const G=Math.min($[0],W[0]),oe=Math.max($[0],W[0]),U=Math.min($[1],W[1]),Y=Math.max($[1],W[1]),J=Math.min($[2],W[2]),ne=Math.max($[2],W[2]),F=[[G,oe],[U,Y],[J,ne]],re={center:[(m[0]+p[0])/2,(m[1]+p[1])/2,(m[2]+p[2])/2],xRadius:Math.abs(m[0]-p[0])/2,yRadius:Math.abs(m[1]-p[1])/2,zRadius:Math.abs(m[2]-p[2])/2},{worldWidth:te,worldHeight:ye}=bLt(u,f,S,C),we=te===0&&ye===0,Oe=[$,W],{scale:Te,areaUnit:Me}=w9(M,Oe),be=Math.abs(Math.PI*(te/2)*(ye/2))/Te/Te,Ye={isPreScaled:T9(i,O),isSuvScaled:this.isSuvScaled(i,O,r.metadata.referencedImageId)},ft=E9(k.Modality,r.metadata.referencedImageId,Ye);let je;L&&L.forEach(this.configuration.statsCalculator.statsCallback,{boundsIJK:F,imageData:V,isInObject:Rt=>Mkt(re,Rt,{fast:!0}),returnPoints:this.configuration.storePointData});const It=this.configuration.statsCalculator.getStatistics();y[O]={Modality:k.Modality,area:be,mean:It.mean?.value,max:It.max?.value,min:It.min?.value,stdDev:It.stdDev?.value,statsArray:It.array,pointsInShape:je,isEmptyArea:we,areaUnit:Me,modalityUnit:ft}}const _=r.invalidated;return r.invalidated=!1,_&&ji(r,s,na.StatsUpdated),y},this._isInsideVolume=(r,i,a)=>wh(r,a)&&wh(i,a),this._throttledCalculateCachedStats=B2(this._calculateCachedStats,100,{trailing:!0})}_pointInEllipseCanvas(e,n){const{xRadius:r,yRadius:i,center:a,angle:o}=e,s=MSt(si(),n,a,-o);if(r<=0||i<=0)return!1;const c=[s[0]-a[0],s[1]-a[1]];return c[0]*c[0]/(r*r)+c[1]*c[1]/(i*i)<=1}_getCanvasEllipseCenter(e){const[n,r,i,a]=e,o=[i[0],r[1]],s=[a[0],n[1]];return[(o[0]+s[0])/2,(o[1]+s[1])/2]}};ty.toolName="EllipticalROI",ty.hydrate=(e,n,r)=>{const i=Ai(e);if(!i)return;const{FrameOfReferenceUID:a,referencedImageId:o,viewPlaneNormal:s,instance:c,viewport:l}=ty.hydrateBase(ty,i,n,r),{toolInstance:u,...f}=r||{},d={annotationUID:r?.annotationUID||ya(),data:{handles:{points:n,activeHandleIndex:null},label:"",cachedStats:{}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:c.getToolName(),viewPlaneNormal:s,FrameOfReferenceUID:a,referencedImageId:o,...f}};Ao(d,l.element),Qt([l.id])};let k0=ty;function jjt(t,e){const n=t.cachedStats[e],{area:r,mean:i,stdDev:a,max:o,isEmptyArea:s,areaUnit:c,modalityUnit:l,min:u}=n,f=[];if(uo(r)){const d=s?"Area: Oblique not supported":`Area: ${Qi(r)} ${c}`;f.push(d)}return uo(i)&&f.push(`Mean: ${Qi(i)} ${l}`),uo(o)&&f.push(`Max: ${Qi(o)} ${l}`),uo(u)&&f.push(`Min: ${Qi(u)} ${l}`),uo(a)&&f.push(`Std Dev: ${Qi(a)} ${l}`),f}const ny=class ny extends Nc{constructor(e={},n={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,showAngleArc:!1,arcOffset:5,preventHandleOutsideImage:!1,getTextLines:Ujt}}){super(e,n),this.addNewAnnotation=r=>{if(this.angleStartedNotYetCompleted)return;this.angleStartedNotYetCompleted=!0;const i=r.detail,{currentPoints:a,element:o}=i,s=a.world;ea(o),this.isDrawing=!0;const c=this.createAnnotation(r,[[...s],[...s]]);Ao(c,o);const l=ra(o,this.getToolName());return this.editData={annotation:c,viewportIdsToRender:l,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(o),r.preventDefault(),Qt(l),c},this.isPointNearTool=(r,i,a,o)=>{const s=yt(r),{viewport:c}=s,{data:l}=i,[u,f,d]=l.handles.points,h=c.worldToCanvas(u),m=c.worldToCanvas(f),p={start:{x:h[0],y:h[1]},end:{x:m[0],y:m[1]}};if(Ag([p.start.x,p.start.y],[p.end.x,p.end.y],[a[0],a[1]])<=o)return!0;if(!d)return!1;const x=c.worldToCanvas(d),S={start:{x:m[0],y:m[1]},end:{x:x[0],y:x[1]}};return Ag([S.start.x,S.start.y],[S.end.x,S.end.y],[a[0],a[1]])<=o},this.toolSelectedCallback=(r,i)=>{const a=r.detail,{element:o}=a;i.highlighted=!0;const s=ra(o,this.getToolName());this.editData={annotation:i,viewportIdsToRender:s,movingTextBox:!1},this._activateModify(o),ea(o);const c=yt(o),{renderingEngine:l}=c;Qt(s),r.preventDefault()},this._endCallback=r=>{const i=r.detail,{element:a}=i,{annotation:o,viewportIdsToRender:s,newAnnotation:c,hasMoved:l}=this.editData,{data:u}=o;if(c&&!l)return;if(this.angleStartedNotYetCompleted&&u.handles.points.length===2){this.editData.handleIndex=2;return}this.angleStartedNotYetCompleted=!1,u.handles.activeHandleIndex=null,this._deactivateModify(a),this._deactivateDraw(a),rs(a);const f=yt(a),{renderingEngine:d}=f;this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&rc(o.annotationUID),Qt(s),this.doneEditMemo(),c&&Ml(o),this.editData=null,this.isDrawing=!1},this._dragCallback=r=>{this.isDrawing=!0;const i=r.detail,{element:a}=i,{annotation:o,viewportIdsToRender:s,handleIndex:c,movingTextBox:l,newAnnotation:u}=this.editData,{data:f}=o;if(this.createMemo(a,o,{newAnnotation:u}),l){const{deltaPoints:m}=i,p=m.world,{textBox:y}=f.handles,{worldPosition:x}=y;x[0]+=p[0],x[1]+=p[1],x[2]+=p[2],y.hasMoved=!0}else if(c===void 0){const{deltaPoints:m}=i,p=m.world;f.handles.points.forEach(x=>{x[0]+=p[0],x[1]+=p[1],x[2]+=p[2]}),o.invalidated=!0}else{const{currentPoints:m}=i,p=m.world;f.handles.points[c]=[...p],o.invalidated=!0}this.editData.hasMoved=!0;const d=yt(a),{renderingEngine:h}=d;Qt(s),o.invalidated&&ji(o,a,na.HandlesUpdated)},this.cancel=r=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(r),this._deactivateModify(r),rs(r);const{annotation:i,viewportIdsToRender:a,newAnnotation:o}=this.editData,{data:s}=i;return i.highlighted=!1,s.handles.activeHandleIndex=null,Qt(a),o&&Ml(i),this.editData=null,this.angleStartedNotYetCompleted=!1,i.annotationUID}},this._activateModify=r=>{Tt.isInteractingWithTool=!0,r.addEventListener(ge.MOUSE_UP,this._endCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragCallback),r.addEventListener(ge.MOUSE_CLICK,this._endCallback),r.addEventListener(ge.TOUCH_TAP,this._endCallback),r.addEventListener(ge.TOUCH_END,this._endCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragCallback)},this._deactivateModify=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._endCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragCallback),r.removeEventListener(ge.MOUSE_CLICK,this._endCallback),r.removeEventListener(ge.TOUCH_TAP,this._endCallback),r.removeEventListener(ge.TOUCH_END,this._endCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragCallback)},this._activateDraw=r=>{Tt.isInteractingWithTool=!0,r.addEventListener(ge.MOUSE_UP,this._endCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragCallback),r.addEventListener(ge.MOUSE_MOVE,this._dragCallback),r.addEventListener(ge.MOUSE_CLICK,this._endCallback),r.addEventListener(ge.TOUCH_TAP,this._endCallback),r.addEventListener(ge.TOUCH_END,this._endCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragCallback)},this._deactivateDraw=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._endCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragCallback),r.removeEventListener(ge.MOUSE_MOVE,this._dragCallback),r.removeEventListener(ge.MOUSE_CLICK,this._endCallback),r.removeEventListener(ge.TOUCH_TAP,this._endCallback),r.removeEventListener(ge.TOUCH_END,this._endCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragCallback)},this.renderAnnotation=(r,i)=>{let a=!1;const{viewport:o}=r,{element:s}=o;let c=yf(this.getToolName(),s);if(!c?.length||(c=this.filterInteractableAnnotationsForElement(s,c),!c?.length))return a;const l=this.getTargetId(o),u=o.getRenderingEngine(),f={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:r.viewport.id};for(let d=0;d<c.length;d++){const h=c[d],{annotationUID:m,data:p}=h,{points:y,activeHandleIndex:x}=p.handles;f.annotationUID=m;const{color:S,lineWidth:C,lineDash:_,angleArcLineDash:T}=this.getAnnotationStyle({annotation:h,styleSpecifier:f}),O=y.map(ne=>o.worldToCanvas(ne));!p.cachedStats[l]||p.cachedStats[l].angle==null?(p.cachedStats[l]={angle:null},this._calculateCachedStats(h,u,r)):h.invalidated&&this._throttledCalculateCachedStats(h,u,r);let M;if(!xf(h.annotationUID)&&!this.editData&&x!==null&&(M=[O[x]]),!o.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),a;if(!Md(m))continue;const I=!!cp("showHandlesAlways",{});(M||I)&&bh(i,m,"0",O,{color:S,lineDash:_,lineWidth:C});let V="1";if(R0(i,m,V,O[0],O[1],{color:S,width:C,lineDash:_}),a=!0,O.length!==3)return a;if(V="2",R0(i,m,V,O[1],O[2],{color:S,width:C,lineDash:_}),this.configuration.showAngleArc){const ne=O[1],F=this.configuration.arcOffset,ae=Math.min(Ag([ne[0],ne[1]],[O[0][0],O[0][1]],[O[2][0],O[2][1]]),Ag([ne[0],ne[1]],[O[2][0],O[2][1]],[O[0][0],O[0][1]]))/F,re=[];let te=Math.atan2(O[0][1]-ne[1],O[0][0]-ne[0]),ye=Math.atan2(O[2][1]-ne[1],O[2][0]-ne[0]);if(ye<te&&(ye+=2*Math.PI),ye-te>Math.PI){const Te=te;te=ye,ye=Te+2*Math.PI}const Oe=32;for(let Te=0;Te<=Oe;Te++){const Me=te+Te/Oe*(ye-te);re.push([ne[0]+ae*Math.cos(Me),ne[1]+ae*Math.sin(Me)])}Um(i,m,"3",re,{color:S,width:C,lineDash:T})}if(!p.cachedStats[l]?.angle)continue;const k=this.getLinkedTextBoxStyle(f,h);if(!k.visibility){p.handles.textBox={hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}};continue}const L=this.configuration.getTextLines(p,l);if(!p.handles.textBox.hasMoved){const ne=O[1];p.handles.textBox.worldPosition=o.canvasToWorld(ne)}const $=o.worldToCanvas(p.handles.textBox.worldPosition),G=F2(i,m,"1",L,$,O,{},k),{x:oe,y:U,width:Y,height:J}=G;p.handles.textBox.worldBoundingBox={topLeft:o.canvasToWorld([oe,U]),topRight:o.canvasToWorld([oe+Y,U]),bottomLeft:o.canvasToWorld([oe,U+J]),bottomRight:o.canvasToWorld([oe+Y,U+J])}}return a},this._throttledCalculateCachedStats=B2(this._calculateCachedStats,100,{trailing:!0})}handleSelectedCallback(e,n,r){const i=e.detail,{element:a}=i,{data:o}=n;n.highlighted=!0;let s=!1,c;r.worldPosition?s=!0:c=o.handles.points.findIndex(d=>d===r);const l=ra(a,this.getToolName());this.editData={annotation:n,viewportIdsToRender:l,handleIndex:c,movingTextBox:s},this._activateModify(a),ea(a);const u=yt(a),{renderingEngine:f}=u;Qt(l),e.preventDefault()}_calculateCachedStats(e,n,r){const i=e.data,{element:a}=r.viewport;if(i.handles.points.length!==3)return;const o=i.handles.points[0],s=i.handles.points[1],c=i.handles.points[2],{cachedStats:l}=i,u=Object.keys(l);for(let d=0;d<u.length;d++){const h=u[d],m=ZC([o,s],[s,c]),{dimensions:p,imageData:y}=this.getTargetImageData(h);this.isHandleOutsideImage=[o,s,c].map(x=>nd(y,x)).some(x=>!wh(x,p)),l[h]={angle:isNaN(m)?"Incomplete Angle":m}}const f=e.invalidated;return e.invalidated=!1,f&&ji(e,a,na.StatsUpdated),l}};ny.toolName="Angle",ny.hydrate=(e,n,r)=>{const i=Ai(e);if(!i)return;const{FrameOfReferenceUID:a,referencedImageId:o,viewPlaneNormal:s,instance:c,viewport:l}=ny.hydrateBase(ny,i,n,r),{toolInstance:u,...f}=r||{},d={annotationUID:r?.annotationUID||ya(),data:{handles:{points:n}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:c.getToolName(),viewPlaneNormal:s,FrameOfReferenceUID:a,referencedImageId:o,...f}};Ao(d,l.element),Qt([l.id])};let A0=ny;function Ujt(t,e){const n=t.cachedStats[e],{angle:r}=n;return r===void 0?void 0:isNaN(r)?[`${r}`]:[`${Qi(r)} °`]}const Fjt=(...t)=>{const e=t[0].length===2?[0,0]:[0,0,0],n=t.length;for(const r of t)e[0]+=r[0]/n,e[1]+=r[1]/n,e.length===3&&(e[2]+=r[2]/n);return e},v0=Fjt,RB=class RB extends Nc{constructor(e={},n={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,preventHandleOutsideImage:!1,getTextLines:Bjt,showArcLines:!1}}){super(e,n),this.addNewAnnotation=r=>{if(this.angleStartedNotYetCompleted)return;this.angleStartedNotYetCompleted=!0;const i=r.detail,{currentPoints:a,element:o}=i,s=a.world;ea(o),this.isDrawing=!0;const c=this.createAnnotation(r,[[...s],[...s]]);Ao(c,o);const l=ra(o,this.getToolName());return this.editData={annotation:c,viewportIdsToRender:l,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(o),r.preventDefault(),Qt(l),c},this.isPointNearTool=(r,i,a,o)=>{const s=yt(r),{viewport:c}=s,{data:l}=i,{distanceToPoint:u,distanceToPoint2:f}=this.distanceToLines({viewport:c,points:l.handles.points,canvasCoords:a,proximity:o});return u<=o||f<=o},this.toolSelectedCallback=(r,i,a,o,s=6)=>{const c=r.detail,{element:l}=c;i.highlighted=!0;const u=ra(l,this.getToolName()),f=yt(l),{renderingEngine:d,viewport:h}=f,{isNearFirstLine:m,isNearSecondLine:p}=this.distanceToLines({viewport:h,points:i.data.handles.points,canvasCoords:o,proximity:s});this.editData={annotation:i,viewportIdsToRender:u,movingTextBox:!1,isNearFirstLine:m,isNearSecondLine:p},this._activateModify(l),ea(l),Qt(u),r.preventDefault()},this._endCallback=r=>{const i=r.detail,{element:a}=i,{annotation:o,viewportIdsToRender:s,newAnnotation:c,hasMoved:l}=this.editData,{data:u}=o;if(c&&!l)return;if(this.doneEditMemo(),this.angleStartedNotYetCompleted&&u.handles.points.length<4){rs(a),this.editData.handleIndex=u.handles.points.length;return}this.angleStartedNotYetCompleted=!1,u.handles.activeHandleIndex=null,this._deactivateModify(a),this._deactivateDraw(a),rs(a);const f=yt(a),{renderingEngine:d}=f;this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&rc(o.annotationUID),Qt(s),c&&Ml(o),this.editData=null,this.isDrawing=!1},this._mouseDownCallback=r=>{const{annotation:i,handleIndex:a}=this.editData,o=r.detail,{element:s,currentPoints:c}=o,l=c.world,{data:u}=i;if(a===1){u.handles.points[1]=l,this.editData.hasMoved=u.handles.points[1][0]!==u.handles.points[0][0]||u.handles.points[1][1]!==u.handles.points[0][0];return}if(a===3){u.handles.points[3]=l,this.editData.hasMoved=u.handles.points[3][0]!==u.handles.points[2][0]||u.handles.points[3][1]!==u.handles.points[2][0],this.angleStartedNotYetCompleted=!1;return}this.editData.hasMoved=!1,ea(s),u.handles.points[2]=u.handles.points[3]=l,this.editData.handleIndex=u.handles.points.length-1},this._dragCallback=r=>{this.isDrawing=!0;const i=r.detail,{element:a}=i,{annotation:o,viewportIdsToRender:s,handleIndex:c,movingTextBox:l,isNearFirstLine:u,isNearSecondLine:f,newAnnotation:d}=this.editData;this.createMemo(a,o,{newAnnotation:d});const{data:h}=o;if(l){const{deltaPoints:y}=i,x=y.world,{textBox:S}=h.handles,{worldPosition:C}=S;C[0]+=x[0],C[1]+=x[1],C[2]+=x[2],S.hasMoved=!0}else if(c===void 0&&(u||f)){const{deltaPoints:y}=i,x=y.world,S=h.handles.points;u?[S[0],S[1]].forEach(_=>{_[0]+=x[0],_[1]+=x[1],_[2]+=x[2]}):f&&[S[2],S[3]].forEach(_=>{_[0]+=x[0],_[1]+=x[1],_[2]+=x[2]}),o.invalidated=!0}else{const{currentPoints:y}=i,x=y.world;h.handles.points[c]=[...x],o.invalidated=!0}this.editData.hasMoved=!0;const m=yt(a),{renderingEngine:p}=m;Qt(s),o.invalidated&&ji(o,a,na.HandlesUpdated)},this.cancel=r=>{if(!this.isDrawing)return;this.isDrawing=!1,this._deactivateDraw(r),this._deactivateModify(r),rs(r);const{annotation:i,viewportIdsToRender:a,newAnnotation:o}=this.editData,{data:s}=i;s.handles.points.length<4&&rc(i.annotationUID),i.highlighted=!1,s.handles.activeHandleIndex=null;const c=yt(r),{renderingEngine:l}=c;return Qt(a),o&&Ml(i),this.editData=null,this.angleStartedNotYetCompleted=!1,i.annotationUID},this._activateModify=r=>{Tt.isInteractingWithTool=!0,r.addEventListener(ge.MOUSE_UP,this._endCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragCallback),r.addEventListener(ge.MOUSE_CLICK,this._endCallback),r.addEventListener(ge.TOUCH_END,this._endCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragCallback),r.addEventListener(ge.TOUCH_START,this._mouseDownCallback),r.addEventListener(ge.TOUCH_TAP,this._endCallback)},this._deactivateModify=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._endCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragCallback),r.removeEventListener(ge.MOUSE_CLICK,this._endCallback),r.removeEventListener(ge.TOUCH_END,this._endCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragCallback),r.removeEventListener(ge.TOUCH_START,this._mouseDownCallback),r.removeEventListener(ge.TOUCH_TAP,this._endCallback)},this._activateDraw=r=>{Tt.isInteractingWithTool=!0,r.addEventListener(ge.MOUSE_UP,this._endCallback),r.addEventListener(ge.MOUSE_DRAG,this._dragCallback),r.addEventListener(ge.MOUSE_MOVE,this._dragCallback),r.addEventListener(ge.MOUSE_CLICK,this._endCallback),r.addEventListener(ge.MOUSE_DOWN,this._mouseDownCallback),r.addEventListener(ge.TOUCH_END,this._endCallback),r.addEventListener(ge.TOUCH_DRAG,this._dragCallback),r.addEventListener(ge.TOUCH_START,this._mouseDownCallback),r.addEventListener(ge.TOUCH_TAP,this._endCallback)},this._deactivateDraw=r=>{Tt.isInteractingWithTool=!1,r.removeEventListener(ge.MOUSE_UP,this._endCallback),r.removeEventListener(ge.MOUSE_DRAG,this._dragCallback),r.removeEventListener(ge.MOUSE_MOVE,this._dragCallback),r.removeEventListener(ge.MOUSE_CLICK,this._endCallback),r.removeEventListener(ge.MOUSE_DOWN,this._mouseDownCallback),r.removeEventListener(ge.TOUCH_END,this._endCallback),r.removeEventListener(ge.TOUCH_DRAG,this._dragCallback),r.removeEventListener(ge.TOUCH_START,this._mouseDownCallback),r.removeEventListener(ge.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(r,i)=>{let a=!1;const{viewport:o}=r,{element:s}=o;let c=yf(this.getToolName(),s);if(!c?.length||(c=this.filterInteractableAnnotationsForElement(s,c),!c?.length))return a;const l=this.getTargetId(o),u=o.getRenderingEngine(),f={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:r.viewport.id};for(let d=0;d<c.length;d++){const h=c[d],{annotationUID:m,data:p}=h,{points:y,activeHandleIndex:x}=p.handles;f.annotationUID=m;const{color:S,lineWidth:C,lineDash:_}=this.getAnnotationStyle({annotation:h,styleSpecifier:f}),T=y.map(Me=>o.worldToCanvas(Me));!p.cachedStats[l]||p.cachedStats[l].angle==null?(p.cachedStats[l]={angle:null,arc1Angle:null,arc2Angle:null,points:{world:{arc1Start:null,arc1End:null,arc2Start:null,arc2End:null,arc1Angle:null,arc2Angle:null},canvas:{arc1Start:null,arc1End:null,arc2Start:null,arc2End:null,arc1Angle:null,arc2Angle:null}}},this._calculateCachedStats(h,u,r)):h.invalidated&&this._throttledCalculateCachedStats(h,u,r);let O;if(!xf(m)&&!this.editData&&x!==null&&(O=[T[x]]),!o.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),a;if(!Md(m))continue;const M=!!cp("showHandlesAlways",{});(O||M)&&bh(i,m,"0",T,{color:S,lineDash:_,lineWidth:C});const I=[T[0],T[1]],V=[T[2],T[3]];let k="line1";if(R0(i,m,k,I[0],I[1],{color:S,width:C,lineDash:_}),a=!0,T.length<4)return a;k="line2",R0(i,m,k,V[0],V[1],{color:S,width:C,lineDash:_}),k="linkLine";const L=v0(I[0],I[1]),$=v0(V[0],V[1]);R0(i,m,k,L,$,{color:S,lineWidth:"1",lineDash:"1,4"});const{arc1Start:W,arc1End:G,arc2End:oe,arc2Start:U}=p.cachedStats[l].points.canvas,{arc1Angle:Y,arc2Angle:J}=p.cachedStats[l];if(this.configuration.showArcLines&&(k="arc1",R0(i,m,k,W,G,{color:S,lineWidth:"1"}),k="arc2",R0(i,m,k,U,oe,{color:S,lineWidth:"1"})),!p.cachedStats[l]?.angle)continue;const ne=this.getLinkedTextBoxStyle(f,h);if(!ne.visibility){p.handles.textBox={hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}};continue}const F=this.configuration.getTextLines(p,l);if(!p.handles.textBox.hasMoved){const Me=M3(T);p.handles.textBox.worldPosition=o.canvasToWorld(Me)}const ae=o.worldToCanvas(p.handles.textBox.worldPosition),te=F2(i,m,"cobbAngleText",F,ae,T,{},ne),{x:ye,y:we,width:Oe,height:Te}=te;if(p.handles.textBox.worldBoundingBox={topLeft:o.canvasToWorld([ye,we]),topRight:o.canvasToWorld([ye+Oe,we]),bottomLeft:o.canvasToWorld([ye,we+Te]),bottomRight:o.canvasToWorld([ye+Oe,we+Te])},this.configuration.showArcLines){const Me="arcAngle1",be=[`${Y.toFixed(2)} °`],Ye=v0(W,G);h6(i,m,Me,be,Ye,{...ne,padding:3});const ft="arcAngle2",je=[`${J.toFixed(2)} °`],It=v0(U,oe);h6(i,m,ft,je,It,{...ne,padding:3})}}return a},this.distanceToLines=({viewport:r,points:i,canvasCoords:a,proximity:o})=>{const[s,c,l,u]=i,f=r.worldToCanvas(s),d=r.worldToCanvas(c),h=r.worldToCanvas(l),m=r.worldToCanvas(u),p={start:{x:f[0],y:f[1]},end:{x:d[0],y:d[1]}},y={start:{x:h[0],y:h[1]},end:{x:m[0],y:m[1]}},x=Ag([p.start.x,p.start.y],[p.end.x,p.end.y],[a[0],a[1]]),S=Ag([y.start.x,y.start.y],[y.end.x,y.end.y],[a[0],a[1]]);let C=!1,_=!1;return x<=o?C=!0:S<=o&&(_=!0),{distanceToPoint:x,distanceToPoint2:S,isNearFirstLine:C,isNearSecondLine:_}},this.getArcsStartEndPoints=({firstLine:r,secondLine:i,mid1:a,mid2:o})=>{const s=[a,o],c=ZC(r,s),l=ZC(i,s),u=c>90?1:0,f=l>90?0:1,d=v0(s[0],s[1]),h=Math.sqrt((s[1][0]-s[0][0])**2+(s[1][1]-s[0][1])**2),m=.1,p=v0(r[0],r[1]),y=v0(i[0],i[1]),x=[r[u][0]-p[0],r[u][1]-p[1]],S=Math.sqrt(x[0]**2+x[1]**2),C=[x[0]/S,x[1]/S],_=[p[0]+C[0]*h*m,p[1]+C[1]*h*m],T=[d[0]-a[0],d[1]-a[1]],O=Math.sqrt(T[0]**2+T[1]**2),M=[T[0]/O,T[1]/O],I=[a[0]+M[0]*h*m,a[1]+M[1]*h*m],V=[i[f][0]-y[0],i[f][1]-y[1]],k=Math.sqrt(V[0]**2+V[1]**2),L=[V[0]/k,V[1]/k],$=[y[0]+L[0]*h*m,y[1]+L[1]*h*m],W=[d[0]-o[0],d[1]-o[1]],G=Math.sqrt(W[0]**2+W[1]**2),oe=[W[0]/G,W[1]/G],U=[o[0]+oe[0]*h*m,o[1]+oe[1]*h*m];return{arc1Start:_,arc1End:I,arc2Start:$,arc2End:U,arc1Angle:c>90?180-c:c,arc2Angle:l>90?180-l:l}},this._throttledCalculateCachedStats=B2(this._calculateCachedStats,25,{trailing:!0})}handleSelectedCallback(e,n,r,i="mouse"){const a=e.detail,{element:o}=a,{data:s}=n;n.highlighted=!0;let c=!1,l;r.worldPosition?c=!0:l=s.handles.points.findIndex(f=>f===r);const u=ra(o,this.getToolName());this.editData={annotation:n,viewportIdsToRender:u,handleIndex:l,movingTextBox:c},this._activateModify(o),ea(o),Qt(u),e.preventDefault()}_calculateCachedStats(e,n,r){const i=e.data;if(i.handles.points.length!==4)return;const a=[null,null],o=[null,null];let s=Number.MAX_VALUE;for(let I=0;I<2;I+=1)for(let V=2;V<4;V+=1){const k=Gy(i.handles.points[I],i.handles.points[V]);k<s&&(s=k,a[1]=i.handles.points[I],a[0]=i.handles.points[(I+1)%2],o[0]=i.handles.points[V],o[1]=i.handles.points[2+(V-1)%2])}const{viewport:c}=r,{element:l}=c,u=i.handles.points.map(I=>c.worldToCanvas(I)),f=[u[0],u[1]],d=[u[2],u[3]],h=v0(f[0],f[1]),m=v0(d[0],d[1]),{arc1Start:p,arc1End:y,arc2End:x,arc2Start:S,arc1Angle:C,arc2Angle:_}=this.getArcsStartEndPoints({firstLine:f,secondLine:d,mid1:h,mid2:m}),{cachedStats:T}=i,O=Object.keys(T);for(let I=0;I<O.length;I++){const V=O[I];T[V]={angle:ZC(a,o),arc1Angle:C,arc2Angle:_,points:{canvas:{arc1Start:p,arc1End:y,arc2End:x,arc2Start:S},world:{arc1Start:c.canvasToWorld(p),arc1End:c.canvasToWorld(y),arc2End:c.canvasToWorld(x),arc2Start:c.canvasToWorld(S)}}}}const M=e.invalidated;return e.invalidated=!1,M&&ji(e,l,na.StatsUpdated),T}};RB.toolName="CobbAngle";let L0=RB;function Bjt(t,e){const n=t.cachedStats[e],{angle:r}=n;return r===void 0?void 0:[`${r.toFixed(2)} °`]}function zjt(t,e,n){if(t===void 0)throw new Error("decodeRGB: rgbBuffer must be defined");if(t.length%3!==0)throw new Error(`decodeRGB: rgbBuffer length ${t.length} must be divisible by 3`);const r=t.length/3;let i=0,a=0;if(n){for(let o=0;o<r;o++)e[a++]=t[i++],e[a++]=t[i++],e[a++]=t[i++],e[a++]=255;return}e.set(t)}function Gjt(t,e,n){if(t===void 0)throw new Error("decodeRGB: rgbBuffer must be defined");if(t.length%3!==0)throw new Error(`decodeRGB: rgbBuffer length ${t.length} must be divisible by 3`);const r=t.length/3;let i=0,a=0,o=r,s=r*2;if(n)for(let c=0;c<r;c++)e[i++]=t[a++],e[i++]=t[o++],e[i++]=t[s++],e[i++]=255;else for(let c=0;c<r;c++)e[i++]=t[a++],e[i++]=t[o++],e[i++]=t[s++]}function Wjt(t,e,n){if(t===void 0)throw new Error("convertYBRFullByPixel: ybrBuffer must be defined");if(t.length%3!==0)throw new Error(`convertYBRFullByPixel: ybrBuffer length ${t.length} must be divisible by 3`);const r=t.length/3;let i=0,a=0;if(n){for(let o=0;o<r;o++){const s=t[i++],c=t[i++],l=t[i++];e[a++]=s+1.402*(l-128),e[a++]=s-.34414*(c-128)-.71414*(l-128),e[a++]=s+1.772*(c-128),e[a++]=255}return}for(let o=0;o<r;o++){const s=t[i++],c=t[i++],l=t[i++];e[a++]=s+1.402*(l-128),e[a++]=s-.34414*(c-128)-.71414*(l-128),e[a++]=s+1.772*(c-128)}}function Hjt(t,e,n){if(t===void 0)throw new Error("convertYBRFullByPlane: ybrBuffer must be defined");if(t.length%3!==0)throw new Error(`convertYBRFullByPlane: ybrBuffer length ${t.length} must be divisible by 3`);const r=t.length/3;let i=0,a=0,o=r,s=r*2;if(n){for(let c=0;c<r;c++){const l=t[a++],u=t[o++],f=t[s++];e[i++]=l+1.402*(f-128),e[i++]=l-.34414*(u-128)-.71414*(f-128),e[i++]=l+1.772*(u-128),e[i++]=255}return}for(let c=0;c<r;c++){const l=t[a++],u=t[o++],f=t[s++];e[i++]=l+1.402*(f-128),e[i++]=l-.34414*(u-128)-.71414*(f-128),e[i++]=l+1.772*(u-128)}}function qjt(t,e,n){if(t===void 0)throw new Error("convertYBRFull422ByPixel: ybrBuffer must be defined");if(t.length%2!==0)throw new Error(`convertYBRFull422ByPixel: ybrBuffer length ${t.length} must be divisible by 2`);const r=t.length/2;let i=0,a=0;if(n){for(let o=0;o<r;o+=2){const s=t[i++],c=t[i++],l=t[i++],u=t[i++];e[a++]=s+1.402*(u-128),e[a++]=s-.34414*(l-128)-.71414*(u-128),e[a++]=s+1.772*(l-128),e[a++]=255,e[a++]=c+1.402*(u-128),e[a++]=c-.34414*(l-128)-.71414*(u-128),e[a++]=c+1.772*(l-128),e[a++]=255}return}for(let o=0;o<r;o+=2){const s=t[i++],c=t[i++],l=t[i++],u=t[i++];e[a++]=s+1.402*(u-128),e[a++]=s-.34414*(l-128)-.71414*(u-128),e[a++]=s+1.772*(l-128),e[a++]=c+1.402*(u-128),e[a++]=c-.34414*(l-128)-.71414*(u-128),e[a++]=c+1.772*(l-128)}}function dI(t,e){const n=t.length,r=new Uint8ClampedArray(n);for(let i=0;i<n;++i)r[i]=t[i]>>e;return r}function hI(t,e,n){const r=t[`${e}PaletteColorLookupTableData`];if(r)return Promise.resolve(r);const i=Ot("imagePixelModule",t.imageId);return i&&typeof i.then=="function"?i.then(a=>a?a[`${e}PaletteColorLookupTableData`]:n):Promise.resolve(i?i[`${e}PaletteColorLookupTableData`]:n)}function Kjt(t,e,n){const r=t.columns*t.rows,i=t.pixelData;Promise.all([hI(t,"red",null),hI(t,"green",null),hI(t,"blue",null)]).then(([a,o,s])=>{if(!a||!o||!s)throw new Error("The image does not have a complete color palette. R, G, and B palette data are required.");const c=a.length;let l=0,u=0;const f=t.redPaletteColorLookupTableDescriptor[1],d=t.redPaletteColorLookupTableDescriptor[2]===8?0:8,h=dI(a,d),m=dI(o,d),p=dI(s,d);if(n){for(let y=0;y<r;++y){let x=i[l++];x<f?x=0:x>f+c-1?x=c-1:x-=f,e[u++]=h[x],e[u++]=m[x],e[u++]=p[x],e[u++]=255}return}for(let y=0;y<r;++y){let x=i[l++];x<f?x=0:x>f+c-1?x=c-1:x-=f,e[u++]=h[x],e[u++]=m[x],e[u++]=p[x]}})}function gI(t,e){if(!(!t.elements[e]||t.elements[e].length!==6))return[t.uint16(e,0),t.uint16(e,1),t.uint16(e,2)]}function pI(t,e,n){const r=[],i=t.elements[e];for(let a=0;a<n[0];a++)n[2]===16?r[a]=t.uint16(e,a):r[a]=t.byteArray[a+i.dataOffset];return r}function Yjt(t,e){e.redPaletteColorLookupTableDescriptor=gI(t,"x00281101"),e.greenPaletteColorLookupTableDescriptor=gI(t,"x00281102"),e.bluePaletteColorLookupTableDescriptor=gI(t,"x00281103"),e.redPaletteColorLookupTableDescriptor[0]===0&&(e.redPaletteColorLookupTableDescriptor[0]=65536,e.greenPaletteColorLookupTableDescriptor[0]=65536,e.bluePaletteColorLookupTableDescriptor[0]=65536);const n=e.redPaletteColorLookupTableDescriptor[0],i=t.elements.x00281201.length===n?8:16;e.redPaletteColorLookupTableDescriptor[2]!==i&&(e.redPaletteColorLookupTableDescriptor[2]=i,e.greenPaletteColorLookupTableDescriptor[2]=i,e.bluePaletteColorLookupTableDescriptor[2]=i),e.redPaletteColorLookupTableData=pI(t,"x00281201",e.redPaletteColorLookupTableDescriptor),e.greenPaletteColorLookupTableData=pI(t,"x00281202",e.greenPaletteColorLookupTableDescriptor),e.bluePaletteColorLookupTableData=pI(t,"x00281203",e.bluePaletteColorLookupTableDescriptor)}function Xjt(t,e){t.uint16("x00280103")===0?(e.smallestPixelValue=t.uint16("x00280106"),e.largestPixelValue=t.uint16("x00280107")):(e.smallestPixelValue=t.int16("x00280106"),e.largestPixelValue=t.int16("x00280107"))}function Zjt(t){const e={samplesPerPixel:t.uint16("x00280002"),photometricInterpretation:t.string("x00280004"),rows:t.uint16("x00280010"),columns:t.uint16("x00280011"),bitsAllocated:t.uint16("x00280100"),bitsStored:t.uint16("x00280101"),highBit:t.uint16("x00280102"),pixelRepresentation:t.uint16("x00280103"),planarConfiguration:t.uint16("x00280006"),pixelAspectRatio:t.string("x00280034")};return Xjt(t,e),e.photometricInterpretation==="PALETTE COLOR"&&t.elements.x00281101&&Yjt(t,e),e}function Qjt(t,e){let n=e.uint16("x00283002",0);n===0&&(n=65535);let r=0;t===0?r=e.uint16("x00283002",1):r=e.int16("x00283002",1);const i=e.uint16("x00283002",2),a={id:"1",firstValueMapped:r,numBitsPerEntry:i,lut:[]};for(let o=0;o<n;o++)t===0?a.lut[o]=e.uint16("x00283006",o):a.lut[o]=e.int16("x00283006",o);return a}function Jne(t,e){if(!e||!e.items||!e.items.length)return;const n=[];for(let r=0;r<e.items.length;r++){const i=e.items[r].dataSet,a=Qjt(t,i);a&&n.push(a)}return n}function Jjt(t){const e=t.uint16("x00280103"),n=t.uint16("x00280101");return e===0?0:-1<<n-1}function eUt(t){const e=t.string("x00080016");if(e==="1.2.840.10008.5.1.4.1.1.2"||e==="1.2.840.10008.5.1.4.1.1.2.1")return 1;const n=t.floatString("x00281052"),r=t.floatString("x00281053");return n!==void 0&&r!==void 0?Jjt(t)*r+n<0?1:0:t.elements.x00283000&&t.elements.x00283000.length>0?0:t.uint16("x00280103")}function Id(t,e,n){const r=[],i=t.string(e);if(!i)return;const a=i.split("\\");if(!(n&&a.length<n)){for(let o=0;o<a.length;o++)r.push(parseFloat(a[o]));return r}}var e_={exports:{}};/*! dicom-parser - 1.8.12 - 2023-02-20 | (c) 2017 Chris Hafey | https://github.com/cornerstonejs/dicomParser */var tUt=e_.exports,ere;function nUt(){return ere||(ere=1,(function(t,e){(function(n,r){t.exports=r(Cd)})(tUt,function(n){return i=[function(o,s){o.exports=n},function(o,s,c){c.r(s),c.d(s,"isStringVr",function(){return u}),c.d(s,"isPrivateTag",function(){return f}),c.d(s,"parsePN",function(){return d}),c.d(s,"parseTM",function(){return h}),c.d(s,"parseDA",function(){return p}),c.d(s,"explicitElementToString",function(){return y}),c.d(s,"explicitDataSetToJS",function(){return x}),c.d(s,"createJPEGBasicOffsetTable",function(){return _}),c.d(s,"parseDicomDataSetExplicit",function(){return re}),c.d(s,"parseDicomDataSetImplicit",function(){return te}),c.d(s,"readFixedString",function(){return I}),c.d(s,"alloc",function(){return ye}),c.d(s,"version",function(){return we}),c.d(s,"bigEndianByteArrayParser",function(){return Oe}),c.d(s,"ByteStream",function(){return be}),c.d(s,"sharedCopy",function(){return Te}),c.d(s,"DataSet",function(){return L}),c.d(s,"findAndSetUNElementLength",function(){return M}),c.d(s,"findEndOfEncapsulatedElement",function(){return O}),c.d(s,"findItemDelimitationItemAndSetElementLength",function(){return $}),c.d(s,"littleEndianByteArrayParser",function(){return Ye}),c.d(s,"parseDicom",function(){return It}),c.d(s,"readDicomElementExplicit",function(){return ae}),c.d(s,"readDicomElementImplicit",function(){return G}),c.d(s,"readEncapsulatedImageFrame",function(){return tr}),c.d(s,"readEncapsulatedPixelData",function(){return ue}),c.d(s,"readEncapsulatedPixelDataFromFragments",function(){return cn}),c.d(s,"readPart10Header",function(){return ft}),c.d(s,"readSequenceItemsExplicit",function(){return ne}),c.d(s,"readSequenceItemsImplicit",function(){return Y}),c.d(s,"readSequenceItem",function(){return oe}),c.d(s,"readTag",function(){return T});var l={AE:!0,AS:!0,AT:!1,CS:!0,DA:!0,DS:!0,DT:!0,FL:!1,FD:!1,IS:!0,LO:!0,LT:!0,OB:!1,OD:!1,OF:!1,OW:!1,PN:!0,SH:!0,SL:!1,SQ:!1,SS:!1,ST:!0,TM:!0,UI:!0,UL:!1,UN:void 0,UR:!0,US:!1,UT:!0},u=function(B){return l[B]},f=function(B){if(B=parseInt(B[4],16),isNaN(B))throw"dicomParser.isPrivateTag: cannot parse last character of group";return B%2==1},d=function(B){if(B!==void 0)return B=B.split("^"),{familyName:B[0],givenName:B[1],middleName:B[2],prefix:B[3],suffix:B[4]}};function h(B,K){if(2<=B.length){var fe=parseInt(B.substring(0,2),10),ie=4<=B.length?parseInt(B.substring(2,4),10):void 0,pe=6<=B.length?parseInt(B.substring(4,6),10):void 0,Re=8<=B.length?B.substring(7,13):void 0,Re=Re?parseInt(Re,10)*Math.pow(10,6-Re.length):void 0;if(K&&(isNaN(fe)||ie!==void 0&&isNaN(ie)||pe!==void 0&&isNaN(pe)||Re!==void 0&&isNaN(Re)||fe<0||23<fe||ie&&(ie<0||59<ie)||pe&&(pe<0||59<pe)||Re&&(Re<0||999999<Re)))throw"invalid TM '".concat(B,"'");return{hours:fe,minutes:ie,seconds:pe,fractionalSeconds:Re}}if(K)throw"invalid TM '".concat(B,"'")}function m(B,K,fe){return!isNaN(fe)&&0<K&&K<=12&&0<B&&B<=(function(ie,pe){switch(ie){case 2:return pe%4==0&&pe%100||pe%400==0?29:28;case 9:case 4:case 6:case 11:return 30;default:return 31}})(K,fe)}function p(B,K){if(B&&B.length===8){var fe=parseInt(B.substring(0,4),10),ie=parseInt(B.substring(4,6),10),pe=parseInt(B.substring(6,8),10);if(K&&m(pe,ie,fe)!==!0)throw"invalid DA '".concat(B,"'");return{year:fe,month:ie,day:pe}}if(K)throw"invalid DA '".concat(B,"'")}function y(B,K){if(B===void 0||K===void 0)throw"dicomParser.explicitElementToString: missing required parameters";if(K.vr===void 0)throw"dicomParser.explicitElementToString: cannot convert implicit element to string";var fe,ie=K.vr,pe=K.tag;function Re(wt,Pt){for(var Ln="",Sn=0;Sn<wt;Sn++)Sn!==0&&(Ln+="/"),Ln+=Pt.call(B,pe,Sn).toString();return Ln}if(u(ie)===!0)fe=B.string(pe);else{if(ie==="AT"){var et=B.uint32(pe);return et===void 0?void 0:"x".concat((et=et<0?4294967295+et+1:et).toString(16).toUpperCase())}ie==="US"?fe=Re(K.length/2,B.uint16):ie==="SS"?fe=Re(K.length/2,B.int16):ie==="UL"?fe=Re(K.length/4,B.uint32):ie==="SL"?fe=Re(K.length/4,B.int32):ie==="FD"?fe=Re(K.length/8,B.double):ie==="FL"&&(fe=Re(K.length/4,B.float))}return fe}function x(B,K){if(B===void 0)throw"dicomParser.explicitDataSetToJS: missing required parameter dataSet";K=K||{omitPrivateAttibutes:!0,maxElementLength:128};var fe,ie={};for(fe in B.elements){var pe=B.elements[fe];if(K.omitPrivateAttibutes!==!0||!f(fe))if(pe.items){for(var Re=[],et=0;et<pe.items.length;et++)Re.push(x(pe.items[et].dataSet,K));ie[fe]=Re}else{var wt=void 0;pe.length<K.maxElementLength&&(wt=y(B,pe)),ie[fe]=wt!==void 0?wt:{dataOffset:pe.dataOffset,length:pe.length}}}return ie}function S(B,K){return B.byteArray[K]===255&&B.byteArray[K+1]===217}function C(B,K,fe){for(var ie,pe,Re=fe;Re<K.fragments.length;Re++)if(ie=B,pe=Re,pe=K.fragments[pe],!(!S(ie,pe.position+pe.length-2)&&!S(ie,pe.position+pe.length-3)))return Re}function _(B,K,fe){if(B===void 0)throw"dicomParser.createJPEGBasicOffsetTable: missing required parameter dataSet";if(K===void 0)throw"dicomParser.createJPEGBasicOffsetTable: missing required parameter pixelDataElement";if(K.tag!=="x7fe00010")throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010'";if(K.encapsulatedPixelData!==!0||K.hadUndefinedLength!==!0||K.basicOffsetTable===void 0||K.fragments===void 0||K.fragments.length<=0)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(fe&&fe.length<=0)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'fragments' must not be zero length";fe=fe||K.fragments;for(var ie=[],pe=0;;){ie.push(K.fragments[pe].offset);var Re=C(B,K,pe);if(Re===void 0||Re===K.fragments.length-1)return ie;pe=Re+1}}function T(fe){if(fe===void 0)throw"dicomParser.readTag: missing required parameter 'byteStream'";var K=256*fe.readUint16()*256,fe=fe.readUint16();return"x".concat("00000000".concat((K+fe).toString(16)).substr(-8))}function O(B,K,fe){if(B===void 0)throw"dicomParser.findEndOfEncapsulatedElement: missing required parameter 'byteStream'";if(K===void 0)throw"dicomParser.findEndOfEncapsulatedElement: missing required parameter 'element'";if(K.encapsulatedPixelData=!0,K.basicOffsetTable=[],K.fragments=[],T(B)!=="xfffee000")throw"dicomParser.findEndOfEncapsulatedElement: basic offset table not found";for(var ie=B.readUint32()/4,pe=0;pe<ie;pe++){var Re=B.readUint32();K.basicOffsetTable.push(Re)}for(var et=B.position;B.position<B.byteArray.length;){var wt=T(B),Pt=B.readUint32();if(wt==="xfffee0dd")return B.seek(Pt),void(K.length=B.position-K.dataOffset);if(wt!=="xfffee000")return fe&&fe.push("unexpected tag ".concat(wt," while searching for end of pixel data element with undefined length")),Pt>B.byteArray.length-B.position&&(Pt=B.byteArray.length-B.position),K.fragments.push({offset:B.position-et-8,position:B.position,length:Pt}),B.seek(Pt),void(K.length=B.position-K.dataOffset);K.fragments.push({offset:B.position-et-8,position:B.position,length:Pt}),B.seek(Pt)}fe&&fe.push("pixel data element ".concat(K.tag," missing sequence delimiter tag xfffee0dd"))}function M(B,K){if(B===void 0)throw"dicomParser.findAndSetUNElementLength: missing required parameter 'byteStream'";for(var fe=B.byteArray.length-8;B.position<=fe;)if(B.readUint16()===65534){var ie=B.readUint16();if(ie===57565)return B.readUint32()!==0&&B.warnings("encountered non zero length following item delimiter at position ".concat(B.position-4," while reading element of undefined length with tag ").concat(K.tag)),void(K.length=B.position-K.dataOffset)}K.length=B.byteArray.length-K.dataOffset,B.seek(B.byteArray.length-B.position)}function I(B,K,fe){if(fe<0)throw"dicomParser.readFixedString - length cannot be less than 0";if(K+fe>B.length)throw"dicomParser.readFixedString: attempt to read past end of buffer";for(var ie,pe="",Re=0;Re<fe;Re++){if((ie=B[K+Re])===0)return K+=fe,pe;pe+=String.fromCharCode(ie)}return pe}function V(B,K){for(var fe=0;fe<K.length;fe++){var ie=K[fe];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(B,ie.key,ie)}}function k(B,K){return B.parser!==void 0?B.parser:K}var L=(function(){function B(ie,pe,Re){(function(et,wt){if(!(et instanceof wt))throw new TypeError("Cannot call a class as a function")})(this,B),this.byteArrayParser=ie,this.byteArray=pe,this.elements=Re}var K,fe;return K=B,(fe=[{key:"uint16",value:function(ie,pe){if(ie=this.elements[ie],pe=pe!==void 0?pe:0,ie&&ie.length!==0)return k(ie,this.byteArrayParser).readUint16(this.byteArray,ie.dataOffset+2*pe)}},{key:"int16",value:function(ie,pe){if(ie=this.elements[ie],pe=pe!==void 0?pe:0,ie&&ie.length!==0)return k(ie,this.byteArrayParser).readInt16(this.byteArray,ie.dataOffset+2*pe)}},{key:"uint32",value:function(ie,pe){if(ie=this.elements[ie],pe=pe!==void 0?pe:0,ie&&ie.length!==0)return k(ie,this.byteArrayParser).readUint32(this.byteArray,ie.dataOffset+4*pe)}},{key:"int32",value:function(ie,pe){if(ie=this.elements[ie],pe=pe!==void 0?pe:0,ie&&ie.length!==0)return k(ie,this.byteArrayParser).readInt32(this.byteArray,ie.dataOffset+4*pe)}},{key:"float",value:function(ie,pe){if(ie=this.elements[ie],pe=pe!==void 0?pe:0,ie&&ie.length!==0)return k(ie,this.byteArrayParser).readFloat(this.byteArray,ie.dataOffset+4*pe)}},{key:"double",value:function(ie,pe){if(ie=this.elements[ie],pe=pe!==void 0?pe:0,ie&&ie.length!==0)return k(ie,this.byteArrayParser).readDouble(this.byteArray,ie.dataOffset+8*pe)}},{key:"numStringValues",value:function(ie){if(ie=this.elements[ie],ie&&0<ie.length)return ie=I(this.byteArray,ie.dataOffset,ie.length).match(/\\/g),ie===null?1:ie.length+1}},{key:"string",value:function(ie,pe){if(ie=this.elements[ie],ie&&ie.Value)return ie.Value;if(ie&&0<ie.length)return ie=I(this.byteArray,ie.dataOffset,ie.length),0<=pe?ie.split("\\")[pe].trim():ie.trim()}},{key:"text",value:function(ie,pe){if(ie=this.elements[ie],ie&&0<ie.length)return ie=I(this.byteArray,ie.dataOffset,ie.length),0<=pe?ie.split("\\")[pe].replace(/ +$/,""):ie.replace(/ +$/,"")}},{key:"floatString",value:function(ie,pe){var Re=this.elements[ie];if(Re&&0<Re.length&&(pe=this.string(ie,pe=pe!==void 0?pe:0),pe!==void 0))return parseFloat(pe)}},{key:"intString",value:function(ie,pe){var Re=this.elements[ie];if(Re&&0<Re.length&&(pe=this.string(ie,pe=pe!==void 0?pe:0),pe!==void 0))return parseInt(pe)}},{key:"attributeTag",value:function(ie){var pe=this.elements[ie];if(pe&&pe.length===4){var Re=k(pe,this.byteArrayParser).readUint16,ie=this.byteArray,pe=pe.dataOffset;return"x".concat("00000000".concat((256*Re(ie,pe)*256+Re(ie,pe+2)).toString(16)).substr(-8))}}}])&&V(K.prototype,fe),Object.defineProperty(K,"prototype",{writable:!1}),B})();function $(B,K){if(B===void 0)throw"dicomParser.readDicomElementImplicit: missing required parameter 'byteStream'";for(var fe=B.byteArray.length-8;B.position<=fe;)if(B.readUint16()===65534){var ie=B.readUint16();if(ie===57357)return B.readUint32()!==0&&B.warnings("encountered non zero length following item delimiter at position ".concat(B.position-4," while reading element of undefined length with tag ").concat(K.tag)),void(K.length=B.position-K.dataOffset)}K.length=B.byteArray.length-K.dataOffset,B.seek(B.byteArray.length-B.position)}var W=function(B,K){return B.vr!==void 0?B.vr==="SQ":K.position+4<=K.byteArray.length?(B=T(K),K.seek(-4),B==="xfffee000"||B==="xfffee0dd"):(K.warnings.push("eof encountered before finding sequence item tag or sequence delimiter tag in peeking to determine VR"),!1)};function G(B,K,fe){if(B===void 0)throw"dicomParser.readDicomElementImplicit: missing required parameter 'byteStream'";var ie=T(B),ie={tag:ie,vr:fe!==void 0?fe(ie):void 0,length:B.readUint32(),dataOffset:B.position};return ie.length===4294967295&&(ie.hadUndefinedLength=!0),ie.tag===K||(!W(ie,B)||f(ie.tag)&&!ie.hadUndefinedLength?ie.hadUndefinedLength?$(B,ie):B.seek(ie.length):(Y(B,ie,fe),f(ie.tag)&&(ie.items=void 0))),ie}function oe(B){if(B===void 0)throw"dicomParser.readSequenceItem: missing required parameter 'byteStream'";var K={tag:T(B),length:B.readUint32(),dataOffset:B.position};if(K.tag!=="xfffee000")throw"dicomParser.readSequenceItem: item tag (FFFE,E000) not found at offset ".concat(B.position);return K}function U(B,K){var fe=oe(B);return fe.length===4294967295?(fe.hadUndefinedLength=!0,fe.dataSet=(function(ie,pe){for(var Re={};ie.position<ie.byteArray.length;){var et=G(ie,void 0,pe);if((Re[et.tag]=et).tag==="xfffee00d")return new L(ie.byteArrayParser,ie.byteArray,Re)}return ie.warnings.push("eof encountered before finding sequence item delimiter in sequence item of undefined length"),new L(ie.byteArrayParser,ie.byteArray,Re)})(B,K),fe.length=B.position-fe.dataOffset):(fe.dataSet=new L(B.byteArrayParser,B.byteArray,{}),te(fe.dataSet,B,B.position+fe.length,{vrCallback:K})),fe}function Y(B,K,fe){if(B===void 0)throw"dicomParser.readSequenceItemsImplicit: missing required parameter 'byteStream'";if(K===void 0)throw"dicomParser.readSequenceItemsImplicit: missing required parameter 'element'";K.items=[],(K.length===4294967295?function(ie,pe,Re){for(;ie.position+4<=ie.byteArray.length;){var et=T(ie);if(ie.seek(-4),et==="xfffee0dd")return pe.length=ie.position-pe.dataOffset,ie.seek(8);et=U(ie,Re),pe.items.push(et)}ie.warnings.push("eof encountered before finding sequence delimiter in sequence of undefined length"),pe.length=ie.byteArray.length-pe.dataOffset}:function(ie,pe,Re){for(var et=pe.dataOffset+pe.length;ie.position<et;){var wt=U(ie,Re);pe.items.push(wt)}})(B,K,fe)}function J(B,K){var fe=oe(B);return fe.length===4294967295?(fe.hadUndefinedLength=!0,fe.dataSet=(function(ie,pe){for(var Re={};ie.position<ie.byteArray.length;){var et=ae(ie,pe);if((Re[et.tag]=et).tag==="xfffee00d")return new L(ie.byteArrayParser,ie.byteArray,Re)}return pe.push("eof encountered before finding item delimiter tag while reading sequence item of undefined length"),new L(ie.byteArrayParser,ie.byteArray,Re)})(B,K),fe.length=B.position-fe.dataOffset):(fe.dataSet=new L(B.byteArrayParser,B.byteArray,{}),re(fe.dataSet,B,B.position+fe.length)),fe}function ne(B,K,fe){if(B===void 0)throw"dicomParser.readSequenceItemsExplicit: missing required parameter 'byteStream'";if(K===void 0)throw"dicomParser.readSequenceItemsExplicit: missing required parameter 'element'";K.items=[],(K.length===4294967295?function(ie,pe,Re){for(;ie.position+4<=ie.byteArray.length;){var et=T(ie);if(ie.seek(-4),et==="xfffee0dd")return pe.length=ie.position-pe.dataOffset,ie.seek(8);et=J(ie,Re),pe.items.push(et)}Re.push("eof encountered before finding sequence delimitation tag while reading sequence of undefined length"),pe.length=ie.position-pe.dataOffset}:function(ie,pe,Re){for(var et=pe.dataOffset+pe.length;ie.position<et;){var wt=J(ie,Re);pe.items.push(wt)}})(B,K,fe)}var F=function(B){return B==="OB"||B==="OD"||B==="OL"||B==="OW"||B==="SQ"||B==="OF"||B==="UC"||B==="UR"||B==="UT"||B==="UN"?4:2};function ae(B,K,fe){if(B===void 0)throw"dicomParser.readDicomElementExplicit: missing required parameter 'byteStream'";var ie={tag:T(B),vr:B.readFixedString(2)};return F(ie.vr)===2?ie.length=B.readUint16():(B.seek(2),ie.length=B.readUint32()),ie.dataOffset=B.position,ie.length===4294967295&&(ie.hadUndefinedLength=!0),ie.tag===fe||(ie.vr==="SQ"?ne(B,ie,K):ie.length===4294967295?ie.tag==="x7fe00010"?O(B,ie,K):(ie.vr==="UN"?Y:$)(B,ie):B.seek(ie.length)),ie}function re(B,K,fe){var ie=3<arguments.length&&arguments[3]!==void 0?arguments[3]:{};if(fe=fe===void 0?K.byteArray.length:fe,K===void 0)throw"dicomParser.parseDicomDataSetExplicit: missing required parameter 'byteStream'";if(fe<K.position||fe>K.byteArray.length)throw"dicomParser.parseDicomDataSetExplicit: invalid value for parameter 'maxP osition'";for(var pe=B.elements;K.position<fe;){var Re=ae(K,B.warnings,ie.untilTag);if((pe[Re.tag]=Re).tag===ie.untilTag)return}if(K.position>fe)throw"dicomParser:parseDicomDataSetExplicit: buffer overrun"}function te(B,K,fe){var ie=3<arguments.length&&arguments[3]!==void 0?arguments[3]:{};if(fe=fe===void 0?B.byteArray.length:fe,K===void 0)throw"dicomParser.parseDicomDataSetImplicit: missing required parameter 'byteStream'";if(fe<K.position||fe>K.byteArray.length)throw"dicomParser.parseDicomDataSetImplicit: invalid value for parameter 'maxPosition'";for(var pe=B.elements;K.position<fe;){var Re=G(K,ie.untilTag,ie.vrCallback);if((pe[Re.tag]=Re).tag===ie.untilTag)return}}function ye(B,K){if(typeof Buffer<"u"&&B instanceof Buffer)return Buffer.alloc(K);if(B instanceof Uint8Array)return new Uint8Array(K);throw"dicomParser.alloc: unknown type for byteArray"}var we="1.8.12",Oe={readUint16:function(B,K){if(K<0)throw"bigEndianByteArrayParser.readUint16: position cannot be less than 0";if(K+2>B.length)throw"bigEndianByteArrayParser.readUint16: attempt to read past end of buffer";return(B[K]<<8)+B[K+1]},readInt16:function(B,K){if(K<0)throw"bigEndianByteArrayParser.readInt16: position cannot be less than 0";if(K+2>B.length)throw"bigEndianByteArrayParser.readInt16: attempt to read past end of buffer";return K=(B[K]<<8)+B[K+1],K=32768&K?K-65535-1:K},readUint32:function(B,K){if(K<0)throw"bigEndianByteArrayParser.readUint32: position cannot be less than 0";if(K+4>B.length)throw"bigEndianByteArrayParser.readUint32: attempt to read past end of buffer";return 256*(256*(256*B[K]+B[K+1])+B[K+2])+B[K+3]},readInt32:function(B,K){if(K<0)throw"bigEndianByteArrayParser.readInt32: position cannot be less than 0";if(K+4>B.length)throw"bigEndianByteArrayParser.readInt32: attempt to read past end of buffer";return(B[K]<<24)+(B[K+1]<<16)+(B[K+2]<<8)+B[K+3]},readFloat:function(B,K){if(K<0)throw"bigEndianByteArrayParser.readFloat: position cannot be less than 0";if(K+4>B.length)throw"bigEndianByteArrayParser.readFloat: attempt to read past end of buffer";var fe=new Uint8Array(4);return fe[3]=B[K],fe[2]=B[K+1],fe[1]=B[K+2],fe[0]=B[K+3],new Float32Array(fe.buffer)[0]},readDouble:function(B,K){if(K<0)throw"bigEndianByteArrayParser.readDouble: position cannot be less than 0";if(K+8>B.length)throw"bigEndianByteArrayParser.readDouble: attempt to read past end of buffer";var fe=new Uint8Array(8);return fe[7]=B[K],fe[6]=B[K+1],fe[5]=B[K+2],fe[4]=B[K+3],fe[3]=B[K+4],fe[2]=B[K+5],fe[1]=B[K+6],fe[0]=B[K+7],new Float64Array(fe.buffer)[0]}};function Te(B,K,fe){if(typeof Buffer<"u"&&B instanceof Buffer)return B.slice(K,K+fe);if(B instanceof Uint8Array)return new Uint8Array(B.buffer,B.byteOffset+K,fe);throw"dicomParser.from: unknown type for byteArray"}function Me(B,K){for(var fe=0;fe<K.length;fe++){var ie=K[fe];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(B,ie.key,ie)}}var be=(function(){function B(ie,pe,Re){if((function(et,wt){if(!(et instanceof wt))throw new TypeError("Cannot call a class as a function")})(this,B),ie===void 0)throw"dicomParser.ByteStream: missing required parameter 'byteArrayParser'";if(pe===void 0)throw"dicomParser.ByteStream: missing required parameter 'byteArray'";if(!(pe instanceof Uint8Array)&&(typeof Buffer>"u"||!(pe instanceof Buffer)))throw"dicomParser.ByteStream: parameter byteArray is not of type Uint8Array or Buffer";if(Re<0)throw"dicomParser.ByteStream: parameter 'position' cannot be less than 0";if(Re>=pe.length)throw"dicomParser.ByteStream: parameter 'position' cannot be greater than or equal to 'byteArray' length";this.byteArrayParser=ie,this.byteArray=pe,this.position=Re||0,this.warnings=[]}var K,fe;return K=B,(fe=[{key:"seek",value:function(ie){if(this.position+ie<0)throw"dicomParser.ByteStream.prototype.seek: cannot seek to position < 0";this.position+=ie}},{key:"readByteStream",value:function(ie){if(this.position+ie>this.byteArray.length)throw"dicomParser.ByteStream.prototype.readByteStream: readByteStream - buffer overread";var pe=Te(this.byteArray,this.position,ie);return this.position+=ie,new B(this.byteArrayParser,pe)}},{key:"getSize",value:function(){return this.byteArray.length}},{key:"readUint16",value:function(){var ie=this.byteArrayParser.readUint16(this.byteArray,this.position);return this.position+=2,ie}},{key:"readUint32",value:function(){var ie=this.byteArrayParser.readUint32(this.byteArray,this.position);return this.position+=4,ie}},{key:"readFixedString",value:function(ie){var pe=I(this.byteArray,this.position,ie);return this.position+=ie,pe}}])&&Me(K.prototype,fe),Object.defineProperty(K,"prototype",{writable:!1}),B})(),Ye={readUint16:function(B,K){if(K<0)throw"littleEndianByteArrayParser.readUint16: position cannot be less than 0";if(K+2>B.length)throw"littleEndianByteArrayParser.readUint16: attempt to read past end of buffer";return B[K]+256*B[K+1]},readInt16:function(B,K){if(K<0)throw"littleEndianByteArrayParser.readInt16: position cannot be less than 0";if(K+2>B.length)throw"littleEndianByteArrayParser.readInt16: attempt to read past end of buffer";return K=B[K]+(B[K+1]<<8),K=32768&K?K-65535-1:K},readUint32:function(B,K){if(K<0)throw"littleEndianByteArrayParser.readUint32: position cannot be less than 0";if(K+4>B.length)throw"littleEndianByteArrayParser.readUint32: attempt to read past end of buffer";return B[K]+256*B[K+1]+256*B[K+2]*256+256*B[K+3]*256*256},readInt32:function(B,K){if(K<0)throw"littleEndianByteArrayParser.readInt32: position cannot be less than 0";if(K+4>B.length)throw"littleEndianByteArrayParser.readInt32: attempt to read past end of buffer";return B[K]+(B[K+1]<<8)+(B[K+2]<<16)+(B[K+3]<<24)},readFloat:function(B,K){if(K<0)throw"littleEndianByteArrayParser.readFloat: position cannot be less than 0";if(K+4>B.length)throw"littleEndianByteArrayParser.readFloat: attempt to read past end of buffer";var fe=new Uint8Array(4);return fe[0]=B[K],fe[1]=B[K+1],fe[2]=B[K+2],fe[3]=B[K+3],new Float32Array(fe.buffer)[0]},readDouble:function(B,K){if(K<0)throw"littleEndianByteArrayParser.readDouble: position cannot be less than 0";if(K+8>B.length)throw"littleEndianByteArrayParser.readDouble: attempt to read past end of buffer";var fe=new Uint8Array(8);return fe[0]=B[K],fe[1]=B[K+1],fe[2]=B[K+2],fe[3]=B[K+3],fe[4]=B[K+4],fe[5]=B[K+5],fe[6]=B[K+6],fe[7]=B[K+7],new Float64Array(fe.buffer)[0]}};function ft(B){var K=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};if(B===void 0)throw"dicomParser.readPart10Header: missing required parameter 'byteArray'";var fe=K.TransferSyntaxUID,ie=new be(Ye,B);return(function(){var pe=(function(){if(ie.getSize()<=132&&fe)return!1;if(ie.seek(128),ie.readFixedString(4)==="DICM")return!0;if(!(K||{}).TransferSyntaxUID)throw"dicomParser.readPart10Header: DICM prefix not found at location 132 - this is not a valid DICOM P10 file.";return ie.seek(0),!1})(),Re=[],et={};if(!pe)return ie.position=0,{elements:{x00020010:{tag:"x00020010",vr:"UI",Value:fe}},warnings:Re};for(;ie.position<ie.byteArray.length;){var wt=ie.position,Pt=ae(ie,Re);if("x0002ffff"<Pt.tag){ie.position=wt;break}Pt.parser=Ye,et[Pt.tag]=Pt}return(pe=new L(ie.byteArrayParser,ie.byteArray,et)).warnings=ie.warnings,pe.position=ie.position,pe})()}var je="1.2.840.10008.1.2.2";function It(B){var K=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};if(B===void 0)throw new Error("dicomParser.parseDicom: missing required parameter 'byteArray'");var fe,ie=function(Re){if(Re.elements.x00020010===void 0)throw new Error("dicomParser.parseDicom: missing required meta header attribute 0002,0010");return Re=Re.elements.x00020010,Re&&Re.Value||I(B,Re.dataOffset,Re.length)};function pe(Pt){var wt=ie(Pt),et=wt!=="1.2.840.10008.1.2",wt=(function(Ln,Sn){var Sr=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";if(Ln!=="1.2.840.10008.1.2.1.99")return new be(Ln===je?Oe:Ye,B,Sn);if(K&&K.inflater)return Ln=K.inflater(B,Sn),new be(Ye,Ln,0);if(Sr==!0){var hn=c(0),kn=Te(B,Sn,B.length-Sn),hn=hn.inflateRawSync(kn),kn=ye(B,hn.length+Sn);return B.copy(kn,0,0,Sn),hn.copy(kn,Sn),new be(Ye,kn,0)}if(typeof pako>"u")throw"dicomParser.parseDicom: no inflater available to handle deflate transfer syntax";return hn=B.slice(Sn),kn=pako.inflateRaw(hn),(hn=ye(B,kn.length+Sn)).set(B.slice(0,Sn),0),hn.set(kn,Sn),new be(Ye,hn,0)})(wt,Pt.position),Pt=new L(wt.byteArrayParser,wt.byteArray,{});Pt.warnings=wt.warnings;try{(et?re:te)(Pt,wt,wt.byteArray.length,K)}catch(Ln){throw{exception:Ln,dataSet:Pt}}return Pt}return(function(Re,et){for(var wt in Re.elements)Re.elements.hasOwnProperty(wt)&&(et.elements[wt]=Re.elements[wt]);return Re.warnings!==void 0&&(et.warnings=Re.warnings.concat(et.warnings)),et})(fe=ft(B,K),pe(fe))}var Rt=function(B,K,fe){for(var ie=0,pe=K;pe<K+fe;pe++)ie+=B[pe].length;return ie};function cn(B,et,fe,ie,pe){if(pe=pe||et.fragments,B===void 0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'dataSet'";if(et===void 0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'pixelDataElement'";if(fe===void 0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'startFragmentIndex'";if((ie=ie||1)===void 0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'numFragments'";if(et.tag!=="x7fe00010")throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010";if(et.encapsulatedPixelData!==!0||et.hadUndefinedLength!==!0||et.basicOffsetTable===void 0||et.fragments===void 0||et.fragments.length<=0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(fe<0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragmentIndex' must be >= 0";if(fe>=et.fragments.length)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragmentIndex' must be < number of fragments";if(ie<1)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'numFragments' must be > 0";if(fe+ie>et.fragments.length)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragment' + 'numFragments' < number of fragments";var Re=new be(B.byteArrayParser,B.byteArray,et.dataOffset),et=oe(Re);if(et.tag!=="xfffee000")throw"dicomParser.readEncapsulatedPixelData: missing basic offset table xfffee000";Re.seek(et.length);var wt=Re.position;if(ie===1)return Te(Re.byteArray,wt+pe[fe].offset+8,pe[fe].length);for(var et=Rt(pe,fe,ie),Pt=ye(Re.byteArray,et),Ln=0,Sn=fe;Sn<fe+ie;Sn++)for(var Sr=wt+pe[Sn].offset+8,hn=0;hn<pe[Sn].length;hn++)Pt[Ln++]=Re.byteArray[Sr++];return Pt}var ln=function(B,K){for(var fe=0;fe<B.length;fe++)if(B[fe].offset===K)return fe},en=function(B,K,fe,ie){if(B===K.length-1)return fe.length-ie;for(var pe=K[B+1],Re=ie+1;Re<fe.length;Re++)if(fe[Re].offset===pe)return Re-ie;throw"dicomParser.calculateNumberOfFragmentsForFrame: could not find fragment with offset matching basic offset table"};function tr(B,K,fe,ie,pe){if(ie=ie||K.basicOffsetTable,pe=pe||K.fragments,B===void 0)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'dataSet'";if(K===void 0)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'pixelDataElement'";if(fe===void 0)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'frameIndex'";if(ie===void 0)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' does not have basicOffsetTable";if(K.tag!=="x7fe00010")throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010)";if(K.encapsulatedPixelData!==!0)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(K.hadUndefinedLength!==!0)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have undefined length";if(K.fragments===void 0)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have fragments";if(ie.length===0)throw"dicomParser.readEncapsulatedImageFrame: basicOffsetTable has zero entries";if(fe<0)throw"dicomParser.readEncapsulatedImageFrame: parameter 'frameIndex' must be >= 0";if(fe>=ie.length)throw"dicomParser.readEncapsulatedImageFrame: parameter 'frameIndex' must be < basicOffsetTable.length";var Re=ie[fe],Re=ln(pe,Re);if(Re===void 0)throw"dicomParser.readEncapsulatedImageFrame: unable to find fragment that matches basic offset table entry";return cn(B,K,Re,en(fe,ie,pe,Re),pe)}var Ke=!1;function ue(B,K,fe){if(Ke||(Ke=!0,console&&console.log&&console.log("WARNING: dicomParser.readEncapsulatedPixelData() has been deprecated")),B===void 0)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'dataSet'";if(K===void 0)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'element'";if(fe===void 0)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'frame'";if(K.tag!=="x7fe00010")throw"dicomParser.readEncapsulatedPixelData: parameter 'element' refers to non pixel data tag (expected tag = x7fe00010)";if(K.encapsulatedPixelData!==!0||K.hadUndefinedLength!==!0||K.basicOffsetTable===void 0||K.fragments===void 0)throw"dicomParser.readEncapsulatedPixelData: parameter 'element' refers to pixel data element that does not have encapsulated pixel data";if(fe<0)throw"dicomParser.readEncapsulatedPixelData: parameter 'frame' must be >= 0";return K.basicOffsetTable.length!==0?tr(B,K,fe):cn(B,K,0,K.fragments.length)}s.default={isStringVr:u,isPrivateTag:f,parsePN:d,parseTM:h,parseDA:p,explicitElementToString:y,explicitDataSetToJS:x,createJPEGBasicOffsetTable:_,parseDicomDataSetExplicit:re,parseDicomDataSetImplicit:te,readFixedString:I,alloc:ye,version:we,bigEndianByteArrayParser:Oe,ByteStream:be,sharedCopy:Te,DataSet:L,findAndSetUNElementLength:M,findEndOfEncapsulatedElement:O,findItemDelimitationItemAndSetElementLength:$,littleEndianByteArrayParser:Ye,parseDicom:It,readDicomElementExplicit:ae,readDicomElementImplicit:G,readEncapsulatedImageFrame:tr,readEncapsulatedPixelData:ue,readEncapsulatedPixelDataFromFragments:cn,readPart10Header:ft,readSequenceItemsExplicit:ne,readSequenceItemsImplicit:Y,readSequenceItem:oe,readTag:T,LEI:"1.2.840.10008.1.2",LEE:"1.2.840.10008.1.2.1"}}],a={},r.m=i,r.c=a,r.d=function(o,s,c){r.o(o,s)||Object.defineProperty(o,s,{enumerable:!0,get:c})},r.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},r.t=function(o,s){if(1&s&&(o=r(o)),8&s||4&s&&typeof o=="object"&&o&&o.__esModule)return o;var c=Object.create(null);if(r.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:o}),2&s&&typeof o!="string")for(var l in o)r.d(c,l,(function(u){return o[u]}).bind(null,l));return c},r.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return r.d(s,"a",s),s},r.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},r.p="",r(r.s=1);function r(o){if(a[o])return a[o].exports;var s=a[o]={i:o,l:!1,exports:{}};return i[o].call(s.exports,s,s.exports,r),s.l=!0,s.exports}var i,a})})(e_)),e_.exports}var ha=nUt();function M9(t){const e=t.indexOf(":");let n=t.substring(e+1);const r=n.indexOf("frame=");let i;if(r!==-1){const s=n.substring(r+6);i=parseInt(s,10),n=n.substring(0,r-1)}const a=t.substring(0,e),o=i!==void 0?i-1:void 0;return{scheme:a,url:n,frame:i,pixelDataFrame:o}}let Vk={open(t,e){t.open("get",e,!0)},beforeSend:async()=>{},beforeProcessing(t){return Promise.resolve(t.response)},imageCreated(){},strict:!1};function rUt(t){Vk=Object.assign(Vk,t)}function R9(){return Vk}function gB(t,e,n={},r={}){const i=R9(),a=c=>{if(typeof i.errorInterceptor=="function"){const l=new Error("request failed");l.request=c,l.response=c.response,l.status=c.status,i.errorInterceptor(l)}},o=new XMLHttpRequest,s=new Promise(async(c,l)=>{i.open(o,t,n,r);const u=await i.beforeSend(o,e,n,r);o.responseType="arraybuffer";const f=Object.assign({},n,u);Object.keys(f).forEach(function(d){f[d]!==null&&(d==="Accept"&&t.indexOf("accept=")!==-1||o.setRequestHeader(d,f[d]))}),r.deferred={resolve:c,reject:l},r.url=t,r.imageId=e,o.onloadstart=function(d){i.onloadstart&&i.onloadstart(d,r),dt(pt,"cornerstoneimageloadstart",{url:t,imageId:e})},o.onloadend=function(d){i.onloadend&&i.onloadend(d,r),dt(pt,"cornerstoneimageloadend",{url:t,imageId:e})},o.onreadystatechange=function(d){i.onreadystatechange&&i.onreadystatechange(d,r),o.readyState===4&&(o.status===200||o.status===206?i.beforeProcessing(o).then(c).catch(()=>{a(o),l(o)}):(a(o),l(o)))},o.onprogress=function(d){const h=d.loaded;let m,p;d.lengthComputable&&(m=d.total,p=Math.round(h/m*100)),dt(pt,"cornerstoneimageloadprogress",{url:t,imageId:e,loaded:h,total:m,percentComplete:p}),i.onprogress&&i.onprogress(d,r)},o.onerror=function(){a(o),l(o)},o.onabort=function(){a(o),l(o)},o.send()});return s.xhr=o,s}function iUt(t,e,n){if(n+t.length>e.length)return!1;let r=n;for(let i=0;i<t.length;i++)if(t[i]!==e[r++])return!1;return!0}function aUt(t){const e=new Uint8Array(t.length);for(let n=0,r=t.length;n<r;n++)e[n]=t.charCodeAt(n);return e}function tre(t,e,n){n=n||0;const r=aUt(e);for(let i=n;i<t.length;i++)if(r[0]===t[i]&&iUt(r,t,i))return i;return-1}const{ImageQualityStatus:nre}=Ad;function pB(t,e,n){n||={};const r=new Uint8Array(e),i=!!n?.isPartial;if(t.indexOf("multipart")===-1)return{contentType:t,imageQualityStatus:i?nre.SUBRESOLUTION:nre.FULL_RESOLUTION,pixelData:r};let{tokenIndex:a,responseHeaders:o,boundary:s,multipartContentType:c}=n;if(a||=tre(r,`\r
\r
`),a===-1)throw new Error("invalid response - no multipart mime header");if(!s&&(o=cUt(r,0,a).split(`\r
`),s=oUt(o),!s))throw new Error("invalid response - no boundary marker");const l=a+4,u=tre(r,s,l);if(u===-1&&!i)throw new Error("invalid response - terminating boundary not found");return c||=sUt(o),n.tokenIndex=a,n.boundary=s,n.responseHeaders=o,n.multipartContentType=c,n.isPartial=u===-1,{contentType:c,extractDone:!i||u!==-1,tokenIndex:a,responseHeaders:o,boundary:s,multipartContentType:c,pixelData:e.slice(l,u-2)}}function oUt(t){for(let e=0;e<t.length;e++)if(t[e].substr(0,2)==="--")return t[e]}function sUt(t){for(let e=0;e<t.length;e++)if(t[e].substr(0,13)==="Content-Type:")return t[e].substr(13).trim()}function cUt(t,e,n){e=e||0,n=n||t.length-e;let r="";for(let i=e;i<e+n;i++)r+=String.fromCharCode(t[i]);return r}const{ImageQualityStatus:rre}=Ad;function mB(t,e=!0){return e?t.imageQualityStatus??rre.FULL_RESOLUTION:rre.SUBRESOLUTION}const{ProgressiveIterator:lUt}=Bc;function uUt(t,e,n={},r={}){const i=R9(),{retrieveOptions:a={},streamingData:o={}}=r,s=a.minChunkSize||128*1024,c=u=>{if(typeof i.errorInterceptor=="function"){const f=new Error("request failed");i.errorInterceptor(f)}},l=new lUt("streamRequest");return l.generate(async(u,f)=>{const d=await i.beforeSend?.(null,t,n,{}),h=Object.assign({},n,d);Object.keys(h).forEach(function(m){h[m]===null&&(h[m]=void 0),m==="Accept"&&t.indexOf("accept=")!==-1&&(h[m]=void 0)});try{const m=await fetch(t,{headers:h,signal:void 0});if(m.status!==200)throw new Error(`Couldn't retrieve ${t} got status ${m.status}`);const p=m.body.getReader(),y=m.headers,x=y.get("content-type"),S=Number(y.get("Content-Length"));let C=!1,_=o.encodedData,T=o.lastSize||0;for(o.isPartial=!0;!C;){const{done:O,value:M}=await p.read();if(_=fUt(_,M),!_){if(C)throw new Error(`Done but no image frame available ${e}`);continue}if(C=O||_.byteLength===S,!C&&_.length<T+s)continue;T=_.length,o.isPartial=!O;const I=pB(x,_,o),V=mB(a,C),k={url:t,imageId:e,...I,percentComplete:O?100:I.pixelData?.length*100/S,imageQualityStatus:V,done:C};u.add(k,C)}}catch(m){c(),console.error(m),f(m)}}),l.getNextPromise()}function fUt(t,e){if(!t)return e;if(!e)return t;const n=new Uint8Array(t.length+e.length);return n.set(t,0),n.set(e,t.length),n}function dUt(t){const e=t.elements.x7fe00010.fragments,n=t.byteArray.length;for(const r of e){const{position:i,length:a}=r;a>n-i&&(console.log(`Truncated fragment, changing fragment length from ${r.length} to ${n-i}`),r.length=n-i)}return t}function hUt(t){let e=ha.parseDicom(t,{untilTag:"x7fe00010"});e.elements.x7fe00010||console.warn("Pixel data not found!");let n;try{n=ha.parseDicom(t)}catch(r){console.error(r),console.log("pixel data dataset:",r.dataSet),n=r.dataSet}return e.elements.x7fe00010=n.elements.x7fe00010,e=dUt(e),e}async function qSe(t,e,n){const r=hUt(t),{uri:i,imageId:a,fileTotalLength:o}=n;return r.fetchMore=async function(s){const c=Object.assign({uri:i,imageId:a,fetchedLength:t.length,lengthToFetch:o-t.length},s),{fetchedLength:l,lengthToFetch:u}=c,{arrayBuffer:f}=await e(i,a,{byteRange:`${l}-${l+u}`}),d=new Uint8Array(f),h=new Uint8Array(r.byteArray.length+d.length);return h.set(r.byteArray),h.set(d,r.byteArray.length),qSe(h,e,n)},r}function gUt(t,e){if(!t)return;const{NumberOfFrames:n,PerFrameFunctionalGroupsSequence:r,SharedFunctionalGroupsSequence:i}=YSe(t);if(r||n>1){const{shared:a,perFrame:o}=KSe(r,i,e);return{NumberOfFrames:n,PerFrameFunctionalInformation:o,SharedFunctionalInformation:a}}return{NumberOfFrames:n}}function KSe(t,e,n){const r={};(e?Object.values(e.items[0].dataSet.elements):[]).map(a=>r[a.tag]=a);const i={};return(t?Object.values(t.items[n-1].dataSet.elements):[]).map(a=>i[a.tag]=a),{shared:r,perFrame:i}}function YSe(t){if(!t)return;const{elements:e,...n}=t,{x52009230:r,x52009229:i,...a}=e;return{NumberOfFrames:t.intString("x00280008"),PerFrameFunctionalGroupsSequence:r,SharedFunctionalGroupsSequence:i,otherElements:a,otherAttributtes:n}}function pUt(t,e){if(!e)return;const{NumberOfFrames:n,PerFrameFunctionalGroupsSequence:r,SharedFunctionalGroupsSequence:i,otherElements:a}=YSe(e);if(r||n>1){const{shared:o,perFrame:s}=KSe(r,i,t),c={elements:{...a,...o,...s}},l=Object.create(e);return Object.assign(l,c)}return e}let fo={};const mUt=()=>{fo={}};function vB(t){if(fo[t])return fo[t]}function vUt(t){const e=vB(t);return XSe(e)}function XSe(t){if(!t)return!1;const e=t.intString("x00280008");return e&&e>1}function yUt(t){return t.indexOf("&frame=")}function xUt(t){const e=yUt(t),n=e===-1?t:t.slice(0,e),r=parseInt(t.slice(e+7),10)||1;let i;return fo[n]?i=fo[n].dataSet:i=void 0,{dataSet:i,frame:r}}function wUt(t){const e=[],n=vB(t);if(XSe(n)){const r=n.intString("x00280008");for(let i=1;i<=r;i++)e.push(`${t}&frame=${i}`)}else e.push(t);return e}const ZSe={_get:vB,generateMultiframeWADOURIs:wUt,retrieveMultiframeDataset:xUt,isMultiframeDataset:vUt};let Zy=0,sm={};function bUt(t){return fo[t]!==void 0}function SUt(t){let e;if(t.includes("&frame=")){const{frame:n,dataSet:r}=ZSe.retrieveMultiframeDataset(t);e=pUt(n,r)}else fo[t]&&(e=fo[t].dataSet);return e}function CUt(t,e){const n=fo[t];if(!n){console.error(`No loaded dataSet for uri ${t}`);return}Zy-=n.dataSet.byteArray.length,n.dataSet=e,Zy+=e.byteArray.length,dt(pt,"datasetscachechanged",{uri:t,action:"updated",cacheInfo:I9()})}function _Ut(t,e=gB,n){if(fo[t])return new Promise(a=>{fo[t].cacheCount++,a(fo[t].dataSet)});if(sm[t])return sm[t].cacheCount++,sm[t];const r=e(t,n),i=new Promise((a,o)=>{r.then(async function(s){const c={isPartialContent:!1,fileTotalLength:null};if(!(s instanceof ArrayBuffer)){if(!s.arrayBuffer)return o(new Error("If not returning ArrayBuffer, must return object with `arrayBuffer` parameter"));c.isPartialContent=s.flags.isPartialContent,c.fileTotalLength=s.flags.fileTotalLength,s=s.arrayBuffer}const l=new Uint8Array(s);let u;try{c.isPartialContent?u=await qSe(l,e,{uri:t,imageId:n,fileTotalLength:c.fileTotalLength}):u=ha.parseDicom(l)}catch(f){return o(f)}fo[t]={dataSet:u,cacheCount:i.cacheCount},Zy+=u.byteArray.length,a(u),dt(pt,"datasetscachechanged",{uri:t,action:"loaded",cacheInfo:I9()})},o).then(()=>{delete sm[t]},()=>{delete sm[t]})});return i.cacheCount=1,sm[t]=i,i}function TUt(t){fo[t]&&(fo[t].cacheCount--,fo[t].cacheCount===0&&(Zy-=fo[t].dataSet.byteArray.length,delete fo[t],dt(pt,"datasetscachechanged",{uri:t,action:"unloaded",cacheInfo:I9()})))}function I9(){return{cacheSizeInBytes:Zy,numberOfDataSetsCached:Object.keys(fo).length}}function EUt(){mUt(),sm={},Zy=0}const nw={isLoaded:bUt,load:_Ut,unload:TUt,getInfo:I9,purge:EUt,get:SUt,update:CUt};function OUt(t){const e=[];for(let n=0;n<=30;n+=2){let r=`x60${n.toString(16)}`;r.length===4&&(r=`x600${n.toString(16)}`);const i=t.elements[`${r}3000`];if(!i)continue;const a=[];for(let o=0;o<i.length;o++)for(let s=0;s<8;s++){const c=t.byteArray[i.dataOffset+o];a[o*8+s]=c>>s&1}e.push({rows:t.uint16(`${r}0010`),columns:t.uint16(`${r}0011`),type:t.string(`${r}0040`),x:t.int16(`${r}0050`,1)-1,y:t.int16(`${r}0050`,0)-1,pixelData:a,description:t.string(`${r}0022`),label:t.string(`${r}1500`),roiArea:t.string(`${r}1301`),roiMean:t.string(`${r}1302`),roiStandardDeviation:t.string(`${r}1303`)})}return{overlays:e}}function G2(t){return t==="RECON TOMO"||t==="RECON GATED TOMO"}function yB(t,e){const n=t.string("x00080008");if(n){const r=n.split("\\");if(r.length>e)return r[e]}}function DUt(t){let e;if(t.string("x00080060")?.includes("NM")){const r=yB(t,2);r&&G2(r)&&t.elements.x00540022&&(e=Id(t.elements.x00540022.items[0].dataSet,"x00200037",6))}return e}function MUt(t){let e;if(t.string("x00080060")?.includes("NM")){const r=yB(t,2);r&&G2(r)&&t.elements.x00540022&&(e=Id(t.elements.x00540022.items[0].dataSet,"x00200032",3))}return e}function ire(t){let e=Id(t,"x00200037",6);return!e&&t.elements.x00209116&&(e=Id(t.elements.x00209116.items[0].dataSet,"x00200037",6)),e||(e=DUt(t)),e}function are(t){let e=Id(t,"x00200032",3);return!e&&t.elements.x00209113&&(e=Id(t.elements.x00209113.items[0].dataSet,"x00200032",3)),e||(e=MUt(t)),e}function ore(t){let e=Id(t,"x00280030",2);return!e&&t.elements.x00289110&&(e=Id(t.elements.x00289110.items[0].dataSet,"x00280030",2)),e}function sre(t){let e;return t.elements.x00180050?e=t.floatString("x00180050"):t.elements.x00289110&&t.elements.x00289110.items.length&&t.elements.x00289110.items[0].dataSet.elements.x00180050&&(e=t.elements.x00289110.items[0].dataSet.floatString("x00180050")),e}function QSe(t,e,n){const r={};for(const i of n)try{const a=e(i,t);if(a){const o={};for(const s in a)if(s in a){const c=RUt(s);o[c]=a[s]}Object.assign(r,o)}}catch(a){console.error(`Error retrieving ${i} data:`,a)}return r}const RUt=t=>t.charAt(0).toUpperCase()+t.slice(1),JSe=["multiframeModule","generalSeriesModule","patientStudyModule","imagePlaneModule","nmMultiframeGeometryModule","imagePixelModule","modalityLutModule","voiLutModule","sopCommonModule","petIsotopeModule","overlayPlaneModule","transferSyntax","petSeriesModule","petImageModule"];function cre(t){const e=t.elements.x00186011;return!e||!e.items?[]:e.items.map(r=>{const i=r.dataSet.double("x0018602c"),a=r.dataSet.double("x0018602e"),o=r.dataSet.uint16("x00186024"),s=r.dataSet.uint16("x00186026"),c=r.dataSet.uint16("x0018601a"),l=r.dataSet.uint16("x0018601e"),u=r.dataSet.uint16("x00186018"),f=r.dataSet.uint16("x0018601c"),d=r.dataSet.int32("x00186020")||null,h=r.dataSet.int32("x00186022")||null,m=r.dataSet.uint16("x0018602a"),p=r.dataSet.uint16("x00186028"),y=r.dataSet.uint16("x00186012"),x=r.dataSet.uint16("x00186014"),S=r.dataSet.uint16("x00186016"),C=r.dataSet.uint16("x00186030");return{regionLocationMinY0:c,regionLocationMaxY1:l,regionLocationMinX0:u,regionLocationMaxX1:f,referencePixelX0:d,referencePixelY0:h,physicalDeltaX:i,physicalDeltaY:a,physicalUnitsXDirection:o,physicalUnitsYDirection:s,referencePhysicalPixelValueY:m,referencePhysicalPixelValueX:p,regionSpatialFormat:y,regionDataType:x,regionFlags:S,transducerFrequency:C}})}function eCe(t,e){const{MetadataModules:n}=Ad;if(Array.isArray(e))return;const r=M9(e);if(t===n.MULTIFRAME){const o=ZSe.retrieveMultiframeDataset(r.url);return o.dataSet?gUt(o.dataSet,o.frame):void 0}let i=r.url;r.frame&&(i=`${i}&frame=${r.frame}`);const a=nw.get(i);if(a)return IUt(t,e,a)}function IUt(t,e,n){const{MetadataModules:r}=Ad;if(t===r.GENERAL_STUDY)return{studyDescription:n.string("x00081030"),studyDate:ha.parseDA(n.string("x00080020")),studyTime:ha.parseTM(n.string("x00080030")||""),accessionNumber:n.string("x00080050")};if(t===r.GENERAL_SERIES)return{modality:n.string("x00080060"),seriesInstanceUID:n.string("x0020000e"),seriesDescription:n.string("x0008103e"),seriesNumber:n.intString("x00200011"),studyInstanceUID:n.string("x0020000d"),seriesDate:ha.parseDA(n.string("x00080021")),seriesTime:ha.parseTM(n.string("x00080031")||""),acquisitionDate:ha.parseDA(n.string("x00080022")),acquisitionTime:ha.parseTM(n.string("x00080032")||"")};if(t===r.GENERAL_IMAGE)return{sopInstanceUID:n.string("x00080018"),instanceNumber:n.intString("x00200013"),lossyImageCompression:n.string("x00282110"),lossyImageCompressionRatio:n.floatString("x00282112"),lossyImageCompressionMethod:n.string("x00282114")};if(t===r.PATIENT)return{patientID:n.string("x00100020"),patientName:n.string("x00100010")};if(t===r.PATIENT_STUDY)return{patientAge:n.intString("x00101010"),patientSize:n.floatString("x00101020"),patientSex:n.string("x00100040"),patientWeight:n.floatString("x00101030")};if(t===r.NM_MULTIFRAME_GEOMETRY){const i=n.string("x00080060"),a=yB(n,2);return{modality:i,imageType:n.string("x00080008"),imageSubType:a,imageOrientationPatient:ire(n),imagePositionPatient:are(n),sliceThickness:sre(n),pixelSpacing:ore(n),numberOfFrames:n.uint16("x00280008"),isNMReconstructable:G2(a)&&i.includes("NM")}}if(t===r.IMAGE_PLANE){const i=ire(n),a=are(n),o=ore(n),s=sre(n);let c=null,l=null;o&&(l=o[0],c=o[1]);let u=null,f=null;return i&&(u=[parseFloat(i[0]),parseFloat(i[1]),parseFloat(i[2])],f=[parseFloat(i[3]),parseFloat(i[4]),parseFloat(i[5])]),{frameOfReferenceUID:n.string("x00200052"),rows:n.uint16("x00280010"),columns:n.uint16("x00280011"),imageOrientationPatient:i,rowCosines:u,columnCosines:f,imagePositionPatient:a,sliceThickness:s,sliceLocation:n.floatString("x00201041"),pixelSpacing:o,rowPixelSpacing:l,columnPixelSpacing:c}}if(t===r.CINE)return{frameTime:n.floatString("x00181063")};if(t===r.IMAGE_PIXEL)return Zjt(n);if(t===r.VOI_LUT){const i=eUt(n);return{windowCenter:Id(n,"x00281050",1),windowWidth:Id(n,"x00281051",1),voiLUTSequence:Jne(i,n.elements.x00283010),voiLUTFunction:n.string("x00281056")}}if(t===r.MODALITY_LUT)return{rescaleIntercept:n.floatString("x00281052"),rescaleSlope:n.floatString("x00281053"),rescaleType:n.string("x00281054"),modalityLUTSequence:Jne(n.uint16("x00280103"),n.elements.x00283000)};if(t===r.SOP_COMMON)return{sopClassUID:n.string("x00080016"),sopInstanceUID:n.string("x00080018")};if(t===r.PET_ISOTOPE){const i=n.elements.x00540016;if(i===void 0)return;const a=i.items[0].dataSet;return{radiopharmaceuticalInfo:{radiopharmaceuticalStartTime:ha.parseTM(a.string("x00181072")||""),radionuclideTotalDose:a.floatString("x00181074"),radionuclideHalfLife:a.floatString("x00181075")}}}if(t===r.OVERLAY_PLANE)return OUt(n);if(t==="transferSyntax"){let i;try{i=n.string("x00020010")}catch{}return{transferSyntaxUID:i}}if(t===r.PET_SERIES)return{correctedImage:n.string("x00280051"),units:n.string("x00541001"),decayCorrection:n.string("x00541102")};if(t===r.PET_IMAGE)return{frameReferenceTime:n.floatString(n.string("x00541300")||""),actualFrameDuration:n.intString(n.string("x00181242"))};if(t===r.ULTRASOUND_ENHANCED_REGION)return cre(n);if(t===r.CALIBRATION&&n.string("x00080060")==="US")return{sequenceOfUltrasoundRegions:cre(n)};if(t==="instance")return QSe(e,eCe,JSe)}let N9=[];function NUt(t){return`dicomfile:${N9.push(t)-1}`}function PUt(t){return N9[t]}function kUt(t){N9[t]=void 0}function AUt(){N9=[]}const LUt={add:NUt,get:PUt,remove:kUt,purge:AUt};function VUt(t){const e=t.intString("x00280008"),n=t.elements.x7fe00010;return e!==n.fragments.length}function $Ut(t,e){if(t.elements.x7fe00010&&t.elements.x7fe00010.basicOffsetTable.length)return ha.readEncapsulatedImageFrame(t,t.elements.x7fe00010,e);if(VUt(t)){const l=ha.createJPEGBasicOffsetTable(t,t.elements.x7fe00010);return ha.readEncapsulatedImageFrame(t,t.elements.x7fe00010,e,l)}const n=t.elements.x7fe00010.fragments,r=new ha.ByteStream(t.byteArrayParser,t.byteArray,t.elements.x7fe00010.dataOffset),i=ha.readSequenceItem(r);if(i.tag!=="xfffee000")throw"dicomParser.readEncapsulatedPixelData: missing basic offset table xfffee000";r.seek(i.length);const a=r.position;if(e+1>n.length)throw"dicomParser.readEncapsulatedPixelData: frame exceeds number of fragments";const s=a+n[e].offset+8,c=n[e].length;return new Uint8Array(r.byteArray.buffer.slice(r.byteArray.byteOffset+s,r.byteArray.byteOffset+s+c))}function jUt(t,e){return t&1<<e}function UUt(t,e,n){const r=new Uint8Array(n);for(let i=0;i<n;i++){const a=Math.floor(i/8),o=t[a+e],s=i%8;r[i]=jUt(o,s)?1:0}return r}function FUt(t,e){const n=t.elements.x7fe00010||t.elements.x7fe00008,r=t.uint16("x00280100"),i=t.uint16("x00280010"),a=t.uint16("x00280011");let o=t.uint16("x00280002");t.string("x00280004")==="YBR_FULL_422"&&(o=2,console.warn(`Using SamplesPerPixel of 2 for YBR_FULL_422 photometric interpretation.
      See http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.6.3.html for more information.`));const c=n.dataOffset,l=i*a*o;let u;if(r===8){if(u=c+e*l,u>=t.byteArray.length)throw new Error("frame exceeds size of pixelData");return new Uint8Array(t.byteArray.buffer.slice(u,u+l))}else if(r===16){if(u=c+e*l*2,u>=t.byteArray.length)throw new Error("frame exceeds size of pixelData");return new Uint8Array(t.byteArray.buffer.slice(u,u+l*2))}else if(r===1){if(u=c+e*l*.125,u>=t.byteArray.length)throw new Error("frame exceeds size of pixelData");return UUt(t.byteArray,u,l)}else if(r===32){if(u=c+e*l*4,u>=t.byteArray.length)throw new Error("frame exceeds size of pixelData");return new Uint8Array(t.byteArray.buffer.slice(u,u+l*4))}throw new Error("unsupported pixel format")}function BUt(t){const e=M9(t),n=parseInt(e.url,10),r=LUt.get(n);return new Promise((i,a)=>{const o=new FileReader;o.onload=s=>{const c=s.target.result;i(c)},o.onerror=a,o.readAsArrayBuffer(r)})}function tCe(t,e=0){const n=t.elements.x7fe00010||t.elements.x7fe00008;return n?n.encapsulatedPixelData?$Ut(t,e):FUt(t,e):null}function xB(t){let e=t[0],n=t[0],r;const i=t.length;for(let a=1;a<i;a++)r=t[a],e=Math.min(e,r),n=Math.max(n,r);return{min:e,max:n}}function mI(t,e,n){t.planarConfiguration===0?zjt(t.pixelData,e,n):Gjt(t.pixelData,e,n)}function zUt(t,e,n){t.planarConfiguration===0?Wjt(t.pixelData,e,n):Hjt(t.pixelData,e,n)}function GUt(t,e,n){if(t.photometricInterpretation==="RGB")mI(t,e,n);else if(t.photometricInterpretation==="YBR_RCT")mI(t,e,n);else if(t.photometricInterpretation==="YBR_ICT")mI(t,e,n);else if(t.photometricInterpretation==="PALETTE COLOR")Kjt(t,e,n);else if(t.photometricInterpretation==="YBR_FULL_422")qjt(t.pixelData,e,n);else if(t.photometricInterpretation==="YBR_FULL")zUt(t,e,n);else throw new Error(`No color space conversion for photometric interpretation ${t.photometricInterpretation}`)}function WUt(t){if(t===void 0)return!1;const{rows:e,columns:n,photometricInterpretation:r,pixelDataLength:i,planarConfiguration:a}=t;return i===4*n*e?!1:r==="PALETTE COLOR"?!0:r.endsWith("420")?i===(3*Math.ceil(n/2)+Math.floor(n/2))*e:r.endsWith("422")?i===(3*Math.ceil(n/2)+Math.floor(n/2))*Math.ceil(e/2)+Math.floor(e/2)*n:r!=="RGB"||a===1}function HUt(t){return qUt(String.fromCharCode.apply(null,Array.prototype.slice.apply(new Uint8Array(t))))}function qUt(t){let e;try{return decodeURIComponent(escape(t))}catch(n){if(e=n,e instanceof URIError)return t;throw e}}function KUt(t,e,n){const r=new Date().getTime(),i=new Blob([e],{type:"image/jpeg"});return new Promise((a,o)=>{const s=new FileReader;s.readAsBinaryString===void 0?s.readAsArrayBuffer(i):s.readAsBinaryString(i),s.onload=function(){const c=new Image;c.onload=function(){n.height=c.height,n.width=c.width,t.rows=c.height,t.columns=c.width;const l=n.getContext("2d");l.drawImage(this,0,0);const u=l.getImageData(0,0,c.width,c.height),f=new Date().getTime();t.pixelData=new Uint8Array(u.data.buffer),t.imageData=u,t.decodeTimeInMS=f-r;const d=xB(t.pixelData);t.smallestPixelValue=d.min,t.largestPixelValue=d.max,t.pixelDataLength=t.pixelData.length,a(t)},c.onerror=function(l){o(l)},s.readAsBinaryString===void 0?c.src=`data:image/jpeg;base64,${window.btoa(HUt(s.result))}`:c.src=`data:image/jpeg;base64,${window.btoa(s.result)}`},s.onerror=c=>{o(c)}})}function _c(t,e,n,r,i){const a={...r};delete a.loader,delete a.streamingData;const o=x2e(),s=a.priority||void 0;return a.transferPixelData&&n.buffer,o.executeTask("dicomImageLoader","decodeTask",{imageFrame:t,transferSyntax:e,pixelData:n,options:a,decodeConfig:i},{priority:s,requestType:a?.requestType})}function YUt(t,e,n,r,i={},a){switch(e){case"1.2.840.10008.1.2":return _c(t,e,n,i,a);case"1.2.840.10008.1.2.1":return _c(t,e,n,i,a);case"1.2.840.10008.1.2.2":return _c(t,e,n,i,a);case"1.2.840.10008.1.2.1.99":return _c(t,e,n,i,a);case"1.2.840.10008.1.2.5":return _c(t,e,n,i,a);case"1.2.840.10008.1.2.4.50":return t.bitsAllocated===8&&(t.samplesPerPixel===3||t.samplesPerPixel===4)?KUt(t,n,r):_c(t,e,n,i,a);case"1.2.840.10008.1.2.4.51":return _c(t,e,n,i,a);case"1.2.840.10008.1.2.4.57":return _c(t,e,n,i,a);case"1.2.840.10008.1.2.4.70":return _c(t,e,n,i,a);case"1.2.840.10008.1.2.4.80":return _c(t,e,n,i,a);case"1.2.840.10008.1.2.4.81":return _c(t,e,n,i,a);case"1.2.840.10008.1.2.4.90":return _c(t,e,n,i,a);case"1.2.840.10008.1.2.4.91":return _c(t,e,n,i,a);case"3.2.840.10008.1.2.4.96":case"1.2.840.10008.1.2.4.201":case"1.2.840.10008.1.2.4.202":case"1.2.840.10008.1.2.4.203":return _c(t,e,n,i,a)}return Promise.reject(new Error(`No decoder for transfer syntax ${e}`))}function XUt(t){const e=Ot("imagePixelModule",t);return{samplesPerPixel:e.samplesPerPixel,photometricInterpretation:e.photometricInterpretation,planarConfiguration:e.planarConfiguration,rows:e.rows,columns:e.columns,bitsAllocated:e.bitsAllocated,bitsStored:e.bitsStored,pixelRepresentation:e.pixelRepresentation,smallestPixelValue:e.smallestPixelValue,largestPixelValue:e.largestPixelValue,redPaletteColorLookupTableDescriptor:e.redPaletteColorLookupTableDescriptor,greenPaletteColorLookupTableDescriptor:e.greenPaletteColorLookupTableDescriptor,bluePaletteColorLookupTableDescriptor:e.bluePaletteColorLookupTableDescriptor,redPaletteColorLookupTableData:e.redPaletteColorLookupTableData,greenPaletteColorLookupTableData:e.greenPaletteColorLookupTableData,bluePaletteColorLookupTableData:e.bluePaletteColorLookupTableData,pixelData:void 0,imageId:t}}function ZUt(t,e){const n=t.get("modalityLutModule",e)||{},r=t.get("generalSeriesModule",e)||{},{modality:i}=r,a={rescaleSlope:n.rescaleSlope,rescaleIntercept:n.rescaleIntercept,modality:i},o=t.get("scalingModule",e)||{};return{...a,...i==="PT"&&{suvbw:o.suvbw},...i==="RTDOSE"&&{doseGridScaling:o.DoseGridScaling,doseSummation:o.DoseSummation,doseType:o.DoseType,doseUnit:o.DoseUnit}}}function nCe(t){return t==="RGB"||t==="PALETTE COLOR"||t==="YBR_FULL"||t==="YBR_FULL_422"||t==="YBR_PARTIAL_422"||t==="YBR_PARTIAL_420"||t==="YBR_RCT"||t==="YBR_ICT"}function QUt(t,e){const n=t.length/4;let r=0,i=0;for(let a=0;a<n;a++)e[i++]=t[r++],e[i++]=t[r++],e[i++]=t[r++],r++;return e}function JUt(t){return t!=="1.2.840.10008.5.1.4.1.1.12.1"&&t!=="1.2.840.10008.5.1.4.1.1.12.2.1"}function wB(t,e){let n;return Number.isInteger(t)&&Number.isInteger(e)&&(t>=0?e<=255?n=Uint8Array:e<=65535?n=Uint16Array:e<=4294967295&&(n=Uint32Array):t>=-128&&e<=127?n=Int8Array:t>=-32768&&e<=32767&&(n=Int16Array)),n||Float32Array}function eFt(t,e,n){return wB(t,e)===n}function tFt(t){const e=t.smallestPixelValue,n=t.largestPixelValue,r=wB(e,n);if(r){const i=new r(t.pixelData);t.pixelData=i}else throw new Error("Could not apply a typed array to the pixel data")}let lre="";function bB(t,e,n,r={}){const i=r.useRGBA;if(r.preScale={enabled:r.preScale&&r.preScale.enabled!==void 0?r.preScale.enabled:!0},!e?.length)return Promise.reject(new Error("The pixel data is missing"));const{MetadataModules:a}=Ad,o=document.createElement("canvas"),s=XUt(t);if(s.decodeLevel=r.decodeLevel,r.allowFloatRendering=CU(),r.preScale.enabled){const f=ZUt(VDt,t);f&&(r.preScale={...r.preScale,scalingParameters:f})}const{decodeConfig:c}=R9();Object.keys(s).forEach(f=>{(typeof s[f]=="function"||s[f]instanceof Promise)&&delete s[f]});const l=YUt(s,n,e,o,r,c),u=nCe(s.photometricInterpretation);return new Promise((f,d)=>{l.then(function(h){let m=!1;if(r.targetBuffer&&r.targetBuffer.type&&!u){const{arrayBuffer:V,type:k,offset:L=0,length:$}=r.targetBuffer,W=h.pixelDataLength,G=L,oe=$??W-G,U={Uint8Array,Uint16Array,Int16Array,Float32Array,Uint32Array};if(oe!==h.pixelDataLength)throw new Error(`target array for image does not have the same length (${oe}) as the decoded image length (${h.pixelDataLength}).`);const Y=U[k],J=V?new Y(V,G,oe):new Y(h.pixelData);if(oe!==h.pixelDataLength)throw new Error("target array for image does not have the same length as the decoded image length.");h.pixelData=J,m=!0}m||tFt(h);const p=Ot(a.IMAGE_PLANE,t)||{},y=Ot(a.VOI_LUT,t)||{},x=Ot(a.MODALITY_LUT,t)||{},S=Ot(a.SOP_COMMON,t)||{},C=Ot(a.CALIBRATION,t)||{},{rows:_,columns:T}=h;if(u){if(WUt(h)){o.height=h.rows,o.width=h.columns;let L=o.getContext("2d").createImageData(h.columns,h.rows);i||(L={...L,data:new Uint8ClampedArray(3*h.columns*h.rows)}),GUt(h,L.data,i),h.imageData=L,h.pixelData=L.data,h.pixelDataLength=L.data.length}else if(!i&&h.pixelDataLength===4*_*T){const k=new Uint8Array(h.pixelData.length/4*3);h.pixelData=QUt(h.pixelData,k),h.pixelDataLength=h.pixelData.length}const V=xB(h.pixelData);h.smallestPixelValue=V.min,h.largestPixelValue=V.max}let O=h.samplesPerPixel;h.photometricInterpretation==="PALETTE COLOR"&&(O=i?4:3);const M=oi.createImageVoxelManager({scalarData:h.pixelData,width:h.columns,height:h.rows,numberOfComponents:O}),I={imageId:t,dataType:h.pixelData.constructor.name,color:u,calibration:C,columnPixelSpacing:p.columnPixelSpacing,columns:h.columns,height:h.rows,preScale:h.preScale,intercept:x.rescaleIntercept?x.rescaleIntercept:0,slope:x.rescaleSlope?x.rescaleSlope:1,invert:h.photometricInterpretation==="MONOCHROME1",minPixelValue:h.smallestPixelValue,maxPixelValue:h.largestPixelValue,rowPixelSpacing:p.rowPixelSpacing,rows:h.rows,sizeInBytes:h.pixelData.byteLength,width:h.columns,windowCenter:y.windowCenter?y.windowCenter[0]:void 0,windowWidth:y.windowWidth?y.windowWidth[0]:void 0,voiLUTFunction:y.voiLUTFunction?y.voiLUTFunction:void 0,decodeTimeInMS:h.decodeTimeInMS,floatPixelData:void 0,imageFrame:h,voxelManager:M,rgba:u&&i,getPixelData:()=>h.pixelData,getCanvas:void 0,numberOfComponents:O};if(I.color&&(I.getCanvas=function(){if(lre===t)return o;const V=I.columns,k=I.rows;o.height=k,o.width=V;const L=o.getContext("2d"),$=L.createImageData(V,k),W=h.pixelData;if(W.length===V*k*4)for(let G=0;G<W.length;G++)$.data[G]=W[G];else if(W.length===V*k*3){let G=0;for(let oe=0;oe<W.length;oe+=3)$.data[G++]=W[oe],$.data[G++]=W[oe+1],$.data[G++]=W[oe+2],$.data[G++]=255}return h.pixelData=$.data,h.pixelDataLength=$.data.length,h.imageData=$,L.putImageData(h.imageData,0,0),lre=t,o}),x.modalityLUTSequence&&x.modalityLUTSequence.length>0&&JUt(S.sopClassUID)&&(I.modalityLUT=x.modalityLUTSequence[0]),y.voiLUTSequence&&y.voiLUTSequence.length>0&&(I.voiLUT=y.voiLUTSequence[0]),I.color&&(I.windowWidth=256,I.windowCenter=128),I.windowCenter===void 0||I.windowWidth===void 0){const V=m3(I.imageFrame.smallestPixelValue,I.imageFrame.largestPixelValue);I.windowWidth=V.windowWidth,I.windowCenter=V.windowCenter}f(I)},d)})}const{ImageQualityStatus:rCe}=Ad;function nFt(t,e){t.decache=function(){const n=M9(e);nw.unload(n.url)}}function rFt(t,e,n=0,r,i,a){const o=new Date().getTime(),s={cancelFn:void 0,promise:void 0};return s.promise=new Promise((c,l)=>{t.then(u=>{const f=tCe(u,n),d=u.string("x00020010"),h=new Date().getTime(),m=bB(e,f,d,i);nFt(s,e),m.then(p=>{p=p,p.data=u,p.sharedCacheKey=r;const y=new Date().getTime();p.loadTimeInMS=h-o,p.totalTimeInMS=y-o,p.imageQualityStatus=rCe.FULL_RESOLUTION,a!==void 0&&a.imageDoneCallback!==void 0&&a.imageDoneCallback(p),c(p)},function(p){l({error:p,dataSet:u})})},function(u){l({error:u})})}),s}function iFt(t,e,n=0,r,i){const a=new Date().getTime();return{promise:new Promise((s,c)=>{const l=new Date().getTime();let u;try{const f=tCe(t,n),d=t.string("x00020010");u=bB(e,f,d,i)}catch(f){c({error:f,dataSet:t});return}u.then(f=>{f=f,f.data=t;const d=new Date().getTime();f.loadTimeInMS=l-a,f.totalTimeInMS=d-a,f.imageQualityStatus=rCe.FULL_RESOLUTION,s(f)},c)}),cancelFn:void 0}}function aFt(t){if(t==="dicomweb"||t==="wadouri")return gB;if(t==="dicomfile")return BUt}function vI(t,e={}){const n=M9(t);e=Object.assign({},e),delete e.loader;const r=aFt(n.scheme);if(nw.isLoaded(n.url)){const a=nw.get(n.url,r,t);return iFt(a,t,n.pixelDataFrame,n.url,e)}const i=nw.load(n.url,r,t);return rFt(i,t,n.frame,n.url,e)}function oFt(){BC("dicomweb",vI),BC("wadouri",vI),BC("dicomfile",vI),L2(eCe)}function Tn(t,e,n){return e=e||0,!t||!t.Value||Array.isArray(t.Value)&&t.Value.length<=e?n:t.Value[e]}function Cr(t,e){const n=Tn(t,e);if(n!==void 0)return parseFloat(n)}function zs(t,e){if(!t||!t.Value||!Array.isArray(t.Value)||e&&t.Value.length<e)return;const n=[];for(let r=0;r<t.Value.length;r++)n.push(parseFloat(t.Value[r]));return n}function sFt(t){const e=[];for(let n=0;n<=30;n+=2){let r=`x60${n.toString(16)}`;r.length===4&&(r=`x600${n.toString(16)}`);const i=Tn(t[`${r}3000`]);if(!i)continue;const a=[];for(let o=0;o<i.length;o++)for(let s=0;s<8;s++){const c=t.Value[i.dataOffset+o];a[o*8+s]=c>>s&1}e.push({rows:Cr(t[`${r}0010`]),columns:Cr(t[`${r}0011`]),type:Tn(t[`${r}0040`]),x:Cr(t[`${r}0050`],1)-1,y:Cr(t[`${r}0050`],0)-1,pixelData:a,description:Tn(t[`${r}0022`]),label:Tn(t[`${r}1500`]),roiArea:Tn(t[`${r}1301`]),roiMean:Tn(t[`${r}1302`]),roiStandardDeviation:Tn(t[`${r}1303`])})}return{overlays:e}}function P9(t){const e=t.indexOf(":");return t.substring(e+1)}function wy(t,e=!0){return t&&t.Value?t.Value[0]&&e?t.Value[0]:t.Value:t}function iCe(t,e,n){const r=(e?Object.values(e[0]):[]).map(a=>a.Value?.[0]).filter(a=>a!==void 0&&typeof a=="object"),i=(t?Object.values(t[n-1]):[]).map(a=>a.Value?.[0]).filter(a=>a!==void 0&&typeof a=="object");return{shared:r,perFrame:i}}function aCe(t){let{52009230:e,52009229:n,"00280008":r,...i}=t;return e=wy(e,!1),n=wy(n,!1),r=wy(r),{PerFrameFunctionalGroupsSequence:e,SharedFunctionalGroupsSequence:n,NumberOfFrames:r,rest:i}}function cFt(t,e){const{PerFrameFunctionalGroupsSequence:n,SharedFunctionalGroupsSequence:r,NumberOfFrames:i,rest:a}=aCe(e);if(n||i>1){const{shared:o,perFrame:s}=iCe(n,r,t),c=Object.assign(e,{frameNumber:t});return[...o,...s].forEach(l=>{Object.entries(l).forEach(([u,f])=>{c[u]=f})}),Object.assign(a,{"00280008":i},c)}return e}let R3=[],x6={};function oCe(t){const e=t.indexOf("/frames/")+8,n=t.slice(0,e),r=parseInt(t.slice(e),10);return{metadata:R3[`${n}1`],frame:r}}function lFt(t){const e=P9(t);return oCe(e)}function uFt(t){if(t[52009230]!==void 0||t[52009229]!==void 0)return!0;const e=Tn(t["00280008"]);return e&&e>1}function fFt(t,e){const n=P9(t);Object.defineProperty(e,"isMultiframe",{value:uFt(e),enumerable:!1}),R3[n]=e}function dFt(t){const e=P9(t),n=R3[e];if(n&&!n?.isMultiframe)return n;const r=x6[e];if(r)return r;const i=oCe(e);if(!i||!i.metadata)return;const{metadata:a,frame:o}=i;if(a){const s=cFt(o,a);return x6[e]=s,s}}function hFt(t){const e=P9(t);R3[e]=void 0,x6[e]=void 0}function gFt(){R3=[],x6={}}const sCe={add:fFt,get:dFt,remove:hFt,purge:gFt};function cCe(t){return Tn(t["00080060"]).includes("NM")}function SB(t,e){const n=wy(t["00080008"],!1);if(n)return n[e]}function pFt(t){let e;const n=SB(t,2);if(n&&G2(n)){const r=wy(t["00540022"]);r&&(e=zs(r["00200037"],6))}return e}function mFt(t){let e;const n=SB(t,2);if(n&&G2(n)){const r=wy(t["00540022"]);r&&(e=zs(r["00200032"],3))}return e}function ure(t){let e=zs(t["00200037"],6);return!e&&cCe(t)&&(e=pFt(t)),e}function fre(t){let e=zs(t["00200032"],3);return!e&&cCe(t)&&(e=mFt(t)),e}function hs(t,e){const n=zs(t[e]);return n?n[0]:null}function vFt(t){return t?.Value?.length?Array.isArray(t.Value)?t.Value:typeof t.Value=="object"?(console.warn("Warning: Value should be an array, but an object was found. Encapsulating the object in an array."),[t.Value]):[]:[]}function dre(t){const e=vFt(t["00186011"]);return!e||!e.length?null:e.map(r=>{const i=hs(r,"0018602C"),a=hs(r,"0018602E"),o=hs(r,"00186024"),s=hs(r,"00186026"),c=hs(r,"0018601A"),l=hs(r,"0018601E"),u=hs(r,"00186018"),f=hs(r,"0018601C"),d=hs(r,"00186020"),h=hs(r,"00186022"),m=hs(r,"0018602A"),p=hs(r,"00186028"),y=hs(r,"00186012"),x=hs(r,"00186014"),S=hs(r,"00186016"),C=hs(r,"00186030");return{regionLocationMinY0:c,regionLocationMaxY1:l,regionLocationMinX0:u,regionLocationMaxX1:f,referencePixelX0:d,referencePixelY0:h,physicalDeltaX:i,physicalDeltaY:a,physicalUnitsXDirection:o,physicalUnitsYDirection:s,referencePhysicalPixelValueY:m,referencePhysicalPixelValueX:p,regionSpatialFormat:y,regionDataType:x,regionFlags:S,transducerFrequency:C}})}function lCe(t,e){const{MetadataModules:n}=Ad;if(t===n.MULTIFRAME){const{metadata:i,frame:a}=lFt(e);if(!i)return;const{PerFrameFunctionalGroupsSequence:o,SharedFunctionalGroupsSequence:s,NumberOfFrames:c}=aCe(i);if(o||c>1){const{shared:l,perFrame:u}=iCe(o,s,a);return{NumberOfFrames:c,PerFrameFunctionalInformation:u,SharedFunctionalInformation:l}}return{NumberOfFrames:c}}const r=sCe.get(e);if(r){if(t===n.GENERAL_STUDY)return{studyDescription:Tn(r["00081030"]),studyDate:ha.parseDA(Tn(r["00080020"])),studyTime:ha.parseTM(Tn(r["00080030"],0,"")),accessionNumber:Tn(r["00080050"])};if(t===n.GENERAL_SERIES)return{modality:Tn(r["00080060"]),seriesInstanceUID:Tn(r["0020000E"]),seriesDescription:Tn(r["0008103E"]),seriesNumber:Cr(r["00200011"]),studyInstanceUID:Tn(r["0020000D"]),seriesDate:ha.parseDA(Tn(r["00080021"])),seriesTime:ha.parseTM(Tn(r["00080031"],0,"")),acquisitionDate:ha.parseDA(Tn(r["00080022"])),acquisitionTime:ha.parseTM(Tn(r["00080032"],0,""))};if(t===n.GENERAL_IMAGE)return{sopInstanceUID:Tn(r["00080018"]),instanceNumber:Cr(r["00200013"]),lossyImageCompression:Tn(r["00282110"]),lossyImageCompressionRatio:Cr(r["00282112"]),lossyImageCompressionMethod:Tn(r["00282114"])};if(t===n.PATIENT)return{patientID:Tn(r["00100020"]),patientName:Tn(r["00100010"])};if(t===n.PATIENT_STUDY)return{patientAge:Cr(r["00101010"]),patientSize:Cr(r["00101020"]),patientSex:Tn(r["00100040"]),patientWeight:Cr(r["00101030"])};if(t===n.NM_MULTIFRAME_GEOMETRY){const i=Tn(r["00080060"]),a=SB(r,2);return{modality:i,imageType:Tn(r["00080008"]),imageSubType:a,imageOrientationPatient:ure(r),imagePositionPatient:fre(r),sliceThickness:Cr(r["00180050"]),spacingBetweenSlices:Cr(r["00180088"]),pixelSpacing:zs(r["00280030"],2),numberOfFrames:Cr(r["00280008"]),isNMReconstructable:G2(a)&&i.includes("NM")}}if(t===n.IMAGE_PLANE){let i=ure(r),a=fre(r);const o=zs(r["00280030"],2);let s=null,c=null,l=null,u=null,f=!1;return o?(c=o[0],s=o[1]):(f=!0,c=1,s=1),i?(l=[parseFloat(i[0]),parseFloat(i[1]),parseFloat(i[2])],u=[parseFloat(i[3]),parseFloat(i[4]),parseFloat(i[5])]):(l=[1,0,0],u=[0,1,0],f=!0,i=[...l,...u]),a||(a=[0,0,0],f=!0),{frameOfReferenceUID:Tn(r["00200052"]),rows:Cr(r["00280010"]),columns:Cr(r["00280011"]),imageOrientationPatient:i,rowCosines:l,columnCosines:u,imagePositionPatient:a,sliceThickness:Cr(r["00180050"]),sliceLocation:Cr(r["00201041"]),pixelSpacing:o,rowPixelSpacing:c,columnPixelSpacing:s,usingDefaultValues:f}}if(t===n.ULTRASOUND_ENHANCED_REGION)return dre(r);if(t===n.CALIBRATION&&Tn(r["00080060"])==="US")return{sequenceOfUltrasoundRegions:dre(r)};if(t===n.IMAGE_URL)return yFt(e,r);if(t===n.CINE)return xFt(e,r);if(t===n.IMAGE_PIXEL)return{samplesPerPixel:Cr(r["00280002"]),photometricInterpretation:Tn(r["00280004"]),rows:Cr(r["00280010"]),columns:Cr(r["00280011"]),bitsAllocated:Cr(r["00280100"]),bitsStored:Cr(r["00280101"]),highBit:Tn(r["00280102"]),pixelRepresentation:Cr(r["00280103"]),planarConfiguration:Cr(r["00280006"]),pixelAspectRatio:Tn(r["00280034"]),smallestPixelValue:Cr(r["00280106"]),largestPixelValue:Cr(r["00280107"]),redPaletteColorLookupTableDescriptor:zs(r["00281101"]),greenPaletteColorLookupTableDescriptor:zs(r["00281102"]),bluePaletteColorLookupTableDescriptor:zs(r["00281103"]),redPaletteColorLookupTableData:zs(r["00281201"]),greenPaletteColorLookupTableData:zs(r["00281202"]),bluePaletteColorLookupTableData:zs(r["00281203"])};if(t===n.VOI_LUT)return{windowCenter:zs(r["00281050"],1),windowWidth:zs(r["00281051"],1),voiLUTFunction:Tn(r["00281056"])};if(t===n.MODALITY_LUT)return{rescaleIntercept:Cr(r["00281052"]),rescaleSlope:Cr(r["00281053"]),rescaleType:Tn(r["00281054"])};if(t===n.SOP_COMMON)return{sopClassUID:Tn(r["00080016"]),sopInstanceUID:Tn(r["00080018"])};if(t===n.PET_ISOTOPE){const i=Tn(r["00540016"]);return i===void 0?void 0:{radiopharmaceuticalInfo:{radiopharmaceuticalStartTime:ha.parseTM(Tn(i["00181072"],0,"")),radiopharmaceuticalStartDateTime:Tn(i["00181078"],0,""),radionuclideTotalDose:Cr(i["00181074"]),radionuclideHalfLife:Cr(i["00181075"])}}}if(t===n.OVERLAY_PLANE)return sFt(r);if(t==="transferSyntax")return uCe(e,r);if(t===n.PET_SERIES){let i=r["00280051"],a=Tn(r["00280051"]);return i&&i.Value&&Array.isArray(i.Value)&&(a=i.Value.join("\\")),{correctedImage:a,units:Tn(r["00541001"]),decayCorrection:Tn(r["00541102"])}}if(t===n.PET_IMAGE)return{frameReferenceTime:Cr(r["00541300"]),actualFrameDuration:Cr(r["00181242"])};if(t==="instance")return QSe(e,lCe,JSe)}}function yFt(t,e){const{transferSyntaxUID:n}=uCe(t,e),r=k3e(n),i=t.substring(7),a=i.replace("/frames/","/thumbnail/");let o=i.replace("/frames/","/rendered/");return r&&(o=o.replace("/rendered/1","/rendered")),{isVideo:r,rendered:o,thumbnail:a}}function xFt(t,e){return{cineRate:Tn(e["00180040"]),numberOfFrames:Cr(e["00280008"])}}function uCe(t,e){return{transferSyntaxUID:Tn(e["00020010"])||Tn(e["00083002"])}}function wFt(t,e,n={},r={}){const i=R9(),{retrieveOptions:a={},streamingData:o}=r,s=o.chunkSize||SFt(e,a,"chunkSize")||65536,c=u=>{if(typeof i.errorInterceptor=="function"){const f=new Error("request failed");i.errorInterceptor(f)}else console.warn("rangeRequest:Caught",u)};return new Promise(async(u,f)=>{const d=Object.assign({},n);Object.keys(d).forEach(function(h){(d[h]===null||d[h]===void 0)&&delete d[h]});try{o.encodedData||(o.chunkSize=s,o.rangesFetched=0);const h=CFt(o,a),{encodedData:m,responseHeaders:p}=await bFt(t,d,h,o),y=p.get("content-type"),{totalBytes:x}=o,S=x===m.byteLength,C=pB(y,m,{isPartial:!0}),_=mB(a,S||C.extractDone===!0);u({...C,imageQualityStatus:_,percentComplete:C.extractDone?100:m.byteLength*100/x})}catch(h){c(h),console.error(h),f(h)}})}async function bFt(t,e,n,r){n&&(e=Object.assign(e,{Range:`bytes=${n[0]}-${n[1]}`}));let{encodedData:i}=r;if(n[1]&&i?.byteLength>n[1])return r;const a=await fetch(t,{headers:e,signal:void 0}),o=await a.arrayBuffer(),s=new Uint8Array(o),{status:c}=a;let l;i?(l=new Uint8Array(i.length+s.length),l.set(i,0),l.set(s,i.length),r.rangesFetched=1):(l=new Uint8Array(s.length),l.set(s,0),r.rangesFetched++),r.encodedData=i=l,r.responseHeaders=a.headers;const u=a.headers.get("Content-Range");return u?r.totalBytes=Number(u.split("/")[1]):c!==206||!n?r.totalBytes=i?.byteLength:n[1]===""||i?.length<n[1]?r.totalBytes=i.byteLength:r.totalBytes=Number.MAX_SAFE_INTEGER,r}function SFt(t,e,n){const r=e[n];if(typeof r!="function")return r;const i=sCe.get(t);return r(i,t)}function CFt(t,e){const{totalBytes:n,encodedData:r,chunkSize:i=65536}=t,{rangeIndex:a=0}=e;return a===-1&&(!n||!r)?[0,""]:a===-1||r?.byteLength>n-i?[r?.byteLength||0,""]:[r?.byteLength||0,i*(a+1)-1]}function _Ft(t,e,n="application/octet-stream",r){const{streamingData:i,retrieveOptions:a={}}=r||{},o={Accept:n};let s=a.urlArguments?`${t}${t.indexOf("?")===-1?"?":"&"}${a.urlArguments}`:t;if(a.framesPath&&(s=s.replace("/frames/",a.framesPath)),i?.url!==s&&(r.streamingData={url:s}),a.rangeIndex!==void 0)return wFt(s,e,o,r);if(a.streaming)return uUt(s,e,o,r);const c=gB(s,e,o),{xhr:l}=c;return c.then(function(u){const f=l.getResponseHeader("Content-Type")||"application/octet-stream",d=pB(f,new Uint8Array(u));return d.imageQualityStatus=mB(a,!0),d})}const{ProgressiveIterator:hre}=Bc,{ImageQualityStatus:gre}=Ad,TFt=new Set(["3.2.840.10008.1.2.4.96","1.2.840.10008.1.2.4.202","1.2.840.10008.1.2.4.203"]);function EFt(t){const e="1.2.840.10008.1.2";if(!t)return e;const n=t.split(";"),r={};n.forEach(a=>{const o=a.split("=");if(o.length!==2)return;const s=o[1].trim().replace(/"/g,"");r[o[0].trim()]=s});const i={"image/jpeg":"1.2.840.10008.1.2.4.50","image/x-dicom-rle":"1.2.840.10008.1.2.5","image/x-jls":"1.2.840.10008.1.2.4.80","image/jls":"1.2.840.10008.1.2.4.80","image/jll":"1.2.840.10008.1.2.4.70","image/jp2":"1.2.840.10008.1.2.4.90","image/jpx":"1.2.840.10008.1.2.4.92","image/jphc":"3.2.840.10008.1.2.4.96","image/jxl":"1.2.840.10008.1.2.4.140"};return r["transfer-syntax"]?r["transfer-syntax"]:t&&!Object.keys(r).length&&i[t]?i[t]:r.type&&i[r.type]?i[r.type]:i[t]?i[t]:e}function OFt(){return _3}const DFt="multipart/related; type=application/octet-stream; transfer-syntax=*";function MFt(t,e={}){const n=OFt(),r=new Date().getTime(),i=new hre("decompress");async function a(u,f,d){i.generate(async h=>{const m=hre.as(_Ft(u,f,d,e));let p=10;for await(const y of m){const{pixelData:x,imageQualityStatus:S=gre.FULL_RESOLUTION,percentComplete:C,done:_=!0,extractDone:T=!0}=y,O=EFt(y.contentType);if(!T&&!TFt.has(O))continue;const M=y.decodeLevel??(S===gre.FULL_RESOLUTION?0:RFt(C,e.retrieveOptions?.decodeLevel));if(!(!_&&p<=M))try{const I={...e,decodeLevel:M},V=await bB(f,x,O,I),k=new Date().getTime();V.loadTimeInMS=k-r,V.transferSyntaxUID=O,V.imageQualityStatus=S,h.add(V,_),p=M}catch(I){if(T)throw console.warn("Couldn't decode",I),I}}})}const o=e.requestType||In.Interaction,s=e.additionalDetails||{imageId:t},c=e.priority===void 0?5:e.priority,l=t.substring(7);return n.addRequest(a.bind(this,l,t,DFt),o,s,c),{promise:i.getDonePromise(),cancelFn:void 0}}function RFt(t,e=4){const n=t/100-.02;return n>1/4?Math.min(e,0):n>1/16?Math.min(e,1):n>1/64?Math.min(e,2):Math.min(e,3)}function IFt(){BC("wadors",MFt),L2(lCe)}function NFt(){IFt(),oFt()}const PFt=()=>new Worker(new URL("/assets/decodeImageFrameWorker-CfQCdrMB.js",import.meta.url),{type:"module"});function kFt(t={}){rUt(t),NFt();const e=x2e(),n=t?.maxWebWorkers||AFt();e.registerWorker("dicomImageLoader",PFt,{maxWorkerInstances:n})}function AFt(){return typeof navigator<"u"&&navigator.hardwareConcurrency?Math.max(1,Math.floor(navigator.hardwareConcurrency/2)):1}function LFt(t,e){const{rows:n,columns:r,data:i}=t,{rows:a,columns:o,data:s}=e,c=[],l=[],u=[];for(let f=0;f<o;f++){const d=f*(r-1)/(o-1);c[f]=Math.floor(d),l[f]=Math.min(c[f]+1,r-1),u[f]=d-c[f]}for(let f=0;f<a;f++){const d=f*(n-1)/(a-1),h=Math.floor(d)*r,m=Math.min(h+r,(n-1)*r),p=d-Math.floor(d),y=1-p,x=f*o;for(let S=0;S<o;S++){const C=i[h+c[S]],_=i[h+l[S]],T=i[m+c[S]],O=i[m+l[S]],M=1-u[S];s[x+S]=(C*M+_*u[S])*y+(T*M+O*u[S])*p}}return s}function VFt(t,e){const{rows:n,columns:r,pixelData:i,samplesPerPixel:a=1}=t,{rows:o,columns:s,pixelData:c}=e,l=[];for(let u=0;u<s;u++){const f=u*(r-1)/(s-1);l[u]=Math.floor(f)*a}for(let u=0;u<o;u++){const f=u*(n-1)/(o-1),d=Math.floor(f)*r*a,h=u*s;for(let m=0;m<s;m++)for(let p=0;p<a;p++)c[h+m+p]=i[d+l[m]+p]}return c}async function pre(t,e){let n=e.buffer,r=e.byteOffset;const i=e.length;if(t.bitsAllocated===16)r%2&&(n=n.slice(r),r=0),t.pixelRepresentation===0?t.pixelData=new Uint16Array(n,r,i/2):t.pixelData=new Int16Array(n,r,i/2);else if(t.bitsAllocated===8||t.bitsAllocated===1)t.pixelData=e;else if(t.bitsAllocated===32){if(r%2&&(n=n.slice(r),r=0),t.floatPixelData||t.doubleFloatPixelData)throw new Error("Float pixel data is not supported for parsing into ImageFrame");t.pixelRepresentation===0?t.pixelData=new Uint32Array(n,r,i/4):t.pixelRepresentation===1?t.pixelData=new Int32Array(n,r,i/4):t.pixelData=new Float32Array(n,r,i/4)}return t}function $Ft(t){return(t&255)<<8|t>>8&255}async function jFt(t,e){if(t.bitsAllocated===16){let n=e.buffer,r=e.byteOffset;const i=e.length;r%2&&(n=n.slice(r),r=0),t.pixelRepresentation===0?t.pixelData=new Uint16Array(n,r,i/2):t.pixelData=new Int16Array(n,r,i/2);for(let a=0;a<t.pixelData.length;a++)t.pixelData[a]=$Ft(t.pixelData[a])}else t.bitsAllocated===8&&(t.pixelData=e);return t}async function UFt(t,e){if(t.bitsAllocated===8)return t.planarConfiguration?BFt(t,e):FFt(t,e);if(t.bitsAllocated===16)return zFt(t,e);throw new Error("unsupported pixel format for RLE")}function FFt(t,e){const n=e,r=t.rows*t.columns,i=new ArrayBuffer(r*t.samplesPerPixel),a=new DataView(n.buffer,n.byteOffset),o=new Int8Array(n.buffer,n.byteOffset),s=new Int8Array(i);let c=0;const l=a.getInt32(0,!0);for(let u=0;u<l;++u){c=u;let f=a.getInt32((u+1)*4,!0),d=a.getInt32((u+2)*4,!0);d===0&&(d=n.length);const h=r*l;for(;f<d;){const m=o[f++];if(m>=0&&m<=127)for(let p=0;p<m+1&&c<h;++p)s[c]=o[f++],c+=t.samplesPerPixel;else if(m<=-1&&m>=-127){const p=o[f++];for(let y=0;y<-m+1&&c<h;++y)s[c]=p,c+=t.samplesPerPixel}}}return t.pixelData=new Uint8Array(i),t}function BFt(t,e){const n=e,r=t.rows*t.columns,i=new ArrayBuffer(r*t.samplesPerPixel),a=new DataView(n.buffer,n.byteOffset),o=new Int8Array(n.buffer,n.byteOffset),s=new Int8Array(i);let c=0;const l=a.getInt32(0,!0);for(let u=0;u<l;++u){c=u*r;let f=a.getInt32((u+1)*4,!0),d=a.getInt32((u+2)*4,!0);d===0&&(d=n.length);const h=r*l;for(;f<d;){const m=o[f++];if(m>=0&&m<=127)for(let p=0;p<m+1&&c<h;++p)s[c]=o[f++],c++;else if(m<=-1&&m>=-127){const p=o[f++];for(let y=0;y<-m+1&&c<h;++y)s[c]=p,c++}}}return t.pixelData=new Uint8Array(i),t}function zFt(t,e){const n=e,r=t.rows*t.columns,i=new ArrayBuffer(r*t.samplesPerPixel*2),a=new DataView(n.buffer,n.byteOffset),o=new Int8Array(n.buffer,n.byteOffset),s=new Int8Array(i),c=a.getInt32(0,!0);for(let l=0;l<c;++l){let u=0;const f=l===0?1:0;let d=a.getInt32((l+1)*4,!0),h=a.getInt32((l+2)*4,!0);for(h===0&&(h=n.length);d<h;){const m=o[d++];if(m>=0&&m<=127)for(let p=0;p<m+1&&u<r;++p)s[u*2+f]=o[d++],u++;else if(m<=-1&&m>=-127){const p=o[d++];for(let y=0;y<-m+1&&u<r;++y)s[u*2+f]=p,u++}}}return t.pixelRepresentation===0?t.pixelData=new Uint16Array(i):t.pixelData=new Int16Array(i),t}var yI={exports:{}},mre;function GFt(){return mre||(mre=1,(function(t,e){var n=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),(function(i){i=i||{};var a=typeof i<"u"?i:{},o,s;a.ready=new Promise(function(P,A){o=P,s=A});var c=Object.assign({},a),l="./this.program",u=(P,A)=>{throw A},f=typeof window=="object",d=typeof importScripts=="function",h=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",m="";function p(P){return a.locateFile?a.locateFile(P,m):m+P}var y,x,S;if(h){var C=Cd,_=Cd;d?m=_.dirname(m)+"/":m=__dirname+"/",y=(P,A)=>(P=ie(P)?new URL(P):_.normalize(P),C.readFileSync(P,A?void 0:"utf8")),S=P=>{var A=y(P,!0);return A.buffer||(A=new Uint8Array(A)),A},x=(P,A,H)=>{P=ie(P)?new URL(P):_.normalize(P),C.readFile(P,function(le,he){le?H(le):A(he.buffer)})},process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(P){if(!(P instanceof Pt))throw P}),process.on("unhandledRejection",function(P){throw P}),u=(P,A)=>{throw process.exitCode=P,A},a.inspect=function(){return"[Emscripten Module object]"}}else(f||d)&&(d?m=self.location.href:typeof document<"u"&&document.currentScript&&(m=document.currentScript.src),r&&(m=r),m.indexOf("blob:")!==0?m=m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):m="",y=P=>{var A=new XMLHttpRequest;return A.open("GET",P,!1),A.send(null),A.responseText},d&&(S=P=>{var A=new XMLHttpRequest;return A.open("GET",P,!1),A.responseType="arraybuffer",A.send(null),new Uint8Array(A.response)}),x=(P,A,H)=>{var le=new XMLHttpRequest;le.open("GET",P,!0),le.responseType="arraybuffer",le.onload=()=>{if(le.status==200||le.status==0&&le.response){A(le.response);return}H()},le.onerror=H,le.send(null)});var T=a.print||console.log.bind(console),O=a.printErr||console.warn.bind(console);Object.assign(a,c),c=null,a.arguments&&a.arguments,a.thisProgram&&(l=a.thisProgram),a.quit&&(u=a.quit);var M;a.wasmBinary&&(M=a.wasmBinary),a.noExitRuntime,typeof WebAssembly!="object"&&B("no native wasm support detected");var I,V=!1;function k(P,A){P||B(A)}var L=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function $(P,A,H){for(var le=A+H,he=A;P[he]&&!(he>=le);)++he;if(he-A>16&&P.buffer&&L)return L.decode(P.subarray(A,he));for(var ve="";A<he;){var xe=P[A++];if(!(xe&128)){ve+=String.fromCharCode(xe);continue}var _e=P[A++]&63;if((xe&224)==192){ve+=String.fromCharCode((xe&31)<<6|_e);continue}var ke=P[A++]&63;if((xe&240)==224?xe=(xe&15)<<12|_e<<6|ke:xe=(xe&7)<<18|_e<<12|ke<<6|P[A++]&63,xe<65536)ve+=String.fromCharCode(xe);else{var Xe=xe-65536;ve+=String.fromCharCode(55296|Xe>>10,56320|Xe&1023)}}return ve}function W(P,A){return P?$(ne,P,A):""}function G(P,A,H,le){if(!(le>0))return 0;for(var he=H,ve=H+le-1,xe=0;xe<P.length;++xe){var _e=P.charCodeAt(xe);if(_e>=55296&&_e<=57343){var ke=P.charCodeAt(++xe);_e=65536+((_e&1023)<<10)|ke&1023}if(_e<=127){if(H>=ve)break;A[H++]=_e}else if(_e<=2047){if(H+1>=ve)break;A[H++]=192|_e>>6,A[H++]=128|_e&63}else if(_e<=65535){if(H+2>=ve)break;A[H++]=224|_e>>12,A[H++]=128|_e>>6&63,A[H++]=128|_e&63}else{if(H+3>=ve)break;A[H++]=240|_e>>18,A[H++]=128|_e>>12&63,A[H++]=128|_e>>6&63,A[H++]=128|_e&63}}return A[H]=0,H-he}function oe(P,A,H){return G(P,ne,A,H)}function U(P){for(var A=0,H=0;H<P.length;++H){var le=P.charCodeAt(H);le<=127?A++:le<=2047?A+=2:le>=55296&&le<=57343?(A+=4,++H):A+=3}return A}var Y,J,ne,F,ae,re,te,ye,we;function Oe(P){Y=P,a.HEAP8=J=new Int8Array(P),a.HEAP16=F=new Int16Array(P),a.HEAP32=re=new Int32Array(P),a.HEAPU8=ne=new Uint8Array(P),a.HEAPU16=ae=new Uint16Array(P),a.HEAPU32=te=new Uint32Array(P),a.HEAPF32=ye=new Float32Array(P),a.HEAPF64=we=new Float64Array(P)}a.INITIAL_MEMORY;var Te,Me=[],be=[],Ye=[];function ft(){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)Rt(a.preRun.shift());Ln(Me)}function je(){Ln(be)}function It(){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;)ln(a.postRun.shift());Ln(Ye)}function Rt(P){Me.unshift(P)}function cn(P){be.unshift(P)}function ln(P){Ye.unshift(P)}var en=0,tr=null;function Ke(P){en++,a.monitorRunDependencies&&a.monitorRunDependencies(en)}function ue(P){if(en--,a.monitorRunDependencies&&a.monitorRunDependencies(en),en==0&&tr){var A=tr;tr=null,A()}}function B(P){a.onAbort&&a.onAbort(P),P="Aborted("+P+")",O(P),V=!0,P+=". Build with -sASSERTIONS for more info.";var A=new WebAssembly.RuntimeError(P);throw s(A),A}var K="data:application/octet-stream;base64,";function fe(P){return P.startsWith(K)}function ie(P){return P.startsWith("file://")}var pe;pe="libjpegturbowasm_decode.wasm",fe(pe)||(pe=p(pe));function Re(P){try{if(P==pe&&M)return new Uint8Array(M);if(S)return S(P);throw"both async and sync fetching of the wasm failed"}catch(A){B(A)}}function et(){if(!M&&(f||d)){if(typeof fetch=="function"&&!ie(pe))return fetch(pe,{credentials:"same-origin"}).then(function(P){if(!P.ok)throw"failed to load wasm binary file at '"+pe+"'";return P.arrayBuffer()}).catch(function(){return Re(pe)});if(x)return new Promise(function(P,A){x(pe,function(H){P(new Uint8Array(H))},A)})}return Promise.resolve().then(function(){return Re(pe)})}function wt(){var P={a:Ge};function A(xe,_e){var ke=xe.exports;a.asm=ke,I=a.asm.K,Oe(I.buffer),Te=a.asm.M,cn(a.asm.L),ue()}Ke();function H(xe){A(xe.instance)}function le(xe){return et().then(function(_e){return WebAssembly.instantiate(_e,P)}).then(function(_e){return _e}).then(xe,function(_e){O("failed to asynchronously prepare wasm: "+_e),B(_e)})}function he(){return!M&&typeof WebAssembly.instantiateStreaming=="function"&&!fe(pe)&&!ie(pe)&&!h&&typeof fetch=="function"?fetch(pe,{credentials:"same-origin"}).then(function(xe){var _e=WebAssembly.instantiateStreaming(xe,P);return _e.then(H,function(ke){return O("wasm streaming compile failed: "+ke),O("falling back to ArrayBuffer instantiation"),le(H)})}):le(H)}if(a.instantiateWasm)try{var ve=a.instantiateWasm(P,A);return ve}catch(xe){O("Module.instantiateWasm callback failed with error: "+xe),s(xe)}return he().catch(s),{}}function Pt(P){this.name="ExitStatus",this.message="Program terminated with exit("+P+")",this.status=P}function Ln(P){for(;P.length>0;)P.shift()(a)}function Sn(P){this.excPtr=P,this.ptr=P-24,this.set_type=function(A){te[this.ptr+4>>2]=A},this.get_type=function(){return te[this.ptr+4>>2]},this.set_destructor=function(A){te[this.ptr+8>>2]=A},this.get_destructor=function(){return te[this.ptr+8>>2]},this.set_refcount=function(A){re[this.ptr>>2]=A},this.set_caught=function(A){A=A?1:0,J[this.ptr+12>>0]=A},this.get_caught=function(){return J[this.ptr+12>>0]!=0},this.set_rethrown=function(A){A=A?1:0,J[this.ptr+13>>0]=A},this.get_rethrown=function(){return J[this.ptr+13>>0]!=0},this.init=function(A,H){this.set_adjusted_ptr(0),this.set_type(A),this.set_destructor(H),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var A=re[this.ptr>>2];re[this.ptr>>2]=A+1},this.release_ref=function(){var A=re[this.ptr>>2];return re[this.ptr>>2]=A-1,A===1},this.set_adjusted_ptr=function(A){te[this.ptr+16>>2]=A},this.get_adjusted_ptr=function(){return te[this.ptr+16>>2]},this.get_exception_ptr=function(){var A=de(this.get_type());if(A)return te[this.excPtr>>2];var H=this.get_adjusted_ptr();return H!==0?H:this.excPtr}}function Sr(P,A,H){var le=new Sn(P);throw le.init(A,H),P}var hn={};function kn(P){for(;P.length;){var A=P.pop(),H=P.pop();H(A)}}function Mn(P){return this.fromWireType(re[P>>2])}var Ae={},at={},ct={},kt=48,jt=57;function gn(P){if(P===void 0)return"_unknown";P=P.replace(/[^a-zA-Z0-9_]/g,"$");var A=P.charCodeAt(0);return A>=kt&&A<=jt?"_"+P:P}function Kn(P,A){return P=gn(P),new Function("body","return function "+P+`() {
    "use strict";    return body.apply(this, arguments);
};
`)(A)}function rn(P,A){var H=Kn(A,function(le){this.name=A,this.message=le;var he=new Error(le).stack;he!==void 0&&(this.stack=this.toString()+`
`+he.replace(/^Error(:[^\n]*)?\n/,""))});return H.prototype=Object.create(P.prototype),H.prototype.constructor=H,H.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},H}var Xt=void 0;function Un(P){throw new Xt(P)}function Bn(P,A,H){P.forEach(function(_e){ct[_e]=A});function le(_e){var ke=H(_e);ke.length!==P.length&&Un("Mismatched type converter count");for(var Xe=0;Xe<P.length;++Xe)Zr(P[Xe],ke[Xe])}var he=new Array(A.length),ve=[],xe=0;A.forEach((_e,ke)=>{at.hasOwnProperty(_e)?he[ke]=at[_e]:(ve.push(_e),Ae.hasOwnProperty(_e)||(Ae[_e]=[]),Ae[_e].push(()=>{he[ke]=at[_e],++xe,xe===ve.length&&le(he)}))}),ve.length===0&&le(he)}function pr(P){var A=hn[P];delete hn[P];var H=A.rawConstructor,le=A.rawDestructor,he=A.fields,ve=he.map(xe=>xe.getterReturnType).concat(he.map(xe=>xe.setterArgumentType));Bn([P],ve,xe=>{var _e={};return he.forEach((ke,Xe)=>{var gt=ke.fieldName,Nt=xe[Xe],_t=ke.getter,dn=ke.getterContext,pn=xe[Xe+he.length],lr=ke.setter,Gr=ke.setterContext;_e[gt]={read:ii=>Nt.fromWireType(_t(dn,ii)),write:(ii,ju)=>{var $s=[];lr(Gr,ii,pn.toWireType($s,ju)),kn($s)}}}),[{name:A.name,fromWireType:function(ke){var Xe={};for(var gt in _e)Xe[gt]=_e[gt].read(ke);return le(ke),Xe},toWireType:function(ke,Xe){for(var gt in _e)if(!(gt in Xe))throw new TypeError('Missing field:  "'+gt+'"');var Nt=H();for(gt in _e)_e[gt].write(Nt,Xe[gt]);return ke!==null&&ke.push(le,Nt),Nt},argPackAdvance:8,readValueFromPointer:Mn,destructorFunction:le}]})}function wi(P,A,H,le,he){}function Vn(P){switch(P){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+P)}}function mr(){for(var P=new Array(256),A=0;A<256;++A)P[A]=String.fromCharCode(A);Dt=P}var Dt=void 0;function Gt(P){for(var A="",H=P;ne[H];)A+=Dt[ne[H++]];return A}var Ut=void 0;function un(P){throw new Ut(P)}function Zr(P,A,H={}){if(!("argPackAdvance"in A))throw new TypeError("registerType registeredInstance requires argPackAdvance");var le=A.name;if(P||un('type "'+le+'" must have a positive integer typeid pointer'),at.hasOwnProperty(P)){if(H.ignoreDuplicateRegistrations)return;un("Cannot register type '"+le+"' twice")}if(at[P]=A,delete ct[P],Ae.hasOwnProperty(P)){var he=Ae[P];delete Ae[P],he.forEach(ve=>ve())}}function xo(P,A,H,le,he){var ve=Vn(H);A=Gt(A),Zr(P,{name:A,fromWireType:function(xe){return!!xe},toWireType:function(xe,_e){return _e?le:he},argPackAdvance:8,readValueFromPointer:function(xe){var _e;if(H===1)_e=J;else if(H===2)_e=F;else if(H===4)_e=re;else throw new TypeError("Unknown boolean type size: "+A);return this.fromWireType(_e[xe>>ve])},destructorFunction:null})}function Pl(P){if(!(this instanceof bo)||!(P instanceof bo))return!1;for(var A=this.$$.ptrType.registeredClass,H=this.$$.ptr,le=P.$$.ptrType.registeredClass,he=P.$$.ptr;A.baseClass;)H=A.upcast(H),A=A.baseClass;for(;le.baseClass;)he=le.upcast(he),le=le.baseClass;return A===le&&H===he}function os(P){return{count:P.count,deleteScheduled:P.deleteScheduled,preservePointerOnDelete:P.preservePointerOnDelete,ptr:P.ptr,ptrType:P.ptrType,smartPtr:P.smartPtr,smartPtrType:P.smartPtrType}}function Uo(P){function A(H){return H.$$.ptrType.registeredClass.name}un(A(P)+" instance already deleted")}var wo=!1;function Fo(P){}function zr(P){P.smartPtr?P.smartPtrType.rawDestructor(P.smartPtr):P.ptrType.registeredClass.rawDestructor(P.ptr)}function ba(P){P.count.value-=1;var A=P.count.value===0;A&&zr(P)}function Zt(P,A,H){if(A===H)return P;if(H.baseClass===void 0)return null;var le=Zt(P,A,H.baseClass);return le===null?null:H.downcast(le)}var Ui={};function kl(){return Object.keys(ja).length}function Fi(){var P=[];for(var A in ja)ja.hasOwnProperty(A)&&P.push(ja[A]);return P}var Va=[];function Bo(){for(;Va.length;){var P=Va.pop();P.$$.deleteScheduled=!1,P.delete()}}var $a=void 0;function Mu(P){$a=P,Va.length&&$a&&$a(Bo)}function Gc(){a.getInheritedInstanceCount=kl,a.getLiveInheritedInstances=Fi,a.flushPendingDeletes=Bo,a.setDelayFunction=Mu}var ja={};function Wc(P,A){for(A===void 0&&un("ptr should not be undefined");P.baseClass;)A=P.upcast(A),P=P.baseClass;return A}function bi(P,A){return A=Wc(P,A),ja[A]}function cc(P,A){(!A.ptrType||!A.ptr)&&Un("makeClassHandle requires ptr and ptrType");var H=!!A.smartPtrType,le=!!A.smartPtr;return H!==le&&Un("Both smartPtrType and smartPtr must be specified"),A.count={value:1},ia(Object.create(P,{$$:{value:A}}))}function lc(P){var A=this.getPointee(P);if(!A)return this.destructor(P),null;var H=bi(this.registeredClass,A);if(H!==void 0){if(H.$$.count.value===0)return H.$$.ptr=A,H.$$.smartPtr=P,H.clone();var le=H.clone();return this.destructor(P),le}function he(){return this.isSmartPointer?cc(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:A,smartPtrType:this,smartPtr:P}):cc(this.registeredClass.instancePrototype,{ptrType:this,ptr:P})}var ve=this.registeredClass.getActualType(A),xe=Ui[ve];if(!xe)return he.call(this);var _e;this.isConst?_e=xe.constPointerType:_e=xe.pointerType;var ke=Zt(A,this.registeredClass,_e.registeredClass);return ke===null?he.call(this):this.isSmartPointer?cc(_e.registeredClass.instancePrototype,{ptrType:_e,ptr:ke,smartPtrType:this,smartPtr:P}):cc(_e.registeredClass.instancePrototype,{ptrType:_e,ptr:ke})}function ia(P){return typeof FinalizationRegistry>"u"?(ia=A=>A,P):(wo=new FinalizationRegistry(A=>{ba(A.$$)}),ia=A=>{var H=A.$$,le=!!H.smartPtr;if(le){var he={$$:H};wo.register(A,he,A)}return A},Fo=A=>wo.unregister(A),ia(P))}function Hc(){if(this.$$.ptr||Uo(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var P=ia(Object.create(Object.getPrototypeOf(this),{$$:{value:os(this.$$)}}));return P.$$.count.value+=1,P.$$.deleteScheduled=!1,P}function Ns(){this.$$.ptr||Uo(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&un("Object already scheduled for deletion"),Fo(this),ba(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function ss(){return!this.$$.ptr}function Ru(){return this.$$.ptr||Uo(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&un("Object already scheduled for deletion"),Va.push(this),Va.length===1&&$a&&$a(Bo),this.$$.deleteScheduled=!0,this}function Er(){bo.prototype.isAliasOf=Pl,bo.prototype.clone=Hc,bo.prototype.delete=Ns,bo.prototype.isDeleted=ss,bo.prototype.deleteLater=Ru}function bo(){}function Al(P,A,H){if(P[A].overloadTable===void 0){var le=P[A];P[A]=function(){return P[A].overloadTable.hasOwnProperty(arguments.length)||un("Function '"+H+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+P[A].overloadTable+")!"),P[A].overloadTable[arguments.length].apply(this,arguments)},P[A].overloadTable=[],P[A].overloadTable[le.argCount]=le}}function Ps(P,A,H){a.hasOwnProperty(P)?(un("Cannot register public name '"+P+"' twice"),Al(a,P,P),a.hasOwnProperty(H)&&un("Cannot register multiple overloads of a function with the same number of arguments ("+H+")!"),a[P].overloadTable[H]=A):a[P]=A}function Ll(P,A,H,le,he,ve,xe,_e){this.name=P,this.constructor=A,this.instancePrototype=H,this.rawDestructor=le,this.baseClass=he,this.getActualType=ve,this.upcast=xe,this.downcast=_e,this.pureVirtualFunctions=[]}function So(P,A,H){for(;A!==H;)A.upcast||un("Expected null or instance of "+H.name+", got an instance of "+A.name),P=A.upcast(P),A=A.baseClass;return P}function Ud(P,A){if(A===null)return this.isReference&&un("null is not a valid "+this.name),0;A.$$||un('Cannot pass "'+ls(A)+'" as a '+this.name),A.$$.ptr||un("Cannot pass deleted object as a pointer of type "+this.name);var H=A.$$.ptrType.registeredClass,le=So(A.$$.ptr,H,this.registeredClass);return le}function Ua(P,A){var H;if(A===null)return this.isReference&&un("null is not a valid "+this.name),this.isSmartPointer?(H=this.rawConstructor(),P!==null&&P.push(this.rawDestructor,H),H):0;A.$$||un('Cannot pass "'+ls(A)+'" as a '+this.name),A.$$.ptr||un("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&A.$$.ptrType.isConst&&un("Cannot convert argument of type "+(A.$$.smartPtrType?A.$$.smartPtrType.name:A.$$.ptrType.name)+" to parameter type "+this.name);var le=A.$$.ptrType.registeredClass;if(H=So(A.$$.ptr,le,this.registeredClass),this.isSmartPointer)switch(A.$$.smartPtr===void 0&&un("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:A.$$.smartPtrType===this?H=A.$$.smartPtr:un("Cannot convert argument of type "+(A.$$.smartPtrType?A.$$.smartPtrType.name:A.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:H=A.$$.smartPtr;break;case 2:if(A.$$.smartPtrType===this)H=A.$$.smartPtr;else{var he=A.clone();H=this.rawShare(H,Go.toHandle(function(){he.delete()})),P!==null&&P.push(this.rawDestructor,H)}break;default:un("Unsupporting sharing policy")}return H}function Iu(P,A){if(A===null)return this.isReference&&un("null is not a valid "+this.name),0;A.$$||un('Cannot pass "'+ls(A)+'" as a '+this.name),A.$$.ptr||un("Cannot pass deleted object as a pointer of type "+this.name),A.$$.ptrType.isConst&&un("Cannot convert argument of type "+A.$$.ptrType.name+" to parameter type "+this.name);var H=A.$$.ptrType.registeredClass,le=So(A.$$.ptr,H,this.registeredClass);return le}function Df(P){return this.rawGetPointee&&(P=this.rawGetPointee(P)),P}function eo(P){this.rawDestructor&&this.rawDestructor(P)}function aa(P){P!==null&&P.delete()}function to(){oa.prototype.getPointee=Df,oa.prototype.destructor=eo,oa.prototype.argPackAdvance=8,oa.prototype.readValueFromPointer=Mn,oa.prototype.deleteObject=aa,oa.prototype.fromWireType=lc}function oa(P,A,H,le,he,ve,xe,_e,ke,Xe,gt){this.name=P,this.registeredClass=A,this.isReference=H,this.isConst=le,this.isSmartPointer=he,this.pointeeType=ve,this.sharingPolicy=xe,this.rawGetPointee=_e,this.rawConstructor=ke,this.rawShare=Xe,this.rawDestructor=gt,!he&&A.baseClass===void 0?le?(this.toWireType=Ud,this.destructorFunction=null):(this.toWireType=Iu,this.destructorFunction=null):this.toWireType=Ua}function ks(P,A,H){a.hasOwnProperty(P)||Un("Replacing nonexistant public symbol"),a[P].overloadTable!==void 0&&H!==void 0||(a[P]=A,a[P].argCount=H)}function uc(P,A,H){var le=a["dynCall_"+P];return H&&H.length?le.apply(null,[A].concat(H)):le.call(null,A)}var fc=[];function ui(P){var A=fc[P];return A||(P>=fc.length&&(fc.length=P+1),fc[P]=A=Te.get(P)),A}function Vl(P,A,H){if(P.includes("j"))return uc(P,A,H);var le=ui(A).apply(null,H);return le}function no(P,A){var H=[];return function(){return H.length=0,Object.assign(H,arguments),Vl(P,A,H)}}function sa(P,A){P=Gt(P);function H(){return P.includes("j")?no(P,A):ui(A)}var le=H();return typeof le!="function"&&un("unknown function pointer with signature "+P+": "+A),le}var dc=void 0;function cs(P){var A=At(P),H=Gt(A);return mt(A),H}function Sa(P,A){var H=[],le={};function he(ve){if(!le[ve]&&!at[ve]){if(ct[ve]){ct[ve].forEach(he);return}H.push(ve),le[ve]=!0}}throw A.forEach(he),new dc(P+": "+H.map(cs).join([", "]))}function Co(P,A,H,le,he,ve,xe,_e,ke,Xe,gt,Nt,_t){gt=Gt(gt),ve=sa(he,ve),_e&&(_e=sa(xe,_e)),Xe&&(Xe=sa(ke,Xe)),_t=sa(Nt,_t);var dn=gn(gt);Ps(dn,function(){Sa("Cannot construct "+gt+" due to unbound types",[le])}),Bn([P,A,H],le?[le]:[],function(pn){pn=pn[0];var lr,Gr;le?(lr=pn.registeredClass,Gr=lr.instancePrototype):Gr=bo.prototype;var ii=Kn(dn,function(){if(Object.getPrototypeOf(this)!==ju)throw new Ut("Use 'new' to construct "+gt);if($s.constructor_body===void 0)throw new Ut(gt+" has no accessible constructor");var H2=$s.constructor_body[arguments.length];if(H2===void 0)throw new Ut("Tried to invoke ctor of "+gt+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys($s.constructor_body).toString()+") parameters instead!");return H2.apply(this,arguments)}),ju=Object.create(Gr,{constructor:{value:ii}});ii.prototype=ju;var $s=new Ll(gt,ii,ju,_t,lr,ve,_e,Xe),Gl=new oa(gt,$s,!0,!1,!1),kh=new oa(gt+"*",$s,!1,!1,!1),W2=new oa(gt+" const*",$s,!1,!0,!1);return Ui[P]={pointerType:kh,constPointerType:W2},ks(dn,ii),[Gl,kh,W2]})}function As(P,A){for(var H=[],le=0;le<P;le++)H.push(te[A+le*4>>2]);return H}function Nu(P,A){if(!(P instanceof Function))throw new TypeError("new_ called with constructor type "+typeof P+" which is not a function");var H=Kn(P.name||"unknownFunctionName",function(){});H.prototype=P.prototype;var le=new H,he=P.apply(le,A);return he instanceof Object?he:le}function hc(P,A,H,le,he){var ve=A.length;ve<2&&un("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var xe=A[1]!==null&&H!==null,_e=!1,ke=1;ke<A.length;++ke)if(A[ke]!==null&&A[ke].destructorFunction===void 0){_e=!0;break}for(var Xe=A[0].name!=="void",gt="",Nt="",ke=0;ke<ve-2;++ke)gt+=(ke!==0?", ":"")+"arg"+ke,Nt+=(ke!==0?", ":"")+"arg"+ke+"Wired";var _t="return function "+gn(P)+"("+gt+`) {
if (arguments.length !== `+(ve-2)+`) {
throwBindingError('function `+P+" called with ' + arguments.length + ' arguments, expected "+(ve-2)+` args!');
}
`;_e&&(_t+=`var destructors = [];
`);var dn=_e?"destructors":"null",pn=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],lr=[un,le,he,kn,A[0],A[1]];xe&&(_t+="var thisWired = classParam.toWireType("+dn+`, this);
`);for(var ke=0;ke<ve-2;++ke)_t+="var arg"+ke+"Wired = argType"+ke+".toWireType("+dn+", arg"+ke+"); // "+A[ke+2].name+`
`,pn.push("argType"+ke),lr.push(A[ke+2]);if(xe&&(Nt="thisWired"+(Nt.length>0?", ":"")+Nt),_t+=(Xe?"var rv = ":"")+"invoker(fn"+(Nt.length>0?", ":"")+Nt+`);
`,_e)_t+=`runDestructors(destructors);
`;else for(var ke=xe?1:2;ke<A.length;++ke){var Gr=ke===1?"thisWired":"arg"+(ke-2)+"Wired";A[ke].destructorFunction!==null&&(_t+=Gr+"_dtor("+Gr+"); // "+A[ke].name+`
`,pn.push(Gr+"_dtor"),lr.push(A[ke].destructorFunction))}Xe&&(_t+=`var ret = retType.fromWireType(rv);
return ret;
`),_t+=`}
`,pn.push(_t);var ii=Nu(Function,pn).apply(null,lr);return ii}function jr(P,A,H,le,he,ve){k(A>0);var xe=As(A,H);he=sa(le,he),Bn([],[P],function(_e){_e=_e[0];var ke="constructor "+_e.name;if(_e.registeredClass.constructor_body===void 0&&(_e.registeredClass.constructor_body=[]),_e.registeredClass.constructor_body[A-1]!==void 0)throw new Ut("Cannot register multiple constructors with identical number of parameters ("+(A-1)+") for class '"+_e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return _e.registeredClass.constructor_body[A-1]=()=>{Sa("Cannot construct "+_e.name+" due to unbound types",xe)},Bn([],xe,function(Xe){return Xe.splice(1,0,null),_e.registeredClass.constructor_body[A-1]=hc(ke,Xe,null,he,ve),[]}),[]})}function zo(P,A,H,le,he,ve,xe,_e){var ke=As(H,le);A=Gt(A),ve=sa(he,ve),Bn([],[P],function(Xe){Xe=Xe[0];var gt=Xe.name+"."+A;A.startsWith("@@")&&(A=Symbol[A.substring(2)]),_e&&Xe.registeredClass.pureVirtualFunctions.push(A);function Nt(){Sa("Cannot call "+gt+" due to unbound types",ke)}var _t=Xe.registeredClass.instancePrototype,dn=_t[A];return dn===void 0||dn.overloadTable===void 0&&dn.className!==Xe.name&&dn.argCount===H-2?(Nt.argCount=H-2,Nt.className=Xe.name,_t[A]=Nt):(Al(_t,A,gt),_t[A].overloadTable[H-2]=Nt),Bn([],ke,function(pn){var lr=hc(gt,pn,Xe,ve,xe);return _t[A].overloadTable===void 0?(lr.argCount=H-2,_t[A]=lr):_t[A].overloadTable[H-2]=lr,[]}),[]})}var Ur=[],Si=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function gc(P){P>4&&--Si[P].refcount===0&&(Si[P]=void 0,Ur.push(P))}function Ci(){for(var P=0,A=5;A<Si.length;++A)Si[A]!==void 0&&++P;return P}function Pu(){for(var P=5;P<Si.length;++P)if(Si[P]!==void 0)return Si[P];return null}function Bi(){a.count_emval_handles=Ci,a.get_first_emval=Pu}var Go={toValue:P=>(P||un("Cannot use deleted val. handle = "+P),Si[P].value),toHandle:P=>{switch(P){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var A=Ur.length?Ur.pop():Si.length;return Si[A]={refcount:1,value:P},A}}}};function pc(P,A){A=Gt(A),Zr(P,{name:A,fromWireType:function(H){var le=Go.toValue(H);return gc(H),le},toWireType:function(H,le){return Go.toHandle(le)},argPackAdvance:8,readValueFromPointer:Mn,destructorFunction:null})}function ls(P){if(P===null)return"null";var A=typeof P;return A==="object"||A==="array"||A==="function"?P.toString():""+P}function Fa(P,A){switch(A){case 2:return function(H){return this.fromWireType(ye[H>>2])};case 3:return function(H){return this.fromWireType(we[H>>3])};default:throw new TypeError("Unknown float type: "+P)}}function zi(P,A,H){var le=Vn(H);A=Gt(A),Zr(P,{name:A,fromWireType:function(he){return he},toWireType:function(he,ve){return ve},argPackAdvance:8,readValueFromPointer:Fa(A,le),destructorFunction:null})}function Ls(P,A,H){switch(A){case 0:return H?function(he){return J[he]}:function(he){return ne[he]};case 1:return H?function(he){return F[he>>1]}:function(he){return ae[he>>1]};case 2:return H?function(he){return re[he>>2]}:function(he){return te[he>>2]};default:throw new TypeError("Unknown integer type: "+P)}}function $l(P,A,H,le,he){A=Gt(A);var ve=Vn(H),xe=Nt=>Nt;if(le===0){var _e=32-8*H;xe=Nt=>Nt<<_e>>>_e}var ke=A.includes("unsigned"),Xe=(Nt,_t)=>{},gt;ke?gt=function(Nt,_t){return Xe(_t,this.name),_t>>>0}:gt=function(Nt,_t){return Xe(_t,this.name),_t},Zr(P,{name:A,fromWireType:xe,toWireType:gt,argPackAdvance:8,readValueFromPointer:Ls(A,ve,le!==0),destructorFunction:null})}function mc(P,A,H){var le=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],he=le[A];function ve(xe){xe=xe>>2;var _e=te,ke=_e[xe],Xe=_e[xe+1];return new he(Y,Xe,ke)}H=Gt(H),Zr(P,{name:H,fromWireType:ve,argPackAdvance:8,readValueFromPointer:ve},{ignoreDuplicateRegistrations:!0})}function qc(P,A){A=Gt(A);var H=A==="std::string";Zr(P,{name:A,fromWireType:function(le){var he=te[le>>2],ve=le+4,xe;if(H)for(var _e=ve,ke=0;ke<=he;++ke){var Xe=ve+ke;if(ke==he||ne[Xe]==0){var gt=Xe-_e,Nt=W(_e,gt);xe===void 0?xe=Nt:(xe+="\0",xe+=Nt),_e=Xe+1}}else{for(var _t=new Array(he),ke=0;ke<he;++ke)_t[ke]=String.fromCharCode(ne[ve+ke]);xe=_t.join("")}return mt(le),xe},toWireType:function(le,he){he instanceof ArrayBuffer&&(he=new Uint8Array(he));var ve,xe=typeof he=="string";xe||he instanceof Uint8Array||he instanceof Uint8ClampedArray||he instanceof Int8Array||un("Cannot pass non-string to std::string"),H&&xe?ve=U(he):ve=he.length;var _e=tt(4+ve+1),ke=_e+4;if(te[_e>>2]=ve,H&&xe)oe(he,ke,ve+1);else if(xe)for(var Xe=0;Xe<ve;++Xe){var gt=he.charCodeAt(Xe);gt>255&&(mt(ke),un("String has UTF-16 code units that do not fit in 8 bits")),ne[ke+Xe]=gt}else for(var Xe=0;Xe<ve;++Xe)ne[ke+Xe]=he[Xe];return le!==null&&le.push(mt,_e),_e},argPackAdvance:8,readValueFromPointer:Mn,destructorFunction:function(le){mt(le)}})}var jl=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Kc(P,A){for(var H=P,le=H>>1,he=le+A/2;!(le>=he)&&ae[le];)++le;if(H=le<<1,H-P>32&&jl)return jl.decode(ne.subarray(P,H));for(var ve="",xe=0;!(xe>=A/2);++xe){var _e=F[P+xe*2>>1];if(_e==0)break;ve+=String.fromCharCode(_e)}return ve}function Yc(P,A,H){if(H===void 0&&(H=2147483647),H<2)return 0;H-=2;for(var le=A,he=H<P.length*2?H/2:P.length,ve=0;ve<he;++ve){var xe=P.charCodeAt(ve);F[A>>1]=xe,A+=2}return F[A>>1]=0,A-le}function Ul(P){return P.length*2}function Mf(P,A){for(var H=0,le="";!(H>=A/4);){var he=re[P+H*4>>2];if(he==0)break;if(++H,he>=65536){var ve=he-65536;le+=String.fromCharCode(55296|ve>>10,56320|ve&1023)}else le+=String.fromCharCode(he)}return le}function Fd(P,A,H){if(H===void 0&&(H=2147483647),H<4)return 0;for(var le=A,he=le+H-4,ve=0;ve<P.length;++ve){var xe=P.charCodeAt(ve);if(xe>=55296&&xe<=57343){var _e=P.charCodeAt(++ve);xe=65536+((xe&1023)<<10)|_e&1023}if(re[A>>2]=xe,A+=4,A+4>he)break}return re[A>>2]=0,A-le}function Bd(P){for(var A=0,H=0;H<P.length;++H){var le=P.charCodeAt(H);le>=55296&&le<=57343&&++H,A+=4}return A}function zd(P,A,H){H=Gt(H);var le,he,ve,xe,_e;A===2?(le=Kc,he=Yc,xe=Ul,ve=()=>ae,_e=1):A===4&&(le=Mf,he=Fd,xe=Bd,ve=()=>te,_e=2),Zr(P,{name:H,fromWireType:function(ke){for(var Xe=te[ke>>2],gt=ve(),Nt,_t=ke+4,dn=0;dn<=Xe;++dn){var pn=ke+4+dn*A;if(dn==Xe||gt[pn>>_e]==0){var lr=pn-_t,Gr=le(_t,lr);Nt===void 0?Nt=Gr:(Nt+="\0",Nt+=Gr),_t=pn+A}}return mt(ke),Nt},toWireType:function(ke,Xe){typeof Xe!="string"&&un("Cannot pass non-string to C++ string type "+H);var gt=xe(Xe),Nt=tt(4+gt+A);return te[Nt>>2]=gt>>_e,he(Xe,Nt+4,gt+A),ke!==null&&ke.push(mt,Nt),Nt},argPackAdvance:8,readValueFromPointer:Mn,destructorFunction:function(ke){mt(ke)}})}function ku(P,A,H,le,he,ve){hn[P]={name:Gt(A),rawConstructor:sa(H,le),rawDestructor:sa(he,ve),fields:[]}}function Rf(P,A,H,le,he,ve,xe,_e,ke,Xe){hn[P].fields.push({fieldName:Gt(A),getterReturnType:H,getter:sa(le,he),getterContext:ve,setterArgumentType:xe,setter:sa(_e,ke),setterContext:Xe})}function Gd(P,A){A=Gt(A),Zr(P,{isVoid:!0,name:A,argPackAdvance:0,fromWireType:function(){},toWireType:function(H,le){}})}function If(){throw 1/0}var Nf={};function Wd(P){var A=Nf[P];return A===void 0?Gt(P):A}function Fl(){return typeof globalThis=="object"?globalThis:(function(){return Function})()("return this")()}function Pf(P){return P===0?Go.toHandle(Fl()):(P=Wd(P),Go.toHandle(Fl()[P]))}function kf(P){P>4&&(Si[P].refcount+=1)}function Au(P,A){var H=at[P];return H===void 0&&un(A+" has unknown type "+cs(P)),H}function Hd(P){for(var A="",H=0;H<P;++H)A+=(H!==0?", ":"")+"arg"+H;for(var le=()=>te,he="return function emval_allocator_"+P+`(constructor, argTypes, args) {
  var HEAPU32 = getMemory();
`,H=0;H<P;++H)he+="var argType"+H+" = requireRegisteredType(HEAPU32[((argTypes)>>2)], 'parameter "+H+`');
var arg`+H+" = argType"+H+`.readValueFromPointer(args);
args += argType`+H+`['argPackAdvance'];
argTypes += 4;
`;return he+="var obj = new constructor("+A+`);
return valueToHandle(obj);
}
`,new Function("requireRegisteredType","Module","valueToHandle","getMemory",he)(Au,a,Go.toHandle,le)}var Bl={};function qd(P,A,H,le){P=Go.toValue(P);var he=Bl[A];return he||(he=Hd(A),Bl[A]=he),he(P,H,le)}function Af(P,A){P=Au(P,"_emval_take_value");var H=P.readValueFromPointer(A);return Go.toHandle(H)}function Kd(){B("")}function Lf(P,A,H){ne.copyWithin(P,A,A+H)}function Yd(){return 2147483648}function Xd(P){try{return I.grow(P-Y.byteLength+65535>>>16),Oe(I.buffer),1}catch{}}function Lu(P){var A=ne.length;P=P>>>0;var H=Yd();if(P>H)return!1;let le=(ke,Xe)=>ke+(Xe-ke%Xe)%Xe;for(var he=1;he<=4;he*=2){var ve=A*(1+.2/he);ve=Math.min(ve,P+100663296);var xe=Math.min(H,le(Math.max(P,ve),65536)),_e=Xd(xe);if(_e)return!0}return!1}var Vu={};function Vs(){return l||"./this.program"}function vc(){if(!vc.strings){var P=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",A={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:P,_:Vs()};for(var H in Vu)Vu[H]===void 0?delete A[H]:A[H]=Vu[H];var le=[];for(var H in A)le.push(H+"="+A[H]);vc.strings=le}return vc.strings}function Wo(P,A,H){for(var le=0;le<P.length;++le)J[A++>>0]=P.charCodeAt(le);J[A>>0]=0}function Vf(P,A){var H=0;return vc().forEach(function(le,he){var ve=A+H;te[P+he*4>>2]=ve,Wo(le,ve),H+=le.length+1}),0}function $f(P,A){var H=vc();te[P>>2]=H.length;var le=0;return H.forEach(function(he){le+=he.length+1}),te[A>>2]=le,0}function Xc(P){u(P,new Pt(P))}function yc(P,A){Xc(P)}var zl=yc;function $u(P){return 52}function Q(P,A,H,le,he){return 70}var ee=[null,[],[]];function me(P,A){var H=ee[P];A===0||A===10?((P===1?T:O)($(H,0)),H.length=0):H.push(A)}function Pe(P,A,H,le){for(var he=0,ve=0;ve<H;ve++){var xe=te[A>>2],_e=te[A+4>>2];A+=8;for(var ke=0;ke<_e;ke++)me(P,ne[xe+ke]);he+=_e}return te[le>>2]=he,0}function Be(P){var A=a["_"+P];return A}function Qe(P,A){J.set(P,A)}function Je(P,A,H,le,he){var ve={string:pn=>{var lr=0;if(pn!=null&&pn!==0){var Gr=(pn.length<<2)+1;lr=q(Gr),oe(pn,lr,Gr)}return lr},array:pn=>{var lr=q(pn.length);return Qe(pn,lr),lr}};function xe(pn){return A==="string"?W(pn):A==="boolean"?!!pn:pn}var _e=Be(P),ke=[],Xe=0;if(le)for(var gt=0;gt<le.length;gt++){var Nt=ve[H[gt]];Nt?(Xe===0&&(Xe=an()),ke[gt]=Nt(le[gt])):ke[gt]=le[gt]}var _t=_e.apply(null,ke);function dn(pn){return Xe!==0&&X(Xe),xe(pn)}return _t=dn(_t),_t}Xt=a.InternalError=rn(Error,"InternalError"),mr(),Ut=a.BindingError=rn(Error,"BindingError"),Er(),Gc(),to(),dc=a.UnboundTypeError=rn(Error,"UnboundTypeError"),Bi();var Ge={g:Sr,A:pr,w:wi,F:xo,u:Co,t:jr,c:zo,E:pc,m:zi,b:$l,a:mc,l:qc,h:zd,J:ku,d:Rf,G:Gd,x:If,i:gc,r:Pf,p:kf,q:qd,s:Af,j:Kd,D:Lf,y:Lu,z:Vf,B:$f,I:zl,C:$u,v:Q,k:Pe,o:Ue,n:qe,H:Ze,f:Ee,e:ot};wt(),a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.L).apply(null,arguments)};var tt=a._malloc=function(){return(tt=a._malloc=a.asm.N).apply(null,arguments)},mt=a._free=function(){return(mt=a._free=a.asm.O).apply(null,arguments)},At=a.___getTypeName=function(){return(At=a.___getTypeName=a.asm.P).apply(null,arguments)};a.__embind_initialize_bindings=function(){return(a.__embind_initialize_bindings=a.asm.Q).apply(null,arguments)};var Wt=a._setThrew=function(){return(Wt=a._setThrew=a.asm.R).apply(null,arguments)},an=a.stackSave=function(){return(an=a.stackSave=a.asm.S).apply(null,arguments)},X=a.stackRestore=function(){return(X=a.stackRestore=a.asm.T).apply(null,arguments)},q=a.stackAlloc=function(){return(q=a.stackAlloc=a.asm.U).apply(null,arguments)},de=a.___cxa_is_pointer_type=function(){return(de=a.___cxa_is_pointer_type=a.asm.V).apply(null,arguments)};a.dynCall_jiji=function(){return(a.dynCall_jiji=a.asm.W).apply(null,arguments)};function Ee(P,A){var H=an();try{ui(P)(A)}catch(le){if(X(H),le!==le+0)throw le;Wt(1,0)}}function Ue(P,A){var H=an();try{return ui(P)(A)}catch(le){if(X(H),le!==le+0)throw le;Wt(1,0)}}function ot(P,A,H,le){var he=an();try{ui(P)(A,H,le)}catch(ve){if(X(he),ve!==ve+0)throw ve;Wt(1,0)}}function Ze(P,A,H,le){var he=an();try{return ui(P)(A,H,le)}catch(ve){if(X(he),ve!==ve+0)throw ve;Wt(1,0)}}function qe(P,A,H){var le=an();try{return ui(P)(A,H)}catch(he){if(X(le),he!==he+0)throw he;Wt(1,0)}}a.ccall=Je;var j;tr=function P(){j||z(),j||(tr=P)};function z(P){if(en>0||(ft(),en>0))return;function A(){j||(j=!0,a.calledRun=!0,!V&&(je(),o(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),It()))}a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),A()},1)):A()}if(a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return z(),i.ready})})();t.exports=n})(yI)),yI.exports}var WFt=GFt();const HFt=ka(WFt),qFt=new URL("/assets/libjpegturbowasm_decode-daqMmuVl.wasm",import.meta.url),t_={codec:void 0,decoder:void 0};function KFt(){if(t_.codec)return Promise.resolve();const t=HFt({locateFile:e=>e.endsWith(".wasm")?qFt.toString():e});return new Promise((e,n)=>{t.then(r=>{t_.codec=r,t_.decoder=new r.JPEGDecoder,e()},n)})}async function YFt(t,e){await KFt();const n=t_.decoder;n.getEncodedBuffer(t.length).set(t),n.decode();const i=n.getFrameInfo(),a=n.getDecodedBuffer(),o={columns:i.width,rows:i.height,bitsPerPixel:i.bitsPerSample,signed:e.signed,bytesPerPixel:e.bytesPerPixel,componentsPerPixel:i.componentCount},s=XFt(i,a),c={frameInfo:i};return{...e,pixelData:s,imageInfo:o,encodeOptions:c,...c,...o}}function XFt(t,e){return t.isSigned?new Int8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}const ZFt="modulepreload",QFt=function(t){return"/"+t},vre={},fCe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let c=function(l){return Promise.all(l.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),s=o?.nonce||o?.getAttribute("nonce");i=c(n.map(l=>{if(l=QFt(l),l in vre)return;vre[l]=!0;const u=l.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${f}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":ZFt,u||(d.as="script"),d.crossOrigin="",d.href=l,s&&d.setAttribute("nonce",s),document.head.appendChild(d),u)return new Promise((h,m)=>{d.addEventListener("load",h),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function a(o){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o}return i.then(o=>{for(const s of o||[])s.status==="rejected"&&a(s.reason);return e().catch(a)})},rw={JpegImage:void 0,decodeConfig:{}};function JFt(t){return rw.decodeConfig=t,rw.JpegImage?Promise.resolve():new Promise((e,n)=>{fCe(()=>import("./jpeg-B-x1txLf.js"),[]).then(r=>{rw.JpegImage=r.default,e()}).catch(n)})}async function eBt(t,e){if(await JFt(),typeof rw.JpegImage>"u")throw new Error("No JPEG Baseline decoder loaded");const n=new rw.JpegImage;if(n.parse(e),n.colorTransform=!1,t.bitsAllocated===8)return t.pixelData=n.getData(t.columns,t.rows),t;if(t.bitsAllocated===16)return t.pixelData=n.getData16(t.columns,t.rows),t}const iw={DecoderClass:void 0,decodeConfig:{}};function tBt(t){return iw.decodeConfig=t,iw.DecoderClass?Promise.resolve():new Promise((e,n)=>{fCe(async()=>{const{Decoder:r}=await import("./lossless-CyYqoyFe.js");return{Decoder:r}},[]).then(({Decoder:r})=>{iw.DecoderClass=r,e()},n)})}async function yre(t,e){if(await tBt(),typeof iw.DecoderClass>"u")throw new Error("No JPEG Lossless decoder loaded");const n=new iw.DecoderClass,r=t.bitsAllocated<=8?1:2,i=e.buffer,a=n.decode(i,e.byteOffset,e.length,r);return t.pixelRepresentation===0?t.bitsAllocated===16?(t.pixelData=new Uint16Array(a.buffer),t):(t.pixelData=new Uint8Array(a.buffer),t):(t.pixelData=new Int16Array(a.buffer),t)}var xI={exports:{}},xre;function nBt(){return xre||(xre=1,(function(t,e){var n=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),(function(i){i=i||{};var a=typeof i<"u"?i:{},o,s;a.ready=new Promise(function(Q,ee){o=Q,s=ee});var c=Object.assign({},a),l=typeof window=="object",u=typeof importScripts=="function",f=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",d="";function h(Q){return a.locateFile?a.locateFile(Q,d):d+Q}var m,p,y;if(f){var x=Cd,S=Cd;u?d=S.dirname(d)+"/":d=__dirname+"/",m=(Q,ee)=>(Q=B(Q)?new URL(Q):S.normalize(Q),x.readFileSync(Q,ee?void 0:"utf8")),y=Q=>{var ee=m(Q,!0);return ee.buffer||(ee=new Uint8Array(ee)),ee},p=(Q,ee,me)=>{Q=B(Q)?new URL(Q):S.normalize(Q),x.readFile(Q,function(Pe,Be){Pe?me(Pe):ee(Be.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(Q){if(!(Q instanceof Re))throw Q}),process.on("unhandledRejection",function(Q){throw Q}),a.inspect=function(){return"[Emscripten Module object]"}}else(l||u)&&(u?d=self.location.href:typeof document<"u"&&document.currentScript&&(d=document.currentScript.src),r&&(d=r),d.indexOf("blob:")!==0?d=d.substr(0,d.replace(/[?#].*/,"").lastIndexOf("/")+1):d="",m=Q=>{var ee=new XMLHttpRequest;return ee.open("GET",Q,!1),ee.send(null),ee.responseText},u&&(y=Q=>{var ee=new XMLHttpRequest;return ee.open("GET",Q,!1),ee.responseType="arraybuffer",ee.send(null),new Uint8Array(ee.response)}),p=(Q,ee,me)=>{var Pe=new XMLHttpRequest;Pe.open("GET",Q,!0),Pe.responseType="arraybuffer",Pe.onload=()=>{if(Pe.status==200||Pe.status==0&&Pe.response){ee(Pe.response);return}me()},Pe.onerror=me,Pe.send(null)});a.print||console.log.bind(console);var C=a.printErr||console.warn.bind(console);Object.assign(a,c),c=null,a.arguments&&a.arguments,a.thisProgram&&a.thisProgram,a.quit&&a.quit;var _;a.wasmBinary&&(_=a.wasmBinary),a.noExitRuntime,typeof WebAssembly!="object"&&tr("no native wasm support detected");var T,O=!1;function M(Q,ee){Q||tr(ee)}var I=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function V(Q,ee,me){for(var Pe=ee+me,Be=ee;Q[Be]&&!(Be>=Pe);)++Be;if(Be-ee>16&&Q.buffer&&I)return I.decode(Q.subarray(ee,Be));for(var Qe="";ee<Be;){var Je=Q[ee++];if(!(Je&128)){Qe+=String.fromCharCode(Je);continue}var Ge=Q[ee++]&63;if((Je&224)==192){Qe+=String.fromCharCode((Je&31)<<6|Ge);continue}var tt=Q[ee++]&63;if((Je&240)==224?Je=(Je&15)<<12|Ge<<6|tt:Je=(Je&7)<<18|Ge<<12|tt<<6|Q[ee++]&63,Je<65536)Qe+=String.fromCharCode(Je);else{var mt=Je-65536;Qe+=String.fromCharCode(55296|mt>>10,56320|mt&1023)}}return Qe}function k(Q,ee){return Q?V(U,Q,ee):""}function L(Q,ee,me,Pe){if(!(Pe>0))return 0;for(var Be=me,Qe=me+Pe-1,Je=0;Je<Q.length;++Je){var Ge=Q.charCodeAt(Je);if(Ge>=55296&&Ge<=57343){var tt=Q.charCodeAt(++Je);Ge=65536+((Ge&1023)<<10)|tt&1023}if(Ge<=127){if(me>=Qe)break;ee[me++]=Ge}else if(Ge<=2047){if(me+1>=Qe)break;ee[me++]=192|Ge>>6,ee[me++]=128|Ge&63}else if(Ge<=65535){if(me+2>=Qe)break;ee[me++]=224|Ge>>12,ee[me++]=128|Ge>>6&63,ee[me++]=128|Ge&63}else{if(me+3>=Qe)break;ee[me++]=240|Ge>>18,ee[me++]=128|Ge>>12&63,ee[me++]=128|Ge>>6&63,ee[me++]=128|Ge&63}}return ee[me]=0,me-Be}function $(Q,ee,me){return L(Q,U,ee,me)}function W(Q){for(var ee=0,me=0;me<Q.length;++me){var Pe=Q.charCodeAt(me);Pe<=127?ee++:Pe<=2047?ee+=2:Pe>=55296&&Pe<=57343?(ee+=4,++me):ee+=3}return ee}var G,oe,U,Y,J,ne,F,ae,re;function te(Q){G=Q,a.HEAP8=oe=new Int8Array(Q),a.HEAP16=Y=new Int16Array(Q),a.HEAP32=ne=new Int32Array(Q),a.HEAPU8=U=new Uint8Array(Q),a.HEAPU16=J=new Uint16Array(Q),a.HEAPU32=F=new Uint32Array(Q),a.HEAPF32=ae=new Float32Array(Q),a.HEAPF64=re=new Float64Array(Q)}a.INITIAL_MEMORY;var ye,we=[],Oe=[],Te=[];function Me(){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)ft(a.preRun.shift());et(we)}function be(){et(Oe)}function Ye(){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;)It(a.postRun.shift());et(Te)}function ft(Q){we.unshift(Q)}function je(Q){Oe.unshift(Q)}function It(Q){Te.unshift(Q)}var Rt=0,cn=null;function ln(Q){Rt++,a.monitorRunDependencies&&a.monitorRunDependencies(Rt)}function en(Q){if(Rt--,a.monitorRunDependencies&&a.monitorRunDependencies(Rt),Rt==0&&cn){var ee=cn;cn=null,ee()}}function tr(Q){a.onAbort&&a.onAbort(Q),Q="Aborted("+Q+")",C(Q),O=!0,Q+=". Build with -sASSERTIONS for more info.";var ee=new WebAssembly.RuntimeError(Q);throw s(ee),ee}var Ke="data:application/octet-stream;base64,";function ue(Q){return Q.startsWith(Ke)}function B(Q){return Q.startsWith("file://")}var K;K="charlswasm_decode.wasm",ue(K)||(K=h(K));function fe(Q){try{if(Q==K&&_)return new Uint8Array(_);if(y)return y(Q);throw"both async and sync fetching of the wasm failed"}catch(ee){tr(ee)}}function ie(){if(!_&&(l||u)){if(typeof fetch=="function"&&!B(K))return fetch(K,{credentials:"same-origin"}).then(function(Q){if(!Q.ok)throw"failed to load wasm binary file at '"+K+"'";return Q.arrayBuffer()}).catch(function(){return fe(K)});if(p)return new Promise(function(Q,ee){p(K,function(me){Q(new Uint8Array(me))},ee)})}return Promise.resolve().then(function(){return fe(K)})}function pe(){var Q={a:Vu};function ee(Je,Ge){var tt=Je.exports;a.asm=tt,T=a.asm.z,te(T.buffer),ye=a.asm.C,je(a.asm.A),en()}ln();function me(Je){ee(Je.instance)}function Pe(Je){return ie().then(function(Ge){return WebAssembly.instantiate(Ge,Q)}).then(function(Ge){return Ge}).then(Je,function(Ge){C("failed to asynchronously prepare wasm: "+Ge),tr(Ge)})}function Be(){return!_&&typeof WebAssembly.instantiateStreaming=="function"&&!ue(K)&&!B(K)&&!f&&typeof fetch=="function"?fetch(K,{credentials:"same-origin"}).then(function(Je){var Ge=WebAssembly.instantiateStreaming(Je,Q);return Ge.then(me,function(tt){return C("wasm streaming compile failed: "+tt),C("falling back to ArrayBuffer instantiation"),Pe(me)})}):Pe(me)}if(a.instantiateWasm)try{var Qe=a.instantiateWasm(Q,ee);return Qe}catch(Je){C("Module.instantiateWasm callback failed with error: "+Je),s(Je)}return Be().catch(s),{}}function Re(Q){this.name="ExitStatus",this.message="Program terminated with exit("+Q+")",this.status=Q}function et(Q){for(;Q.length>0;)Q.shift()(a)}function wt(Q){this.excPtr=Q,this.ptr=Q-24,this.set_type=function(ee){F[this.ptr+4>>2]=ee},this.get_type=function(){return F[this.ptr+4>>2]},this.set_destructor=function(ee){F[this.ptr+8>>2]=ee},this.get_destructor=function(){return F[this.ptr+8>>2]},this.set_refcount=function(ee){ne[this.ptr>>2]=ee},this.set_caught=function(ee){ee=ee?1:0,oe[this.ptr+12>>0]=ee},this.get_caught=function(){return oe[this.ptr+12>>0]!=0},this.set_rethrown=function(ee){ee=ee?1:0,oe[this.ptr+13>>0]=ee},this.get_rethrown=function(){return oe[this.ptr+13>>0]!=0},this.init=function(ee,me){this.set_adjusted_ptr(0),this.set_type(ee),this.set_destructor(me),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var ee=ne[this.ptr>>2];ne[this.ptr>>2]=ee+1},this.release_ref=function(){var ee=ne[this.ptr>>2];return ne[this.ptr>>2]=ee-1,ee===1},this.set_adjusted_ptr=function(ee){F[this.ptr+16>>2]=ee},this.get_adjusted_ptr=function(){return F[this.ptr+16>>2]},this.get_exception_ptr=function(){var ee=yc(this.get_type());if(ee)return F[this.excPtr>>2];var me=this.get_adjusted_ptr();return me!==0?me:this.excPtr}}function Pt(Q,ee,me){var Pe=new wt(Q);throw Pe.init(ee,me),Q}var Ln={};function Sn(Q){for(;Q.length;){var ee=Q.pop(),me=Q.pop();me(ee)}}function Sr(Q){return this.fromWireType(ne[Q>>2])}var hn={},kn={},Mn={},Ae=48,at=57;function ct(Q){if(Q===void 0)return"_unknown";Q=Q.replace(/[^a-zA-Z0-9_]/g,"$");var ee=Q.charCodeAt(0);return ee>=Ae&&ee<=at?"_"+Q:Q}function kt(Q,ee){return Q=ct(Q),new Function("body","return function "+Q+`() {
    "use strict";    return body.apply(this, arguments);
};
`)(ee)}function jt(Q,ee){var me=kt(ee,function(Pe){this.name=ee,this.message=Pe;var Be=new Error(Pe).stack;Be!==void 0&&(this.stack=this.toString()+`
`+Be.replace(/^Error(:[^\n]*)?\n/,""))});return me.prototype=Object.create(Q.prototype),me.prototype.constructor=me,me.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},me}var gn=void 0;function Kn(Q){throw new gn(Q)}function rn(Q,ee,me){Q.forEach(function(Ge){Mn[Ge]=ee});function Pe(Ge){var tt=me(Ge);tt.length!==Q.length&&Kn("Mismatched type converter count");for(var mt=0;mt<Q.length;++mt)Gt(Q[mt],tt[mt])}var Be=new Array(ee.length),Qe=[],Je=0;ee.forEach((Ge,tt)=>{kn.hasOwnProperty(Ge)?Be[tt]=kn[Ge]:(Qe.push(Ge),hn.hasOwnProperty(Ge)||(hn[Ge]=[]),hn[Ge].push(()=>{Be[tt]=kn[Ge],++Je,Je===Qe.length&&Pe(Be)}))}),Qe.length===0&&Pe(Be)}function Xt(Q){var ee=Ln[Q];delete Ln[Q];var me=ee.rawConstructor,Pe=ee.rawDestructor,Be=ee.fields,Qe=Be.map(Je=>Je.getterReturnType).concat(Be.map(Je=>Je.setterArgumentType));rn([Q],Qe,Je=>{var Ge={};return Be.forEach((tt,mt)=>{var At=tt.fieldName,Wt=Je[mt],an=tt.getter,X=tt.getterContext,q=Je[mt+Be.length],de=tt.setter,Ee=tt.setterContext;Ge[At]={read:Ue=>Wt.fromWireType(an(X,Ue)),write:(Ue,ot)=>{var Ze=[];de(Ee,Ue,q.toWireType(Ze,ot)),Sn(Ze)}}}),[{name:ee.name,fromWireType:function(tt){var mt={};for(var At in Ge)mt[At]=Ge[At].read(tt);return Pe(tt),mt},toWireType:function(tt,mt){for(var At in Ge)if(!(At in mt))throw new TypeError('Missing field:  "'+At+'"');var Wt=me();for(At in Ge)Ge[At].write(Wt,mt[At]);return tt!==null&&tt.push(Pe,Wt),Wt},argPackAdvance:8,readValueFromPointer:Sr,destructorFunction:Pe}]})}function Un(Q,ee,me,Pe,Be){}function Bn(Q){switch(Q){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+Q)}}function pr(){for(var Q=new Array(256),ee=0;ee<256;++ee)Q[ee]=String.fromCharCode(ee);wi=Q}var wi=void 0;function Vn(Q){for(var ee="",me=Q;U[me];)ee+=wi[U[me++]];return ee}var mr=void 0;function Dt(Q){throw new mr(Q)}function Gt(Q,ee,me={}){if(!("argPackAdvance"in ee))throw new TypeError("registerType registeredInstance requires argPackAdvance");var Pe=ee.name;if(Q||Dt('type "'+Pe+'" must have a positive integer typeid pointer'),kn.hasOwnProperty(Q)){if(me.ignoreDuplicateRegistrations)return;Dt("Cannot register type '"+Pe+"' twice")}if(kn[Q]=ee,delete Mn[Q],hn.hasOwnProperty(Q)){var Be=hn[Q];delete hn[Q],Be.forEach(Qe=>Qe())}}function Ut(Q,ee,me,Pe,Be){var Qe=Bn(me);ee=Vn(ee),Gt(Q,{name:ee,fromWireType:function(Je){return!!Je},toWireType:function(Je,Ge){return Ge?Pe:Be},argPackAdvance:8,readValueFromPointer:function(Je){var Ge;if(me===1)Ge=oe;else if(me===2)Ge=Y;else if(me===4)Ge=ne;else throw new TypeError("Unknown boolean type size: "+ee);return this.fromWireType(Ge[Je>>Qe])},destructorFunction:null})}function un(Q){if(!(this instanceof ss)||!(Q instanceof ss))return!1;for(var ee=this.$$.ptrType.registeredClass,me=this.$$.ptr,Pe=Q.$$.ptrType.registeredClass,Be=Q.$$.ptr;ee.baseClass;)me=ee.upcast(me),ee=ee.baseClass;for(;Pe.baseClass;)Be=Pe.upcast(Be),Pe=Pe.baseClass;return ee===Pe&&me===Be}function Zr(Q){return{count:Q.count,deleteScheduled:Q.deleteScheduled,preservePointerOnDelete:Q.preservePointerOnDelete,ptr:Q.ptr,ptrType:Q.ptrType,smartPtr:Q.smartPtr,smartPtrType:Q.smartPtrType}}function xo(Q){function ee(me){return me.$$.ptrType.registeredClass.name}Dt(ee(Q)+" instance already deleted")}var Pl=!1;function os(Q){}function Uo(Q){Q.smartPtr?Q.smartPtrType.rawDestructor(Q.smartPtr):Q.ptrType.registeredClass.rawDestructor(Q.ptr)}function wo(Q){Q.count.value-=1;var ee=Q.count.value===0;ee&&Uo(Q)}function Fo(Q,ee,me){if(ee===me)return Q;if(me.baseClass===void 0)return null;var Pe=Fo(Q,ee,me.baseClass);return Pe===null?null:me.downcast(Pe)}var zr={};function ba(){return Object.keys($a).length}function Zt(){var Q=[];for(var ee in $a)$a.hasOwnProperty(ee)&&Q.push($a[ee]);return Q}var Ui=[];function kl(){for(;Ui.length;){var Q=Ui.pop();Q.$$.deleteScheduled=!1,Q.delete()}}var Fi=void 0;function Va(Q){Fi=Q,Ui.length&&Fi&&Fi(kl)}function Bo(){a.getInheritedInstanceCount=ba,a.getLiveInheritedInstances=Zt,a.flushPendingDeletes=kl,a.setDelayFunction=Va}var $a={};function Mu(Q,ee){for(ee===void 0&&Dt("ptr should not be undefined");Q.baseClass;)ee=Q.upcast(ee),Q=Q.baseClass;return ee}function Gc(Q,ee){return ee=Mu(Q,ee),$a[ee]}function ja(Q,ee){(!ee.ptrType||!ee.ptr)&&Kn("makeClassHandle requires ptr and ptrType");var me=!!ee.smartPtrType,Pe=!!ee.smartPtr;return me!==Pe&&Kn("Both smartPtrType and smartPtr must be specified"),ee.count={value:1},bi(Object.create(Q,{$$:{value:ee}}))}function Wc(Q){var ee=this.getPointee(Q);if(!ee)return this.destructor(Q),null;var me=Gc(this.registeredClass,ee);if(me!==void 0){if(me.$$.count.value===0)return me.$$.ptr=ee,me.$$.smartPtr=Q,me.clone();var Pe=me.clone();return this.destructor(Q),Pe}function Be(){return this.isSmartPointer?ja(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:ee,smartPtrType:this,smartPtr:Q}):ja(this.registeredClass.instancePrototype,{ptrType:this,ptr:Q})}var Qe=this.registeredClass.getActualType(ee),Je=zr[Qe];if(!Je)return Be.call(this);var Ge;this.isConst?Ge=Je.constPointerType:Ge=Je.pointerType;var tt=Fo(ee,this.registeredClass,Ge.registeredClass);return tt===null?Be.call(this):this.isSmartPointer?ja(Ge.registeredClass.instancePrototype,{ptrType:Ge,ptr:tt,smartPtrType:this,smartPtr:Q}):ja(Ge.registeredClass.instancePrototype,{ptrType:Ge,ptr:tt})}function bi(Q){return typeof FinalizationRegistry>"u"?(bi=ee=>ee,Q):(Pl=new FinalizationRegistry(ee=>{wo(ee.$$)}),bi=ee=>{var me=ee.$$,Pe=!!me.smartPtr;if(Pe){var Be={$$:me};Pl.register(ee,Be,ee)}return ee},os=ee=>Pl.unregister(ee),bi(Q))}function cc(){if(this.$$.ptr||xo(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var Q=bi(Object.create(Object.getPrototypeOf(this),{$$:{value:Zr(this.$$)}}));return Q.$$.count.value+=1,Q.$$.deleteScheduled=!1,Q}function lc(){this.$$.ptr||xo(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Dt("Object already scheduled for deletion"),os(this),wo(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function ia(){return!this.$$.ptr}function Hc(){return this.$$.ptr||xo(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Dt("Object already scheduled for deletion"),Ui.push(this),Ui.length===1&&Fi&&Fi(kl),this.$$.deleteScheduled=!0,this}function Ns(){ss.prototype.isAliasOf=un,ss.prototype.clone=cc,ss.prototype.delete=lc,ss.prototype.isDeleted=ia,ss.prototype.deleteLater=Hc}function ss(){}function Ru(Q,ee,me){if(Q[ee].overloadTable===void 0){var Pe=Q[ee];Q[ee]=function(){return Q[ee].overloadTable.hasOwnProperty(arguments.length)||Dt("Function '"+me+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+Q[ee].overloadTable+")!"),Q[ee].overloadTable[arguments.length].apply(this,arguments)},Q[ee].overloadTable=[],Q[ee].overloadTable[Pe.argCount]=Pe}}function Er(Q,ee,me){a.hasOwnProperty(Q)?((me===void 0||a[Q].overloadTable!==void 0&&a[Q].overloadTable[me]!==void 0)&&Dt("Cannot register public name '"+Q+"' twice"),Ru(a,Q,Q),a.hasOwnProperty(me)&&Dt("Cannot register multiple overloads of a function with the same number of arguments ("+me+")!"),a[Q].overloadTable[me]=ee):(a[Q]=ee,me!==void 0&&(a[Q].numArguments=me))}function bo(Q,ee,me,Pe,Be,Qe,Je,Ge){this.name=Q,this.constructor=ee,this.instancePrototype=me,this.rawDestructor=Pe,this.baseClass=Be,this.getActualType=Qe,this.upcast=Je,this.downcast=Ge,this.pureVirtualFunctions=[]}function Al(Q,ee,me){for(;ee!==me;)ee.upcast||Dt("Expected null or instance of "+me.name+", got an instance of "+ee.name),Q=ee.upcast(Q),ee=ee.baseClass;return Q}function Ps(Q,ee){if(ee===null)return this.isReference&&Dt("null is not a valid "+this.name),0;ee.$$||Dt('Cannot pass "'+Bi(ee)+'" as a '+this.name),ee.$$.ptr||Dt("Cannot pass deleted object as a pointer of type "+this.name);var me=ee.$$.ptrType.registeredClass,Pe=Al(ee.$$.ptr,me,this.registeredClass);return Pe}function Ll(Q,ee){var me;if(ee===null)return this.isReference&&Dt("null is not a valid "+this.name),this.isSmartPointer?(me=this.rawConstructor(),Q!==null&&Q.push(this.rawDestructor,me),me):0;ee.$$||Dt('Cannot pass "'+Bi(ee)+'" as a '+this.name),ee.$$.ptr||Dt("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&ee.$$.ptrType.isConst&&Dt("Cannot convert argument of type "+(ee.$$.smartPtrType?ee.$$.smartPtrType.name:ee.$$.ptrType.name)+" to parameter type "+this.name);var Pe=ee.$$.ptrType.registeredClass;if(me=Al(ee.$$.ptr,Pe,this.registeredClass),this.isSmartPointer)switch(ee.$$.smartPtr===void 0&&Dt("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:ee.$$.smartPtrType===this?me=ee.$$.smartPtr:Dt("Cannot convert argument of type "+(ee.$$.smartPtrType?ee.$$.smartPtrType.name:ee.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:me=ee.$$.smartPtr;break;case 2:if(ee.$$.smartPtrType===this)me=ee.$$.smartPtr;else{var Be=ee.clone();me=this.rawShare(me,Ci.toHandle(function(){Be.delete()})),Q!==null&&Q.push(this.rawDestructor,me)}break;default:Dt("Unsupporting sharing policy")}return me}function So(Q,ee){if(ee===null)return this.isReference&&Dt("null is not a valid "+this.name),0;ee.$$||Dt('Cannot pass "'+Bi(ee)+'" as a '+this.name),ee.$$.ptr||Dt("Cannot pass deleted object as a pointer of type "+this.name),ee.$$.ptrType.isConst&&Dt("Cannot convert argument of type "+ee.$$.ptrType.name+" to parameter type "+this.name);var me=ee.$$.ptrType.registeredClass,Pe=Al(ee.$$.ptr,me,this.registeredClass);return Pe}function Ud(Q){return this.rawGetPointee&&(Q=this.rawGetPointee(Q)),Q}function Ua(Q){this.rawDestructor&&this.rawDestructor(Q)}function Iu(Q){Q!==null&&Q.delete()}function Df(){eo.prototype.getPointee=Ud,eo.prototype.destructor=Ua,eo.prototype.argPackAdvance=8,eo.prototype.readValueFromPointer=Sr,eo.prototype.deleteObject=Iu,eo.prototype.fromWireType=Wc}function eo(Q,ee,me,Pe,Be,Qe,Je,Ge,tt,mt,At){this.name=Q,this.registeredClass=ee,this.isReference=me,this.isConst=Pe,this.isSmartPointer=Be,this.pointeeType=Qe,this.sharingPolicy=Je,this.rawGetPointee=Ge,this.rawConstructor=tt,this.rawShare=mt,this.rawDestructor=At,!Be&&ee.baseClass===void 0?Pe?(this.toWireType=Ps,this.destructorFunction=null):(this.toWireType=So,this.destructorFunction=null):this.toWireType=Ll}function aa(Q,ee,me){a.hasOwnProperty(Q)||Kn("Replacing nonexistant public symbol"),a[Q].overloadTable!==void 0&&me!==void 0?a[Q].overloadTable[me]=ee:(a[Q]=ee,a[Q].argCount=me)}function to(Q,ee,me){var Pe=a["dynCall_"+Q];return me&&me.length?Pe.apply(null,[ee].concat(me)):Pe.call(null,ee)}var oa=[];function ks(Q){var ee=oa[Q];return ee||(Q>=oa.length&&(oa.length=Q+1),oa[Q]=ee=ye.get(Q)),ee}function uc(Q,ee,me){if(Q.includes("j"))return to(Q,ee,me);var Pe=ks(ee).apply(null,me);return Pe}function fc(Q,ee){var me=[];return function(){return me.length=0,Object.assign(me,arguments),uc(Q,ee,me)}}function ui(Q,ee){Q=Vn(Q);function me(){return Q.includes("j")?fc(Q,ee):ks(ee)}var Pe=me();return typeof Pe!="function"&&Dt("unknown function pointer with signature "+Q+": "+ee),Pe}var Vl=void 0;function no(Q){var ee=vc(Q),me=Vn(ee);return Wo(ee),me}function sa(Q,ee){var me=[],Pe={};function Be(Qe){if(!Pe[Qe]&&!kn[Qe]){if(Mn[Qe]){Mn[Qe].forEach(Be);return}me.push(Qe),Pe[Qe]=!0}}throw ee.forEach(Be),new Vl(Q+": "+me.map(no).join([", "]))}function dc(Q,ee,me,Pe,Be,Qe,Je,Ge,tt,mt,At,Wt,an){At=Vn(At),Qe=ui(Be,Qe),Ge&&(Ge=ui(Je,Ge)),mt&&(mt=ui(tt,mt)),an=ui(Wt,an);var X=ct(At);Er(X,function(){sa("Cannot construct "+At+" due to unbound types",[Pe])}),rn([Q,ee,me],Pe?[Pe]:[],function(q){q=q[0];var de,Ee;Pe?(de=q.registeredClass,Ee=de.instancePrototype):Ee=ss.prototype;var Ue=kt(X,function(){if(Object.getPrototypeOf(this)!==ot)throw new mr("Use 'new' to construct "+At);if(Ze.constructor_body===void 0)throw new mr(At+" has no accessible constructor");var P=Ze.constructor_body[arguments.length];if(P===void 0)throw new mr("Tried to invoke ctor of "+At+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Ze.constructor_body).toString()+") parameters instead!");return P.apply(this,arguments)}),ot=Object.create(Ee,{constructor:{value:Ue}});Ue.prototype=ot;var Ze=new bo(At,Ue,ot,an,de,Qe,Ge,mt),qe=new eo(At,Ze,!0,!1,!1),j=new eo(At+"*",Ze,!1,!1,!1),z=new eo(At+" const*",Ze,!1,!0,!1);return zr[Q]={pointerType:j,constPointerType:z},aa(X,Ue),[qe,j,z]})}function cs(Q,ee){for(var me=[],Pe=0;Pe<Q;Pe++)me.push(F[ee+Pe*4>>2]);return me}function Sa(Q,ee){if(!(Q instanceof Function))throw new TypeError("new_ called with constructor type "+typeof Q+" which is not a function");var me=kt(Q.name||"unknownFunctionName",function(){});me.prototype=Q.prototype;var Pe=new me,Be=Q.apply(Pe,ee);return Be instanceof Object?Be:Pe}function Co(Q,ee,me,Pe,Be){var Qe=ee.length;Qe<2&&Dt("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var Je=ee[1]!==null&&me!==null,Ge=!1,tt=1;tt<ee.length;++tt)if(ee[tt]!==null&&ee[tt].destructorFunction===void 0){Ge=!0;break}for(var mt=ee[0].name!=="void",At="",Wt="",tt=0;tt<Qe-2;++tt)At+=(tt!==0?", ":"")+"arg"+tt,Wt+=(tt!==0?", ":"")+"arg"+tt+"Wired";var an="return function "+ct(Q)+"("+At+`) {
if (arguments.length !== `+(Qe-2)+`) {
throwBindingError('function `+Q+" called with ' + arguments.length + ' arguments, expected "+(Qe-2)+` args!');
}
`;Ge&&(an+=`var destructors = [];
`);var X=Ge?"destructors":"null",q=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],de=[Dt,Pe,Be,Sn,ee[0],ee[1]];Je&&(an+="var thisWired = classParam.toWireType("+X+`, this);
`);for(var tt=0;tt<Qe-2;++tt)an+="var arg"+tt+"Wired = argType"+tt+".toWireType("+X+", arg"+tt+"); // "+ee[tt+2].name+`
`,q.push("argType"+tt),de.push(ee[tt+2]);if(Je&&(Wt="thisWired"+(Wt.length>0?", ":"")+Wt),an+=(mt?"var rv = ":"")+"invoker(fn"+(Wt.length>0?", ":"")+Wt+`);
`,Ge)an+=`runDestructors(destructors);
`;else for(var tt=Je?1:2;tt<ee.length;++tt){var Ee=tt===1?"thisWired":"arg"+(tt-2)+"Wired";ee[tt].destructorFunction!==null&&(an+=Ee+"_dtor("+Ee+"); // "+ee[tt].name+`
`,q.push(Ee+"_dtor"),de.push(ee[tt].destructorFunction))}mt&&(an+=`var ret = retType.fromWireType(rv);
return ret;
`),an+=`}
`,q.push(an);var Ue=Sa(Function,q).apply(null,de);return Ue}function As(Q,ee,me,Pe,Be,Qe){M(ee>0);var Je=cs(ee,me);Be=ui(Pe,Be),rn([],[Q],function(Ge){Ge=Ge[0];var tt="constructor "+Ge.name;if(Ge.registeredClass.constructor_body===void 0&&(Ge.registeredClass.constructor_body=[]),Ge.registeredClass.constructor_body[ee-1]!==void 0)throw new mr("Cannot register multiple constructors with identical number of parameters ("+(ee-1)+") for class '"+Ge.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return Ge.registeredClass.constructor_body[ee-1]=()=>{sa("Cannot construct "+Ge.name+" due to unbound types",Je)},rn([],Je,function(mt){return mt.splice(1,0,null),Ge.registeredClass.constructor_body[ee-1]=Co(tt,mt,null,Be,Qe),[]}),[]})}function Nu(Q,ee,me,Pe,Be,Qe,Je,Ge){var tt=cs(me,Pe);ee=Vn(ee),Qe=ui(Be,Qe),rn([],[Q],function(mt){mt=mt[0];var At=mt.name+"."+ee;ee.startsWith("@@")&&(ee=Symbol[ee.substring(2)]),Ge&&mt.registeredClass.pureVirtualFunctions.push(ee);function Wt(){sa("Cannot call "+At+" due to unbound types",tt)}var an=mt.registeredClass.instancePrototype,X=an[ee];return X===void 0||X.overloadTable===void 0&&X.className!==mt.name&&X.argCount===me-2?(Wt.argCount=me-2,Wt.className=mt.name,an[ee]=Wt):(Ru(an,ee,At),an[ee].overloadTable[me-2]=Wt),rn([],tt,function(q){var de=Co(At,q,mt,Qe,Je);return an[ee].overloadTable===void 0?(de.argCount=me-2,an[ee]=de):an[ee].overloadTable[me-2]=de,[]}),[]})}var hc=[],jr=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function zo(Q){Q>4&&--jr[Q].refcount===0&&(jr[Q]=void 0,hc.push(Q))}function Ur(){for(var Q=0,ee=5;ee<jr.length;++ee)jr[ee]!==void 0&&++Q;return Q}function Si(){for(var Q=5;Q<jr.length;++Q)if(jr[Q]!==void 0)return jr[Q];return null}function gc(){a.count_emval_handles=Ur,a.get_first_emval=Si}var Ci={toValue:Q=>(Q||Dt("Cannot use deleted val. handle = "+Q),jr[Q].value),toHandle:Q=>{switch(Q){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var ee=hc.length?hc.pop():jr.length;return jr[ee]={refcount:1,value:Q},ee}}}};function Pu(Q,ee){ee=Vn(ee),Gt(Q,{name:ee,fromWireType:function(me){var Pe=Ci.toValue(me);return zo(me),Pe},toWireType:function(me,Pe){return Ci.toHandle(Pe)},argPackAdvance:8,readValueFromPointer:Sr,destructorFunction:null})}function Bi(Q){if(Q===null)return"null";var ee=typeof Q;return ee==="object"||ee==="array"||ee==="function"?Q.toString():""+Q}function Go(Q,ee){switch(ee){case 2:return function(me){return this.fromWireType(ae[me>>2])};case 3:return function(me){return this.fromWireType(re[me>>3])};default:throw new TypeError("Unknown float type: "+Q)}}function pc(Q,ee,me){var Pe=Bn(me);ee=Vn(ee),Gt(Q,{name:ee,fromWireType:function(Be){return Be},toWireType:function(Be,Qe){return Qe},argPackAdvance:8,readValueFromPointer:Go(ee,Pe),destructorFunction:null})}function ls(Q,ee,me,Pe,Be,Qe){var Je=cs(ee,me);Q=Vn(Q),Be=ui(Pe,Be),Er(Q,function(){sa("Cannot call "+Q+" due to unbound types",Je)},ee-1),rn([],Je,function(Ge){var tt=[Ge[0],null].concat(Ge.slice(1));return aa(Q,Co(Q,tt,null,Be,Qe),ee-1),[]})}function Fa(Q,ee,me){switch(ee){case 0:return me?function(Be){return oe[Be]}:function(Be){return U[Be]};case 1:return me?function(Be){return Y[Be>>1]}:function(Be){return J[Be>>1]};case 2:return me?function(Be){return ne[Be>>2]}:function(Be){return F[Be>>2]};default:throw new TypeError("Unknown integer type: "+Q)}}function zi(Q,ee,me,Pe,Be){ee=Vn(ee);var Qe=Bn(me),Je=Wt=>Wt;if(Pe===0){var Ge=32-8*me;Je=Wt=>Wt<<Ge>>>Ge}var tt=ee.includes("unsigned"),mt=(Wt,an)=>{},At;tt?At=function(Wt,an){return mt(an,this.name),an>>>0}:At=function(Wt,an){return mt(an,this.name),an},Gt(Q,{name:ee,fromWireType:Je,toWireType:At,argPackAdvance:8,readValueFromPointer:Fa(ee,Qe,Pe!==0),destructorFunction:null})}function Ls(Q,ee,me){var Pe=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Be=Pe[ee];function Qe(Je){Je=Je>>2;var Ge=F,tt=Ge[Je],mt=Ge[Je+1];return new Be(G,mt,tt)}me=Vn(me),Gt(Q,{name:me,fromWireType:Qe,argPackAdvance:8,readValueFromPointer:Qe},{ignoreDuplicateRegistrations:!0})}function $l(Q,ee){ee=Vn(ee);var me=ee==="std::string";Gt(Q,{name:ee,fromWireType:function(Pe){var Be=F[Pe>>2],Qe=Pe+4,Je;if(me)for(var Ge=Qe,tt=0;tt<=Be;++tt){var mt=Qe+tt;if(tt==Be||U[mt]==0){var At=mt-Ge,Wt=k(Ge,At);Je===void 0?Je=Wt:(Je+="\0",Je+=Wt),Ge=mt+1}}else{for(var an=new Array(Be),tt=0;tt<Be;++tt)an[tt]=String.fromCharCode(U[Qe+tt]);Je=an.join("")}return Wo(Pe),Je},toWireType:function(Pe,Be){Be instanceof ArrayBuffer&&(Be=new Uint8Array(Be));var Qe,Je=typeof Be=="string";Je||Be instanceof Uint8Array||Be instanceof Uint8ClampedArray||Be instanceof Int8Array||Dt("Cannot pass non-string to std::string"),me&&Je?Qe=W(Be):Qe=Be.length;var Ge=Vs(4+Qe+1),tt=Ge+4;if(F[Ge>>2]=Qe,me&&Je)$(Be,tt,Qe+1);else if(Je)for(var mt=0;mt<Qe;++mt){var At=Be.charCodeAt(mt);At>255&&(Wo(tt),Dt("String has UTF-16 code units that do not fit in 8 bits")),U[tt+mt]=At}else for(var mt=0;mt<Qe;++mt)U[tt+mt]=Be[mt];return Pe!==null&&Pe.push(Wo,Ge),Ge},argPackAdvance:8,readValueFromPointer:Sr,destructorFunction:function(Pe){Wo(Pe)}})}var mc=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function qc(Q,ee){for(var me=Q,Pe=me>>1,Be=Pe+ee/2;!(Pe>=Be)&&J[Pe];)++Pe;if(me=Pe<<1,me-Q>32&&mc)return mc.decode(U.subarray(Q,me));for(var Qe="",Je=0;!(Je>=ee/2);++Je){var Ge=Y[Q+Je*2>>1];if(Ge==0)break;Qe+=String.fromCharCode(Ge)}return Qe}function jl(Q,ee,me){if(me===void 0&&(me=2147483647),me<2)return 0;me-=2;for(var Pe=ee,Be=me<Q.length*2?me/2:Q.length,Qe=0;Qe<Be;++Qe){var Je=Q.charCodeAt(Qe);Y[ee>>1]=Je,ee+=2}return Y[ee>>1]=0,ee-Pe}function Kc(Q){return Q.length*2}function Yc(Q,ee){for(var me=0,Pe="";!(me>=ee/4);){var Be=ne[Q+me*4>>2];if(Be==0)break;if(++me,Be>=65536){var Qe=Be-65536;Pe+=String.fromCharCode(55296|Qe>>10,56320|Qe&1023)}else Pe+=String.fromCharCode(Be)}return Pe}function Ul(Q,ee,me){if(me===void 0&&(me=2147483647),me<4)return 0;for(var Pe=ee,Be=Pe+me-4,Qe=0;Qe<Q.length;++Qe){var Je=Q.charCodeAt(Qe);if(Je>=55296&&Je<=57343){var Ge=Q.charCodeAt(++Qe);Je=65536+((Je&1023)<<10)|Ge&1023}if(ne[ee>>2]=Je,ee+=4,ee+4>Be)break}return ne[ee>>2]=0,ee-Pe}function Mf(Q){for(var ee=0,me=0;me<Q.length;++me){var Pe=Q.charCodeAt(me);Pe>=55296&&Pe<=57343&&++me,ee+=4}return ee}function Fd(Q,ee,me){me=Vn(me);var Pe,Be,Qe,Je,Ge;ee===2?(Pe=qc,Be=jl,Je=Kc,Qe=()=>J,Ge=1):ee===4&&(Pe=Yc,Be=Ul,Je=Mf,Qe=()=>F,Ge=2),Gt(Q,{name:me,fromWireType:function(tt){for(var mt=F[tt>>2],At=Qe(),Wt,an=tt+4,X=0;X<=mt;++X){var q=tt+4+X*ee;if(X==mt||At[q>>Ge]==0){var de=q-an,Ee=Pe(an,de);Wt===void 0?Wt=Ee:(Wt+="\0",Wt+=Ee),an=q+ee}}return Wo(tt),Wt},toWireType:function(tt,mt){typeof mt!="string"&&Dt("Cannot pass non-string to C++ string type "+me);var At=Je(mt),Wt=Vs(4+At+ee);return F[Wt>>2]=At>>Ge,Be(mt,Wt+4,At+ee),tt!==null&&tt.push(Wo,Wt),Wt},argPackAdvance:8,readValueFromPointer:Sr,destructorFunction:function(tt){Wo(tt)}})}function Bd(Q,ee,me,Pe,Be,Qe){Ln[Q]={name:Vn(ee),rawConstructor:ui(me,Pe),rawDestructor:ui(Be,Qe),fields:[]}}function zd(Q,ee,me,Pe,Be,Qe,Je,Ge,tt,mt){Ln[Q].fields.push({fieldName:Vn(ee),getterReturnType:me,getter:ui(Pe,Be),getterContext:Qe,setterArgumentType:Je,setter:ui(Ge,tt),setterContext:mt})}function ku(Q,ee){ee=Vn(ee),Gt(Q,{isVoid:!0,name:ee,argPackAdvance:0,fromWireType:function(){},toWireType:function(me,Pe){}})}var Rf={};function Gd(Q){var ee=Rf[Q];return ee===void 0?Vn(Q):ee}function If(){return typeof globalThis=="object"?globalThis:(function(){return Function})()("return this")()}function Nf(Q){return Q===0?Ci.toHandle(If()):(Q=Gd(Q),Ci.toHandle(If()[Q]))}function Wd(Q){Q>4&&(jr[Q].refcount+=1)}function Fl(Q,ee){var me=kn[Q];return me===void 0&&Dt(ee+" has unknown type "+no(Q)),me}function Pf(Q){for(var ee="",me=0;me<Q;++me)ee+=(me!==0?", ":"")+"arg"+me;for(var Pe=()=>F,Be="return function emval_allocator_"+Q+`(constructor, argTypes, args) {
  var HEAPU32 = getMemory();
`,me=0;me<Q;++me)Be+="var argType"+me+" = requireRegisteredType(HEAPU32[((argTypes)>>2)], 'parameter "+me+`');
var arg`+me+" = argType"+me+`.readValueFromPointer(args);
args += argType`+me+`['argPackAdvance'];
argTypes += 4;
`;return Be+="var obj = new constructor("+ee+`);
return valueToHandle(obj);
}
`,new Function("requireRegisteredType","Module","valueToHandle","getMemory",Be)(Fl,a,Ci.toHandle,Pe)}var kf={};function Au(Q,ee,me,Pe){Q=Ci.toValue(Q);var Be=kf[ee];return Be||(Be=Pf(ee),kf[ee]=Be),Be(Q,me,Pe)}function Hd(Q,ee){Q=Fl(Q,"_emval_take_value");var me=Q.readValueFromPointer(ee);return Ci.toHandle(me)}function Bl(){tr("")}function qd(Q,ee,me){U.copyWithin(Q,ee,ee+me)}function Af(){return 2147483648}function Kd(Q){try{return T.grow(Q-G.byteLength+65535>>>16),te(T.buffer),1}catch{}}function Lf(Q){var ee=U.length;Q=Q>>>0;var me=Af();if(Q>me)return!1;let Pe=(tt,mt)=>tt+(mt-tt%mt)%mt;for(var Be=1;Be<=4;Be*=2){var Qe=ee*(1+.2/Be);Qe=Math.min(Qe,Q+100663296);var Je=Math.min(me,Pe(Math.max(Q,Qe),65536)),Ge=Kd(Je);if(Ge)return!0}return!1}function Yd(Q){var ee=a["_"+Q];return ee}function Xd(Q,ee){oe.set(Q,ee)}function Lu(Q,ee,me,Pe,Be){var Qe={string:q=>{var de=0;if(q!=null&&q!==0){var Ee=(q.length<<2)+1;de=Xc(Ee),$(q,de,Ee)}return de},array:q=>{var de=Xc(q.length);return Xd(q,de),de}};function Je(q){return ee==="string"?k(q):ee==="boolean"?!!q:q}var Ge=Yd(Q),tt=[],mt=0;if(Pe)for(var At=0;At<Pe.length;At++){var Wt=Qe[me[At]];Wt?(mt===0&&(mt=Vf()),tt[At]=Wt(Pe[At])):tt[At]=Pe[At]}var an=Ge.apply(null,tt);function X(q){return mt!==0&&$f(mt),Je(q)}return an=X(an),an}gn=a.InternalError=jt(Error,"InternalError"),pr(),mr=a.BindingError=jt(Error,"BindingError"),Ns(),Bo(),Df(),Vl=a.UnboundTypeError=jt(Error,"UnboundTypeError"),gc();var Vu={h:Pt,q:Xt,r:Un,w:Ut,p:dc,o:As,c:Nu,v:Pu,k:pc,e:ls,b:zi,a:Ls,j:$l,g:Fd,u:Bd,d:zd,x:ku,i:zo,m:Nf,l:Wd,y:Au,n:Hd,f:Bl,t:qd,s:Lf};pe(),a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.A).apply(null,arguments)};var Vs=a._malloc=function(){return(Vs=a._malloc=a.asm.B).apply(null,arguments)},vc=a.___getTypeName=function(){return(vc=a.___getTypeName=a.asm.D).apply(null,arguments)};a.__embind_initialize_bindings=function(){return(a.__embind_initialize_bindings=a.asm.E).apply(null,arguments)};var Wo=a._free=function(){return(Wo=a._free=a.asm.F).apply(null,arguments)},Vf=a.stackSave=function(){return(Vf=a.stackSave=a.asm.G).apply(null,arguments)},$f=a.stackRestore=function(){return($f=a.stackRestore=a.asm.H).apply(null,arguments)},Xc=a.stackAlloc=function(){return(Xc=a.stackAlloc=a.asm.I).apply(null,arguments)},yc=a.___cxa_is_pointer_type=function(){return(yc=a.___cxa_is_pointer_type=a.asm.J).apply(null,arguments)};a.ccall=Lu;var zl;cn=function Q(){zl||$u(),zl||(cn=Q)};function $u(Q){if(Rt>0||(Me(),Rt>0))return;function ee(){zl||(zl=!0,a.calledRun=!0,!O&&(be(),o(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),Ye()))}a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),ee()},1)):ee()}if(a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return $u(),i.ready})})();t.exports=n})(xI)),xI.exports}var rBt=nBt();const iBt=ka(rBt),aBt=new URL("/assets/charlswasm_decode-484ovEoR.wasm",import.meta.url),Xv={codec:void 0,decoder:void 0,decodeConfig:{}};function oBt(t){return typeof t=="number"?Xv.codec.getExceptionMessage(t):t}function sBt(t){if(Xv.decodeConfig=t,Xv.codec)return Promise.resolve();const e=iBt({locateFile:n=>n.endsWith(".wasm")?aBt.toString():n});return new Promise((n,r)=>{e.then(i=>{Xv.codec=i,Xv.decoder=new i.JpegLSDecoder,n()},r)})}async function wre(t,e){try{await sBt();const n=Xv.decoder;n.getEncodedBuffer(t.length).set(t),n.decode();const i=n.getFrameInfo(),a=n.getInterleaveMode(),o=n.getNearLossless(),s=n.getDecodedBuffer(),c={columns:i.width,rows:i.height,bitsPerPixel:i.bitsPerSample,signed:e.signed,bytesPerPixel:e.bytesPerPixel,componentsPerPixel:i.componentCount},l=cBt(i,s,e.signed),u={nearLossless:o,interleaveMode:a,frameInfo:i};return{...e,pixelData:l,imageInfo:c,encodeOptions:u,...u,...c}}catch(n){throw oBt(n)}}function cBt(t,e,n){return t.bitsPerSample>8?n?new Int16Array(e.buffer,e.byteOffset,e.byteLength/2):new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2):n?new Int8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var wI={exports:{}},bre;function lBt(){return bre||(bre=1,(function(t,e){var n=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),(function(i){i=i||{};var a=typeof i<"u"?i:{},o,s;a.ready=new Promise(function(X,q){o=X,s=q});var c=Object.assign({},a),l="./this.program",u=typeof window=="object",f=typeof importScripts=="function",d=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",h="";function m(X){return a.locateFile?a.locateFile(X,h):h+X}var p,y,x;if(d){var S=Cd,C=Cd;f?h=C.dirname(h)+"/":h=__dirname+"/",p=(X,q)=>(X=fe(X)?new URL(X):C.normalize(X),S.readFileSync(X,q?void 0:"utf8")),x=X=>{var q=p(X,!0);return q.buffer||(q=new Uint8Array(q)),q},y=(X,q,de)=>{X=fe(X)?new URL(X):C.normalize(X),S.readFile(X,function(Ee,Ue){Ee?de(Ee):q(Ue.buffer)})},process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(X){if(!(X instanceof wt))throw X}),process.on("unhandledRejection",function(X){throw X}),a.inspect=function(){return"[Emscripten Module object]"}}else(u||f)&&(f?h=self.location.href:typeof document<"u"&&document.currentScript&&(h=document.currentScript.src),r&&(h=r),h.indexOf("blob:")!==0?h=h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):h="",p=X=>{var q=new XMLHttpRequest;return q.open("GET",X,!1),q.send(null),q.responseText},f&&(x=X=>{var q=new XMLHttpRequest;return q.open("GET",X,!1),q.responseType="arraybuffer",q.send(null),new Uint8Array(q.response)}),y=(X,q,de)=>{var Ee=new XMLHttpRequest;Ee.open("GET",X,!0),Ee.responseType="arraybuffer",Ee.onload=()=>{if(Ee.status==200||Ee.status==0&&Ee.response){q(Ee.response);return}de()},Ee.onerror=de,Ee.send(null)});var _=a.print||console.log.bind(console),T=a.printErr||console.warn.bind(console);Object.assign(a,c),c=null,a.arguments&&a.arguments,a.thisProgram&&(l=a.thisProgram),a.quit&&a.quit;var O;a.wasmBinary&&(O=a.wasmBinary),a.noExitRuntime,typeof WebAssembly!="object"&&ue("no native wasm support detected");var M,I=!1;function V(X,q){X||ue(q)}var k=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function L(X,q,de){for(var Ee=q+de,Ue=q;X[Ue]&&!(Ue>=Ee);)++Ue;if(Ue-q>16&&X.buffer&&k)return k.decode(X.subarray(q,Ue));for(var ot="";q<Ue;){var Ze=X[q++];if(!(Ze&128)){ot+=String.fromCharCode(Ze);continue}var qe=X[q++]&63;if((Ze&224)==192){ot+=String.fromCharCode((Ze&31)<<6|qe);continue}var j=X[q++]&63;if((Ze&240)==224?Ze=(Ze&15)<<12|qe<<6|j:Ze=(Ze&7)<<18|qe<<12|j<<6|X[q++]&63,Ze<65536)ot+=String.fromCharCode(Ze);else{var z=Ze-65536;ot+=String.fromCharCode(55296|z>>10,56320|z&1023)}}return ot}function $(X,q){return X?L(J,X,q):""}function W(X,q,de,Ee){if(!(Ee>0))return 0;for(var Ue=de,ot=de+Ee-1,Ze=0;Ze<X.length;++Ze){var qe=X.charCodeAt(Ze);if(qe>=55296&&qe<=57343){var j=X.charCodeAt(++Ze);qe=65536+((qe&1023)<<10)|j&1023}if(qe<=127){if(de>=ot)break;q[de++]=qe}else if(qe<=2047){if(de+1>=ot)break;q[de++]=192|qe>>6,q[de++]=128|qe&63}else if(qe<=65535){if(de+2>=ot)break;q[de++]=224|qe>>12,q[de++]=128|qe>>6&63,q[de++]=128|qe&63}else{if(de+3>=ot)break;q[de++]=240|qe>>18,q[de++]=128|qe>>12&63,q[de++]=128|qe>>6&63,q[de++]=128|qe&63}}return q[de]=0,de-Ue}function G(X,q,de){return W(X,J,q,de)}function oe(X){for(var q=0,de=0;de<X.length;++de){var Ee=X.charCodeAt(de);Ee<=127?q++:Ee<=2047?q+=2:Ee>=55296&&Ee<=57343?(q+=4,++de):q+=3}return q}var U,Y,J,ne,F,ae,re,te,ye;function we(X){U=X,a.HEAP8=Y=new Int8Array(X),a.HEAP16=ne=new Int16Array(X),a.HEAP32=ae=new Int32Array(X),a.HEAPU8=J=new Uint8Array(X),a.HEAPU16=F=new Uint16Array(X),a.HEAPU32=re=new Uint32Array(X),a.HEAPF32=te=new Float32Array(X),a.HEAPF64=ye=new Float64Array(X)}a.INITIAL_MEMORY;var Oe,Te=[],Me=[],be=[];function Ye(){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)It(a.preRun.shift());Pt(Te)}function ft(){Pt(Me)}function je(){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;)cn(a.postRun.shift());Pt(be)}function It(X){Te.unshift(X)}function Rt(X){Me.unshift(X)}function cn(X){be.unshift(X)}var ln=0,en=null;function tr(X){ln++,a.monitorRunDependencies&&a.monitorRunDependencies(ln)}function Ke(X){if(ln--,a.monitorRunDependencies&&a.monitorRunDependencies(ln),ln==0&&en){var q=en;en=null,q()}}function ue(X){a.onAbort&&a.onAbort(X),X="Aborted("+X+")",T(X),I=!0,X+=". Build with -sASSERTIONS for more info.";var q=new WebAssembly.RuntimeError(X);throw s(q),q}var B="data:application/octet-stream;base64,";function K(X){return X.startsWith(B)}function fe(X){return X.startsWith("file://")}var ie;ie="openjpegwasm_decode.wasm",K(ie)||(ie=m(ie));function pe(X){try{if(X==ie&&O)return new Uint8Array(O);if(x)return x(X);throw"both async and sync fetching of the wasm failed"}catch(q){ue(q)}}function Re(){if(!O&&(u||f)){if(typeof fetch=="function"&&!fe(ie))return fetch(ie,{credentials:"same-origin"}).then(function(X){if(!X.ok)throw"failed to load wasm binary file at '"+ie+"'";return X.arrayBuffer()}).catch(function(){return pe(ie)});if(y)return new Promise(function(X,q){y(ie,function(de){X(new Uint8Array(de))},q)})}return Promise.resolve().then(function(){return pe(ie)})}function et(){var X={a:Pe};function q(Ze,qe){var j=Ze.exports;a.asm=j,M=a.asm.E,we(M.buffer),Oe=a.asm.G,Rt(a.asm.F),Ke()}tr();function de(Ze){q(Ze.instance)}function Ee(Ze){return Re().then(function(qe){return WebAssembly.instantiate(qe,X)}).then(function(qe){return qe}).then(Ze,function(qe){T("failed to asynchronously prepare wasm: "+qe),ue(qe)})}function Ue(){return!O&&typeof WebAssembly.instantiateStreaming=="function"&&!K(ie)&&!fe(ie)&&!d&&typeof fetch=="function"?fetch(ie,{credentials:"same-origin"}).then(function(Ze){var qe=WebAssembly.instantiateStreaming(Ze,X);return qe.then(de,function(j){return T("wasm streaming compile failed: "+j),T("falling back to ArrayBuffer instantiation"),Ee(de)})}):Ee(de)}if(a.instantiateWasm)try{var ot=a.instantiateWasm(X,q);return ot}catch(Ze){T("Module.instantiateWasm callback failed with error: "+Ze),s(Ze)}return Ue().catch(s),{}}function wt(X){this.name="ExitStatus",this.message="Program terminated with exit("+X+")",this.status=X}function Pt(X){for(;X.length>0;)X.shift()(a)}function Ln(X){this.excPtr=X,this.ptr=X-24,this.set_type=function(q){re[this.ptr+4>>2]=q},this.get_type=function(){return re[this.ptr+4>>2]},this.set_destructor=function(q){re[this.ptr+8>>2]=q},this.get_destructor=function(){return re[this.ptr+8>>2]},this.set_refcount=function(q){ae[this.ptr>>2]=q},this.set_caught=function(q){q=q?1:0,Y[this.ptr+12>>0]=q},this.get_caught=function(){return Y[this.ptr+12>>0]!=0},this.set_rethrown=function(q){q=q?1:0,Y[this.ptr+13>>0]=q},this.get_rethrown=function(){return Y[this.ptr+13>>0]!=0},this.init=function(q,de){this.set_adjusted_ptr(0),this.set_type(q),this.set_destructor(de),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var q=ae[this.ptr>>2];ae[this.ptr>>2]=q+1},this.release_ref=function(){var q=ae[this.ptr>>2];return ae[this.ptr>>2]=q-1,q===1},this.set_adjusted_ptr=function(q){re[this.ptr+16>>2]=q},this.get_adjusted_ptr=function(){return re[this.ptr+16>>2]},this.get_exception_ptr=function(){var q=At(this.get_type());if(q)return re[this.excPtr>>2];var de=this.get_adjusted_ptr();return de!==0?de:this.excPtr}}function Sn(X,q,de){var Ee=new Ln(X);throw Ee.init(q,de),X}var Sr={};function hn(X){for(;X.length;){var q=X.pop(),de=X.pop();de(q)}}function kn(X){return this.fromWireType(ae[X>>2])}var Mn={},Ae={},at={},ct=48,kt=57;function jt(X){if(X===void 0)return"_unknown";X=X.replace(/[^a-zA-Z0-9_]/g,"$");var q=X.charCodeAt(0);return q>=ct&&q<=kt?"_"+X:X}function gn(X,q){return X=jt(X),new Function("body","return function "+X+`() {
    "use strict";    return body.apply(this, arguments);
};
`)(q)}function Kn(X,q){var de=gn(q,function(Ee){this.name=q,this.message=Ee;var Ue=new Error(Ee).stack;Ue!==void 0&&(this.stack=this.toString()+`
`+Ue.replace(/^Error(:[^\n]*)?\n/,""))});return de.prototype=Object.create(X.prototype),de.prototype.constructor=de,de.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},de}var rn=void 0;function Xt(X){throw new rn(X)}function Un(X,q,de){X.forEach(function(qe){at[qe]=q});function Ee(qe){var j=de(qe);j.length!==X.length&&Xt("Mismatched type converter count");for(var z=0;z<X.length;++z)un(X[z],j[z])}var Ue=new Array(q.length),ot=[],Ze=0;q.forEach((qe,j)=>{Ae.hasOwnProperty(qe)?Ue[j]=Ae[qe]:(ot.push(qe),Mn.hasOwnProperty(qe)||(Mn[qe]=[]),Mn[qe].push(()=>{Ue[j]=Ae[qe],++Ze,Ze===ot.length&&Ee(Ue)}))}),ot.length===0&&Ee(Ue)}function Bn(X){var q=Sr[X];delete Sr[X];var de=q.rawConstructor,Ee=q.rawDestructor,Ue=q.fields,ot=Ue.map(Ze=>Ze.getterReturnType).concat(Ue.map(Ze=>Ze.setterArgumentType));Un([X],ot,Ze=>{var qe={};return Ue.forEach((j,z)=>{var P=j.fieldName,A=Ze[z],H=j.getter,le=j.getterContext,he=Ze[z+Ue.length],ve=j.setter,xe=j.setterContext;qe[P]={read:_e=>A.fromWireType(H(le,_e)),write:(_e,ke)=>{var Xe=[];ve(xe,_e,he.toWireType(Xe,ke)),hn(Xe)}}}),[{name:q.name,fromWireType:function(j){var z={};for(var P in qe)z[P]=qe[P].read(j);return Ee(j),z},toWireType:function(j,z){for(var P in qe)if(!(P in z))throw new TypeError('Missing field:  "'+P+'"');var A=de();for(P in qe)qe[P].write(A,z[P]);return j!==null&&j.push(Ee,A),A},argPackAdvance:8,readValueFromPointer:kn,destructorFunction:Ee}]})}function pr(X,q,de,Ee,Ue){}function wi(X){switch(X){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+X)}}function Vn(){for(var X=new Array(256),q=0;q<256;++q)X[q]=String.fromCharCode(q);mr=X}var mr=void 0;function Dt(X){for(var q="",de=X;J[de];)q+=mr[J[de++]];return q}var Gt=void 0;function Ut(X){throw new Gt(X)}function un(X,q,de={}){if(!("argPackAdvance"in q))throw new TypeError("registerType registeredInstance requires argPackAdvance");var Ee=q.name;if(X||Ut('type "'+Ee+'" must have a positive integer typeid pointer'),Ae.hasOwnProperty(X)){if(de.ignoreDuplicateRegistrations)return;Ut("Cannot register type '"+Ee+"' twice")}if(Ae[X]=q,delete at[X],Mn.hasOwnProperty(X)){var Ue=Mn[X];delete Mn[X],Ue.forEach(ot=>ot())}}function Zr(X,q,de,Ee,Ue){var ot=wi(de);q=Dt(q),un(X,{name:q,fromWireType:function(Ze){return!!Ze},toWireType:function(Ze,qe){return qe?Ee:Ue},argPackAdvance:8,readValueFromPointer:function(Ze){var qe;if(de===1)qe=Y;else if(de===2)qe=ne;else if(de===4)qe=ae;else throw new TypeError("Unknown boolean type size: "+q);return this.fromWireType(qe[Ze>>ot])},destructorFunction:null})}function xo(X){if(!(this instanceof Er)||!(X instanceof Er))return!1;for(var q=this.$$.ptrType.registeredClass,de=this.$$.ptr,Ee=X.$$.ptrType.registeredClass,Ue=X.$$.ptr;q.baseClass;)de=q.upcast(de),q=q.baseClass;for(;Ee.baseClass;)Ue=Ee.upcast(Ue),Ee=Ee.baseClass;return q===Ee&&de===Ue}function Pl(X){return{count:X.count,deleteScheduled:X.deleteScheduled,preservePointerOnDelete:X.preservePointerOnDelete,ptr:X.ptr,ptrType:X.ptrType,smartPtr:X.smartPtr,smartPtrType:X.smartPtrType}}function os(X){function q(de){return de.$$.ptrType.registeredClass.name}Ut(q(X)+" instance already deleted")}var Uo=!1;function wo(X){}function Fo(X){X.smartPtr?X.smartPtrType.rawDestructor(X.smartPtr):X.ptrType.registeredClass.rawDestructor(X.ptr)}function zr(X){X.count.value-=1;var q=X.count.value===0;q&&Fo(X)}function ba(X,q,de){if(q===de)return X;if(de.baseClass===void 0)return null;var Ee=ba(X,q,de.baseClass);return Ee===null?null:de.downcast(Ee)}var Zt={};function Ui(){return Object.keys(Gc).length}function kl(){var X=[];for(var q in Gc)Gc.hasOwnProperty(q)&&X.push(Gc[q]);return X}var Fi=[];function Va(){for(;Fi.length;){var X=Fi.pop();X.$$.deleteScheduled=!1,X.delete()}}var Bo=void 0;function $a(X){Bo=X,Fi.length&&Bo&&Bo(Va)}function Mu(){a.getInheritedInstanceCount=Ui,a.getLiveInheritedInstances=kl,a.flushPendingDeletes=Va,a.setDelayFunction=$a}var Gc={};function ja(X,q){for(q===void 0&&Ut("ptr should not be undefined");X.baseClass;)q=X.upcast(q),X=X.baseClass;return q}function Wc(X,q){return q=ja(X,q),Gc[q]}function bi(X,q){(!q.ptrType||!q.ptr)&&Xt("makeClassHandle requires ptr and ptrType");var de=!!q.smartPtrType,Ee=!!q.smartPtr;return de!==Ee&&Xt("Both smartPtrType and smartPtr must be specified"),q.count={value:1},lc(Object.create(X,{$$:{value:q}}))}function cc(X){var q=this.getPointee(X);if(!q)return this.destructor(X),null;var de=Wc(this.registeredClass,q);if(de!==void 0){if(de.$$.count.value===0)return de.$$.ptr=q,de.$$.smartPtr=X,de.clone();var Ee=de.clone();return this.destructor(X),Ee}function Ue(){return this.isSmartPointer?bi(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:q,smartPtrType:this,smartPtr:X}):bi(this.registeredClass.instancePrototype,{ptrType:this,ptr:X})}var ot=this.registeredClass.getActualType(q),Ze=Zt[ot];if(!Ze)return Ue.call(this);var qe;this.isConst?qe=Ze.constPointerType:qe=Ze.pointerType;var j=ba(q,this.registeredClass,qe.registeredClass);return j===null?Ue.call(this):this.isSmartPointer?bi(qe.registeredClass.instancePrototype,{ptrType:qe,ptr:j,smartPtrType:this,smartPtr:X}):bi(qe.registeredClass.instancePrototype,{ptrType:qe,ptr:j})}function lc(X){return typeof FinalizationRegistry>"u"?(lc=q=>q,X):(Uo=new FinalizationRegistry(q=>{zr(q.$$)}),lc=q=>{var de=q.$$,Ee=!!de.smartPtr;if(Ee){var Ue={$$:de};Uo.register(q,Ue,q)}return q},wo=q=>Uo.unregister(q),lc(X))}function ia(){if(this.$$.ptr||os(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var X=lc(Object.create(Object.getPrototypeOf(this),{$$:{value:Pl(this.$$)}}));return X.$$.count.value+=1,X.$$.deleteScheduled=!1,X}function Hc(){this.$$.ptr||os(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ut("Object already scheduled for deletion"),wo(this),zr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Ns(){return!this.$$.ptr}function ss(){return this.$$.ptr||os(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ut("Object already scheduled for deletion"),Fi.push(this),Fi.length===1&&Bo&&Bo(Va),this.$$.deleteScheduled=!0,this}function Ru(){Er.prototype.isAliasOf=xo,Er.prototype.clone=ia,Er.prototype.delete=Hc,Er.prototype.isDeleted=Ns,Er.prototype.deleteLater=ss}function Er(){}function bo(X,q,de){if(X[q].overloadTable===void 0){var Ee=X[q];X[q]=function(){return X[q].overloadTable.hasOwnProperty(arguments.length)||Ut("Function '"+de+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+X[q].overloadTable+")!"),X[q].overloadTable[arguments.length].apply(this,arguments)},X[q].overloadTable=[],X[q].overloadTable[Ee.argCount]=Ee}}function Al(X,q,de){a.hasOwnProperty(X)?(Ut("Cannot register public name '"+X+"' twice"),bo(a,X,X),a.hasOwnProperty(de)&&Ut("Cannot register multiple overloads of a function with the same number of arguments ("+de+")!"),a[X].overloadTable[de]=q):a[X]=q}function Ps(X,q,de,Ee,Ue,ot,Ze,qe){this.name=X,this.constructor=q,this.instancePrototype=de,this.rawDestructor=Ee,this.baseClass=Ue,this.getActualType=ot,this.upcast=Ze,this.downcast=qe,this.pureVirtualFunctions=[]}function Ll(X,q,de){for(;q!==de;)q.upcast||Ut("Expected null or instance of "+de.name+", got an instance of "+q.name),X=q.upcast(X),q=q.baseClass;return X}function So(X,q){if(q===null)return this.isReference&&Ut("null is not a valid "+this.name),0;q.$$||Ut('Cannot pass "'+pc(q)+'" as a '+this.name),q.$$.ptr||Ut("Cannot pass deleted object as a pointer of type "+this.name);var de=q.$$.ptrType.registeredClass,Ee=Ll(q.$$.ptr,de,this.registeredClass);return Ee}function Ud(X,q){var de;if(q===null)return this.isReference&&Ut("null is not a valid "+this.name),this.isSmartPointer?(de=this.rawConstructor(),X!==null&&X.push(this.rawDestructor,de),de):0;q.$$||Ut('Cannot pass "'+pc(q)+'" as a '+this.name),q.$$.ptr||Ut("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&q.$$.ptrType.isConst&&Ut("Cannot convert argument of type "+(q.$$.smartPtrType?q.$$.smartPtrType.name:q.$$.ptrType.name)+" to parameter type "+this.name);var Ee=q.$$.ptrType.registeredClass;if(de=Ll(q.$$.ptr,Ee,this.registeredClass),this.isSmartPointer)switch(q.$$.smartPtr===void 0&&Ut("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:q.$$.smartPtrType===this?de=q.$$.smartPtr:Ut("Cannot convert argument of type "+(q.$$.smartPtrType?q.$$.smartPtrType.name:q.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:de=q.$$.smartPtr;break;case 2:if(q.$$.smartPtrType===this)de=q.$$.smartPtr;else{var Ue=q.clone();de=this.rawShare(de,Bi.toHandle(function(){Ue.delete()})),X!==null&&X.push(this.rawDestructor,de)}break;default:Ut("Unsupporting sharing policy")}return de}function Ua(X,q){if(q===null)return this.isReference&&Ut("null is not a valid "+this.name),0;q.$$||Ut('Cannot pass "'+pc(q)+'" as a '+this.name),q.$$.ptr||Ut("Cannot pass deleted object as a pointer of type "+this.name),q.$$.ptrType.isConst&&Ut("Cannot convert argument of type "+q.$$.ptrType.name+" to parameter type "+this.name);var de=q.$$.ptrType.registeredClass,Ee=Ll(q.$$.ptr,de,this.registeredClass);return Ee}function Iu(X){return this.rawGetPointee&&(X=this.rawGetPointee(X)),X}function Df(X){this.rawDestructor&&this.rawDestructor(X)}function eo(X){X!==null&&X.delete()}function aa(){to.prototype.getPointee=Iu,to.prototype.destructor=Df,to.prototype.argPackAdvance=8,to.prototype.readValueFromPointer=kn,to.prototype.deleteObject=eo,to.prototype.fromWireType=cc}function to(X,q,de,Ee,Ue,ot,Ze,qe,j,z,P){this.name=X,this.registeredClass=q,this.isReference=de,this.isConst=Ee,this.isSmartPointer=Ue,this.pointeeType=ot,this.sharingPolicy=Ze,this.rawGetPointee=qe,this.rawConstructor=j,this.rawShare=z,this.rawDestructor=P,!Ue&&q.baseClass===void 0?Ee?(this.toWireType=So,this.destructorFunction=null):(this.toWireType=Ua,this.destructorFunction=null):this.toWireType=Ud}function oa(X,q,de){a.hasOwnProperty(X)||Xt("Replacing nonexistant public symbol"),a[X].overloadTable!==void 0&&de!==void 0||(a[X]=q,a[X].argCount=de)}function ks(X,q,de){var Ee=a["dynCall_"+X];return de&&de.length?Ee.apply(null,[q].concat(de)):Ee.call(null,q)}var uc=[];function fc(X){var q=uc[X];return q||(X>=uc.length&&(uc.length=X+1),uc[X]=q=Oe.get(X)),q}function ui(X,q,de){if(X.includes("j"))return ks(X,q,de);var Ee=fc(q).apply(null,de);return Ee}function Vl(X,q){var de=[];return function(){return de.length=0,Object.assign(de,arguments),ui(X,q,de)}}function no(X,q){X=Dt(X);function de(){return X.includes("j")?Vl(X,q):fc(q)}var Ee=de();return typeof Ee!="function"&&Ut("unknown function pointer with signature "+X+": "+q),Ee}var sa=void 0;function dc(X){var q=Je(X),de=Dt(q);return Qe(q),de}function cs(X,q){var de=[],Ee={};function Ue(ot){if(!Ee[ot]&&!Ae[ot]){if(at[ot]){at[ot].forEach(Ue);return}de.push(ot),Ee[ot]=!0}}throw q.forEach(Ue),new sa(X+": "+de.map(dc).join([", "]))}function Sa(X,q,de,Ee,Ue,ot,Ze,qe,j,z,P,A,H){P=Dt(P),ot=no(Ue,ot),qe&&(qe=no(Ze,qe)),z&&(z=no(j,z)),H=no(A,H);var le=jt(P);Al(le,function(){cs("Cannot construct "+P+" due to unbound types",[Ee])}),Un([X,q,de],Ee?[Ee]:[],function(he){he=he[0];var ve,xe;Ee?(ve=he.registeredClass,xe=ve.instancePrototype):xe=Er.prototype;var _e=gn(le,function(){if(Object.getPrototypeOf(this)!==ke)throw new Gt("Use 'new' to construct "+P);if(Xe.constructor_body===void 0)throw new Gt(P+" has no accessible constructor");var dn=Xe.constructor_body[arguments.length];if(dn===void 0)throw new Gt("Tried to invoke ctor of "+P+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Xe.constructor_body).toString()+") parameters instead!");return dn.apply(this,arguments)}),ke=Object.create(xe,{constructor:{value:_e}});_e.prototype=ke;var Xe=new Ps(P,_e,ke,H,ve,ot,qe,z),gt=new to(P,Xe,!0,!1,!1),Nt=new to(P+"*",Xe,!1,!1,!1),_t=new to(P+" const*",Xe,!1,!0,!1);return Zt[X]={pointerType:Nt,constPointerType:_t},oa(le,_e),[gt,Nt,_t]})}function Co(X,q){for(var de=[],Ee=0;Ee<X;Ee++)de.push(re[q+Ee*4>>2]);return de}function As(X,q){if(!(X instanceof Function))throw new TypeError("new_ called with constructor type "+typeof X+" which is not a function");var de=gn(X.name||"unknownFunctionName",function(){});de.prototype=X.prototype;var Ee=new de,Ue=X.apply(Ee,q);return Ue instanceof Object?Ue:Ee}function Nu(X,q,de,Ee,Ue){var ot=q.length;ot<2&&Ut("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var Ze=q[1]!==null&&de!==null,qe=!1,j=1;j<q.length;++j)if(q[j]!==null&&q[j].destructorFunction===void 0){qe=!0;break}for(var z=q[0].name!=="void",P="",A="",j=0;j<ot-2;++j)P+=(j!==0?", ":"")+"arg"+j,A+=(j!==0?", ":"")+"arg"+j+"Wired";var H="return function "+jt(X)+"("+P+`) {
if (arguments.length !== `+(ot-2)+`) {
throwBindingError('function `+X+" called with ' + arguments.length + ' arguments, expected "+(ot-2)+` args!');
}
`;qe&&(H+=`var destructors = [];
`);var le=qe?"destructors":"null",he=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],ve=[Ut,Ee,Ue,hn,q[0],q[1]];Ze&&(H+="var thisWired = classParam.toWireType("+le+`, this);
`);for(var j=0;j<ot-2;++j)H+="var arg"+j+"Wired = argType"+j+".toWireType("+le+", arg"+j+"); // "+q[j+2].name+`
`,he.push("argType"+j),ve.push(q[j+2]);if(Ze&&(A="thisWired"+(A.length>0?", ":"")+A),H+=(z?"var rv = ":"")+"invoker(fn"+(A.length>0?", ":"")+A+`);
`,qe)H+=`runDestructors(destructors);
`;else for(var j=Ze?1:2;j<q.length;++j){var xe=j===1?"thisWired":"arg"+(j-2)+"Wired";q[j].destructorFunction!==null&&(H+=xe+"_dtor("+xe+"); // "+q[j].name+`
`,he.push(xe+"_dtor"),ve.push(q[j].destructorFunction))}z&&(H+=`var ret = retType.fromWireType(rv);
return ret;
`),H+=`}
`,he.push(H);var _e=As(Function,he).apply(null,ve);return _e}function hc(X,q,de,Ee,Ue,ot){V(q>0);var Ze=Co(q,de);Ue=no(Ee,Ue),Un([],[X],function(qe){qe=qe[0];var j="constructor "+qe.name;if(qe.registeredClass.constructor_body===void 0&&(qe.registeredClass.constructor_body=[]),qe.registeredClass.constructor_body[q-1]!==void 0)throw new Gt("Cannot register multiple constructors with identical number of parameters ("+(q-1)+") for class '"+qe.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return qe.registeredClass.constructor_body[q-1]=()=>{cs("Cannot construct "+qe.name+" due to unbound types",Ze)},Un([],Ze,function(z){return z.splice(1,0,null),qe.registeredClass.constructor_body[q-1]=Nu(j,z,null,Ue,ot),[]}),[]})}function jr(X,q,de,Ee,Ue,ot,Ze,qe){var j=Co(de,Ee);q=Dt(q),ot=no(Ue,ot),Un([],[X],function(z){z=z[0];var P=z.name+"."+q;q.startsWith("@@")&&(q=Symbol[q.substring(2)]),qe&&z.registeredClass.pureVirtualFunctions.push(q);function A(){cs("Cannot call "+P+" due to unbound types",j)}var H=z.registeredClass.instancePrototype,le=H[q];return le===void 0||le.overloadTable===void 0&&le.className!==z.name&&le.argCount===de-2?(A.argCount=de-2,A.className=z.name,H[q]=A):(bo(H,q,P),H[q].overloadTable[de-2]=A),Un([],j,function(he){var ve=Nu(P,he,z,ot,Ze);return H[q].overloadTable===void 0?(ve.argCount=de-2,H[q]=ve):H[q].overloadTable[de-2]=ve,[]}),[]})}var zo=[],Ur=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Si(X){X>4&&--Ur[X].refcount===0&&(Ur[X]=void 0,zo.push(X))}function gc(){for(var X=0,q=5;q<Ur.length;++q)Ur[q]!==void 0&&++X;return X}function Ci(){for(var X=5;X<Ur.length;++X)if(Ur[X]!==void 0)return Ur[X];return null}function Pu(){a.count_emval_handles=gc,a.get_first_emval=Ci}var Bi={toValue:X=>(X||Ut("Cannot use deleted val. handle = "+X),Ur[X].value),toHandle:X=>{switch(X){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var q=zo.length?zo.pop():Ur.length;return Ur[q]={refcount:1,value:X},q}}}};function Go(X,q){q=Dt(q),un(X,{name:q,fromWireType:function(de){var Ee=Bi.toValue(de);return Si(de),Ee},toWireType:function(de,Ee){return Bi.toHandle(Ee)},argPackAdvance:8,readValueFromPointer:kn,destructorFunction:null})}function pc(X){if(X===null)return"null";var q=typeof X;return q==="object"||q==="array"||q==="function"?X.toString():""+X}function ls(X,q){switch(q){case 2:return function(de){return this.fromWireType(te[de>>2])};case 3:return function(de){return this.fromWireType(ye[de>>3])};default:throw new TypeError("Unknown float type: "+X)}}function Fa(X,q,de){var Ee=wi(de);q=Dt(q),un(X,{name:q,fromWireType:function(Ue){return Ue},toWireType:function(Ue,ot){return ot},argPackAdvance:8,readValueFromPointer:ls(q,Ee),destructorFunction:null})}function zi(X,q,de){switch(q){case 0:return de?function(Ue){return Y[Ue]}:function(Ue){return J[Ue]};case 1:return de?function(Ue){return ne[Ue>>1]}:function(Ue){return F[Ue>>1]};case 2:return de?function(Ue){return ae[Ue>>2]}:function(Ue){return re[Ue>>2]};default:throw new TypeError("Unknown integer type: "+X)}}function Ls(X,q,de,Ee,Ue){q=Dt(q);var ot=wi(de),Ze=A=>A;if(Ee===0){var qe=32-8*de;Ze=A=>A<<qe>>>qe}var j=q.includes("unsigned"),z=(A,H)=>{},P;j?P=function(A,H){return z(H,this.name),H>>>0}:P=function(A,H){return z(H,this.name),H},un(X,{name:q,fromWireType:Ze,toWireType:P,argPackAdvance:8,readValueFromPointer:zi(q,ot,Ee!==0),destructorFunction:null})}function $l(X,q,de){var Ee=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Ue=Ee[q];function ot(Ze){Ze=Ze>>2;var qe=re,j=qe[Ze],z=qe[Ze+1];return new Ue(U,z,j)}de=Dt(de),un(X,{name:de,fromWireType:ot,argPackAdvance:8,readValueFromPointer:ot},{ignoreDuplicateRegistrations:!0})}function mc(X,q){q=Dt(q);var de=q==="std::string";un(X,{name:q,fromWireType:function(Ee){var Ue=re[Ee>>2],ot=Ee+4,Ze;if(de)for(var qe=ot,j=0;j<=Ue;++j){var z=ot+j;if(j==Ue||J[z]==0){var P=z-qe,A=$(qe,P);Ze===void 0?Ze=A:(Ze+="\0",Ze+=A),qe=z+1}}else{for(var H=new Array(Ue),j=0;j<Ue;++j)H[j]=String.fromCharCode(J[ot+j]);Ze=H.join("")}return Qe(Ee),Ze},toWireType:function(Ee,Ue){Ue instanceof ArrayBuffer&&(Ue=new Uint8Array(Ue));var ot,Ze=typeof Ue=="string";Ze||Ue instanceof Uint8Array||Ue instanceof Uint8ClampedArray||Ue instanceof Int8Array||Ut("Cannot pass non-string to std::string"),de&&Ze?ot=oe(Ue):ot=Ue.length;var qe=Be(4+ot+1),j=qe+4;if(re[qe>>2]=ot,de&&Ze)G(Ue,j,ot+1);else if(Ze)for(var z=0;z<ot;++z){var P=Ue.charCodeAt(z);P>255&&(Qe(j),Ut("String has UTF-16 code units that do not fit in 8 bits")),J[j+z]=P}else for(var z=0;z<ot;++z)J[j+z]=Ue[z];return Ee!==null&&Ee.push(Qe,qe),qe},argPackAdvance:8,readValueFromPointer:kn,destructorFunction:function(Ee){Qe(Ee)}})}var qc=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function jl(X,q){for(var de=X,Ee=de>>1,Ue=Ee+q/2;!(Ee>=Ue)&&F[Ee];)++Ee;if(de=Ee<<1,de-X>32&&qc)return qc.decode(J.subarray(X,de));for(var ot="",Ze=0;!(Ze>=q/2);++Ze){var qe=ne[X+Ze*2>>1];if(qe==0)break;ot+=String.fromCharCode(qe)}return ot}function Kc(X,q,de){if(de===void 0&&(de=2147483647),de<2)return 0;de-=2;for(var Ee=q,Ue=de<X.length*2?de/2:X.length,ot=0;ot<Ue;++ot){var Ze=X.charCodeAt(ot);ne[q>>1]=Ze,q+=2}return ne[q>>1]=0,q-Ee}function Yc(X){return X.length*2}function Ul(X,q){for(var de=0,Ee="";!(de>=q/4);){var Ue=ae[X+de*4>>2];if(Ue==0)break;if(++de,Ue>=65536){var ot=Ue-65536;Ee+=String.fromCharCode(55296|ot>>10,56320|ot&1023)}else Ee+=String.fromCharCode(Ue)}return Ee}function Mf(X,q,de){if(de===void 0&&(de=2147483647),de<4)return 0;for(var Ee=q,Ue=Ee+de-4,ot=0;ot<X.length;++ot){var Ze=X.charCodeAt(ot);if(Ze>=55296&&Ze<=57343){var qe=X.charCodeAt(++ot);Ze=65536+((Ze&1023)<<10)|qe&1023}if(ae[q>>2]=Ze,q+=4,q+4>Ue)break}return ae[q>>2]=0,q-Ee}function Fd(X){for(var q=0,de=0;de<X.length;++de){var Ee=X.charCodeAt(de);Ee>=55296&&Ee<=57343&&++de,q+=4}return q}function Bd(X,q,de){de=Dt(de);var Ee,Ue,ot,Ze,qe;q===2?(Ee=jl,Ue=Kc,Ze=Yc,ot=()=>F,qe=1):q===4&&(Ee=Ul,Ue=Mf,Ze=Fd,ot=()=>re,qe=2),un(X,{name:de,fromWireType:function(j){for(var z=re[j>>2],P=ot(),A,H=j+4,le=0;le<=z;++le){var he=j+4+le*q;if(le==z||P[he>>qe]==0){var ve=he-H,xe=Ee(H,ve);A===void 0?A=xe:(A+="\0",A+=xe),H=he+q}}return Qe(j),A},toWireType:function(j,z){typeof z!="string"&&Ut("Cannot pass non-string to C++ string type "+de);var P=Ze(z),A=Be(4+P+q);return re[A>>2]=P>>qe,Ue(z,A+4,P+q),j!==null&&j.push(Qe,A),A},argPackAdvance:8,readValueFromPointer:kn,destructorFunction:function(j){Qe(j)}})}function zd(X,q,de,Ee,Ue,ot){Sr[X]={name:Dt(q),rawConstructor:no(de,Ee),rawDestructor:no(Ue,ot),fields:[]}}function ku(X,q,de,Ee,Ue,ot,Ze,qe,j,z){Sr[X].fields.push({fieldName:Dt(q),getterReturnType:de,getter:no(Ee,Ue),getterContext:ot,setterArgumentType:Ze,setter:no(qe,j),setterContext:z})}function Rf(X,q){q=Dt(q),un(X,{isVoid:!0,name:q,argPackAdvance:0,fromWireType:function(){},toWireType:function(de,Ee){}})}var Gd={};function If(X){var q=Gd[X];return q===void 0?Dt(X):q}function Nf(){return typeof globalThis=="object"?globalThis:(function(){return Function})()("return this")()}function Wd(X){return X===0?Bi.toHandle(Nf()):(X=If(X),Bi.toHandle(Nf()[X]))}function Fl(X){X>4&&(Ur[X].refcount+=1)}function Pf(X,q){var de=Ae[X];return de===void 0&&Ut(q+" has unknown type "+dc(X)),de}function kf(X){for(var q="",de=0;de<X;++de)q+=(de!==0?", ":"")+"arg"+de;for(var Ee=()=>re,Ue="return function emval_allocator_"+X+`(constructor, argTypes, args) {
  var HEAPU32 = getMemory();
`,de=0;de<X;++de)Ue+="var argType"+de+" = requireRegisteredType(HEAPU32[((argTypes)>>2)], 'parameter "+de+`');
var arg`+de+" = argType"+de+`.readValueFromPointer(args);
args += argType`+de+`['argPackAdvance'];
argTypes += 4;
`;return Ue+="var obj = new constructor("+q+`);
return valueToHandle(obj);
}
`,new Function("requireRegisteredType","Module","valueToHandle","getMemory",Ue)(Pf,a,Bi.toHandle,Ee)}var Au={};function Hd(X,q,de,Ee){X=Bi.toValue(X);var Ue=Au[q];return Ue||(Ue=kf(q),Au[q]=Ue),Ue(X,de,Ee)}function Bl(X,q){X=Pf(X,"_emval_take_value");var de=X.readValueFromPointer(q);return Bi.toHandle(de)}function qd(){ue("")}function Af(){return 2147483648}function Kd(){return Af()}function Lf(X,q,de){J.copyWithin(X,q,q+de)}function Yd(X){try{return M.grow(X-U.byteLength+65535>>>16),we(M.buffer),1}catch{}}function Xd(X){var q=J.length;X=X>>>0;var de=Af();if(X>de)return!1;let Ee=(j,z)=>j+(z-j%z)%z;for(var Ue=1;Ue<=4;Ue*=2){var ot=q*(1+.2/Ue);ot=Math.min(ot,X+100663296);var Ze=Math.min(de,Ee(Math.max(X,ot),65536)),qe=Yd(Ze);if(qe)return!0}return!1}var Lu={};function Vu(){return l||"./this.program"}function Vs(){if(!Vs.strings){var X=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",q={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:X,_:Vu()};for(var de in Lu)Lu[de]===void 0?delete q[de]:q[de]=Lu[de];var Ee=[];for(var de in q)Ee.push(de+"="+q[de]);Vs.strings=Ee}return Vs.strings}function vc(X,q,de){for(var Ee=0;Ee<X.length;++Ee)Y[q++>>0]=X.charCodeAt(Ee);Y[q>>0]=0}function Wo(X,q){var de=0;return Vs().forEach(function(Ee,Ue){var ot=q+de;re[X+Ue*4>>2]=ot,vc(Ee,ot),de+=Ee.length+1}),0}function Vf(X,q){var de=Vs();re[X>>2]=de.length;var Ee=0;return de.forEach(function(Ue){Ee+=Ue.length+1}),re[q>>2]=Ee,0}function $f(X){return 52}function Xc(X,q,de,Ee,Ue){return 70}var yc=[null,[],[]];function zl(X,q){var de=yc[X];q===0||q===10?((X===1?_:T)(L(de,0)),de.length=0):de.push(q)}function $u(X,q,de,Ee){for(var Ue=0,ot=0;ot<de;ot++){var Ze=re[q>>2],qe=re[q+4>>2];q+=8;for(var j=0;j<qe;j++)zl(X,J[Ze+j]);Ue+=qe}return re[Ee>>2]=Ue,0}function Q(X){var q=a["_"+X];return q}function ee(X,q){Y.set(X,q)}function me(X,q,de,Ee,Ue){var ot={string:he=>{var ve=0;if(he!=null&&he!==0){var xe=(he.length<<2)+1;ve=mt(xe),G(he,ve,xe)}return ve},array:he=>{var ve=mt(he.length);return ee(he,ve),ve}};function Ze(he){return q==="string"?$(he):q==="boolean"?!!he:he}var qe=Q(X),j=[],z=0;if(Ee)for(var P=0;P<Ee.length;P++){var A=ot[de[P]];A?(z===0&&(z=Ge()),j[P]=A(Ee[P])):j[P]=Ee[P]}var H=qe.apply(null,j);function le(he){return z!==0&&tt(z),Ze(he)}return H=le(H),H}rn=a.InternalError=Kn(Error,"InternalError"),Vn(),Gt=a.BindingError=Kn(Error,"BindingError"),Ru(),Mu(),aa(),sa=a.UnboundTypeError=Kn(Error,"UnboundTypeError"),Pu();var Pe={D:Sn,e:Bn,t:pr,B:Zr,r:Sa,q:hc,b:jr,A:Go,l:Fa,d:Ls,a:$l,k:mc,f:Bd,g:zd,c:ku,C:Rf,h:Si,o:Wd,m:Fl,n:Hd,p:Bl,i:qd,v:Kd,z:Lf,u:Xd,w:Wo,x:Vf,y:$f,s:Xc,j:$u};et(),a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.F).apply(null,arguments)};var Be=a._malloc=function(){return(Be=a._malloc=a.asm.H).apply(null,arguments)},Qe=a._free=function(){return(Qe=a._free=a.asm.I).apply(null,arguments)},Je=a.___getTypeName=function(){return(Je=a.___getTypeName=a.asm.J).apply(null,arguments)};a.__embind_initialize_bindings=function(){return(a.__embind_initialize_bindings=a.asm.K).apply(null,arguments)};var Ge=a.stackSave=function(){return(Ge=a.stackSave=a.asm.L).apply(null,arguments)},tt=a.stackRestore=function(){return(tt=a.stackRestore=a.asm.M).apply(null,arguments)},mt=a.stackAlloc=function(){return(mt=a.stackAlloc=a.asm.N).apply(null,arguments)},At=a.___cxa_is_pointer_type=function(){return(At=a.___cxa_is_pointer_type=a.asm.O).apply(null,arguments)};a.dynCall_iji=function(){return(a.dynCall_iji=a.asm.P).apply(null,arguments)},a.dynCall_jji=function(){return(a.dynCall_jji=a.asm.Q).apply(null,arguments)},a.dynCall_iiji=function(){return(a.dynCall_iiji=a.asm.R).apply(null,arguments)},a.dynCall_jiji=function(){return(a.dynCall_jiji=a.asm.S).apply(null,arguments)},a.ccall=me;var Wt;en=function X(){Wt||an(),Wt||(en=X)};function an(X){if(ln>0||(Ye(),ln>0))return;function q(){Wt||(Wt=!0,a.calledRun=!0,!I&&(ft(),o(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),je()))}a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),q()},1)):q()}if(a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return an(),i.ready})})();t.exports=n})(wI)),wI.exports}var uBt=lBt();const fBt=ka(uBt),dBt=new URL("/assets/openjpegwasm_decode-C4nnCcr6.wasm",import.meta.url),I5={codec:void 0,decoder:void 0,decodeConfig:{}};function hBt(t){if(I5.decodeConfig=t,I5.codec)return Promise.resolve();const e=fBt({locateFile:n=>n.endsWith(".wasm")?dBt.toString():n});return new Promise((n,r)=>{e.then(i=>{I5.codec=i,I5.decoder=new i.J2KDecoder,n()},r)})}async function Sre(t,e){await hBt();const n=I5.decoder,r=n.getEncodedBuffer(t.length);r.set(t),n.decode();const i=n.getFrameInfo(),a=n.getDecodedBuffer();new Uint8Array(a.length).set(a);const s=`x: ${n.getImageOffset().x}, y: ${n.getImageOffset().y}`,c=n.getNumDecompositions(),l=n.getNumLayers(),u=["unknown","LRCP","RLCP","RPCL","PCRL","CPRL"][n.getProgressionOrder()+1],f=n.getIsReversible(),d=`${n.getBlockDimensions().width} x ${n.getBlockDimensions().height}`,h=`${n.getTileSize().width} x ${n.getTileSize().height}`,m=`${n.getTileOffset().x}, ${n.getTileOffset().y}`,p=n.getColorSpace(),y=`${a.length.toLocaleString()} bytes`,x=`${(a.length/r.length).toFixed(2)}:1`,S={columns:i.width,rows:i.height,bitsPerPixel:i.bitsPerSample,signed:i.isSigned,bytesPerPixel:e.bytesPerPixel,componentsPerPixel:i.componentCount},C=gBt(i,a),_={imageOffset:s,numDecompositions:c,numLayers:l,progessionOrder:u,reversible:f,blockDimensions:d,tileSize:h,tileOffset:m,colorTransform:p,decodedSize:y,compressionRatio:x};return{...e,pixelData:C,imageInfo:S,encodeOptions:_,..._,...S}}function gBt(t,e){return t.bitsPerSample>8?t.isSigned?new Int16Array(e.buffer,e.byteOffset,e.byteLength/2):new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2):t.isSigned?new Int8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var bI={exports:{}},Cre;function pBt(){return Cre||(Cre=1,(function(t,e){var n=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),(function(a){a=a||{};var a=typeof a<"u"?a:{},o,s;a.ready=new Promise(function(j,z){o=j,s=z});var c=Object.assign({},a),l=typeof window=="object",u=typeof importScripts=="function",f=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",d="";function h(j){return a.locateFile?a.locateFile(j,d):d+j}var m,p,y;if(f){var x=Cd,S=Cd;u?d=S.dirname(d)+"/":d=__dirname+"/",m=(j,z)=>(j=K(j)?new URL(j):S.normalize(j),x.readFileSync(j,z?void 0:"utf8")),y=j=>{var z=m(j,!0);return z.buffer||(z=new Uint8Array(z)),z},p=(j,z,P)=>{j=K(j)?new URL(j):S.normalize(j),x.readFile(j,function(A,H){A?P(A):z(H.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(j){if(!(j instanceof et))throw j}),process.on("unhandledRejection",function(j){throw j}),a.inspect=function(){return"[Emscripten Module object]"}}else(l||u)&&(u?d=self.location.href:typeof document<"u"&&document.currentScript&&(d=document.currentScript.src),r&&(d=r),d.indexOf("blob:")!==0?d=d.substr(0,d.replace(/[?#].*/,"").lastIndexOf("/")+1):d="",m=j=>{var z=new XMLHttpRequest;return z.open("GET",j,!1),z.send(null),z.responseText},u&&(y=j=>{var z=new XMLHttpRequest;return z.open("GET",j,!1),z.responseType="arraybuffer",z.send(null),new Uint8Array(z.response)}),p=(j,z,P)=>{var A=new XMLHttpRequest;A.open("GET",j,!0),A.responseType="arraybuffer",A.onload=()=>{if(A.status==200||A.status==0&&A.response){z(A.response);return}P()},A.onerror=P,A.send(null)});var C=a.print||console.log.bind(console),_=a.printErr||console.warn.bind(console);Object.assign(a,c),c=null,a.arguments&&a.arguments,a.thisProgram&&a.thisProgram,a.quit&&a.quit;var T;a.wasmBinary&&(T=a.wasmBinary),a.noExitRuntime,typeof WebAssembly!="object"&&Ke("no native wasm support detected");var O,M=!1;function I(j,z){j||Ke(z)}var V=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function k(j,z,P){for(var A=z+P,H=z;j[H]&&!(H>=A);)++H;if(H-z>16&&j.buffer&&V)return V.decode(j.subarray(z,H));for(var le="";z<H;){var he=j[z++];if(!(he&128)){le+=String.fromCharCode(he);continue}var ve=j[z++]&63;if((he&224)==192){le+=String.fromCharCode((he&31)<<6|ve);continue}var xe=j[z++]&63;if((he&240)==224?he=(he&15)<<12|ve<<6|xe:he=(he&7)<<18|ve<<12|xe<<6|j[z++]&63,he<65536)le+=String.fromCharCode(he);else{var _e=he-65536;le+=String.fromCharCode(55296|_e>>10,56320|_e&1023)}}return le}function L(j,z){return j?k(Y,j,z):""}function $(j,z,P,A){if(!(A>0))return 0;for(var H=P,le=P+A-1,he=0;he<j.length;++he){var ve=j.charCodeAt(he);if(ve>=55296&&ve<=57343){var xe=j.charCodeAt(++he);ve=65536+((ve&1023)<<10)|xe&1023}if(ve<=127){if(P>=le)break;z[P++]=ve}else if(ve<=2047){if(P+1>=le)break;z[P++]=192|ve>>6,z[P++]=128|ve&63}else if(ve<=65535){if(P+2>=le)break;z[P++]=224|ve>>12,z[P++]=128|ve>>6&63,z[P++]=128|ve&63}else{if(P+3>=le)break;z[P++]=240|ve>>18,z[P++]=128|ve>>12&63,z[P++]=128|ve>>6&63,z[P++]=128|ve&63}}return z[P]=0,P-H}function W(j,z,P){return $(j,Y,z,P)}function G(j){for(var z=0,P=0;P<j.length;++P){var A=j.charCodeAt(P);A<=127?z++:A<=2047?z+=2:A>=55296&&A<=57343?(z+=4,++P):z+=3}return z}var oe,U,Y,J,ne,F,ae,re,te;function ye(j){oe=j,a.HEAP8=U=new Int8Array(j),a.HEAP16=J=new Int16Array(j),a.HEAP32=F=new Int32Array(j),a.HEAPU8=Y=new Uint8Array(j),a.HEAPU16=ne=new Uint16Array(j),a.HEAPU32=ae=new Uint32Array(j),a.HEAPF32=re=new Float32Array(j),a.HEAPF64=te=new Float64Array(j)}a.INITIAL_MEMORY;var we,Oe=[],Te=[],Me=[];function be(){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)je(a.preRun.shift());wt(Oe)}function Ye(){wt(Te)}function ft(){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;)Rt(a.postRun.shift());wt(Me)}function je(j){Oe.unshift(j)}function It(j){Te.unshift(j)}function Rt(j){Me.unshift(j)}var cn=0,ln=null;function en(j){cn++,a.monitorRunDependencies&&a.monitorRunDependencies(cn)}function tr(j){if(cn--,a.monitorRunDependencies&&a.monitorRunDependencies(cn),cn==0&&ln){var z=ln;ln=null,z()}}function Ke(j){a.onAbort&&a.onAbort(j),j="Aborted("+j+")",_(j),M=!0,j+=". Build with -sASSERTIONS for more info.";var z=new WebAssembly.RuntimeError(j);throw s(z),z}var ue="data:application/octet-stream;base64,";function B(j){return j.startsWith(ue)}function K(j){return j.startsWith("file://")}var fe;fe="openjphjs.wasm",B(fe)||(fe=h(fe));function ie(j){try{if(j==fe&&T)return new Uint8Array(T);if(y)return y(j);throw"both async and sync fetching of the wasm failed"}catch(z){Ke(z)}}function pe(){if(!T&&(l||u)){if(typeof fetch=="function"&&!K(fe))return fetch(fe,{credentials:"same-origin"}).then(function(j){if(!j.ok)throw"failed to load wasm binary file at '"+fe+"'";return j.arrayBuffer()}).catch(function(){return ie(fe)});if(p)return new Promise(function(j,z){p(fe,function(P){j(new Uint8Array(P))},z)})}return Promise.resolve().then(function(){return ie(fe)})}function Re(){var j={env:Q,wasi_snapshot_preview1:Q};function z(he,ve){var xe=he.exports;a.asm=xe,O=a.asm.memory,ye(O.buffer),we=a.asm.__indirect_function_table,It(a.asm.__wasm_call_ctors),tr()}en();function P(he){z(he.instance)}function A(he){return pe().then(function(ve){return WebAssembly.instantiate(ve,j)}).then(function(ve){return ve}).then(he,function(ve){_("failed to asynchronously prepare wasm: "+ve),Ke(ve)})}function H(){return!T&&typeof WebAssembly.instantiateStreaming=="function"&&!B(fe)&&!K(fe)&&!f&&typeof fetch=="function"?fetch(fe,{credentials:"same-origin"}).then(function(he){var ve=WebAssembly.instantiateStreaming(he,j);return ve.then(P,function(xe){return _("wasm streaming compile failed: "+xe),_("falling back to ArrayBuffer instantiation"),A(P)})}):A(P)}if(a.instantiateWasm)try{var le=a.instantiateWasm(j,z);return le}catch(he){_("Module.instantiateWasm callback failed with error: "+he),s(he)}return H().catch(s),{}}function et(j){this.name="ExitStatus",this.message="Program terminated with exit("+j+")",this.status=j}function wt(j){for(;j.length>0;)j.shift()(a)}function Pt(j,z,P,A){Ke("Assertion failed: "+L(j)+", at: "+[z?L(z):"unknown filename",P,A?L(A):"unknown function"])}var Ln=[];function Sn(j){j.add_ref()}function Sr(j){var z=new ct(j);return z.get_caught()||z.set_caught(!0),z.set_rethrown(!1),Ln.push(z),Sn(z),z.get_exception_ptr()}var hn=0,kn=[];function Mn(j){var z=kn[j];return z||(j>=kn.length&&(kn.length=j+1),kn[j]=z=we.get(j)),z}function Ae(j){if(j.release_ref()&&!j.get_rethrown()){var z=j.get_destructor();z&&Mn(z)(j.excPtr),Pe(j.excPtr)}}function at(){_setThrew(0);var j=Ln.pop();Ae(j),hn=0}function ct(j){this.excPtr=j,this.ptr=j-24,this.set_type=function(z){ae[this.ptr+4>>2]=z},this.get_type=function(){return ae[this.ptr+4>>2]},this.set_destructor=function(z){ae[this.ptr+8>>2]=z},this.get_destructor=function(){return ae[this.ptr+8>>2]},this.set_refcount=function(z){F[this.ptr>>2]=z},this.set_caught=function(z){z=z?1:0,U[this.ptr+12>>0]=z},this.get_caught=function(){return U[this.ptr+12>>0]!=0},this.set_rethrown=function(z){z=z?1:0,U[this.ptr+13>>0]=z},this.get_rethrown=function(){return U[this.ptr+13>>0]!=0},this.init=function(z,P){this.set_adjusted_ptr(0),this.set_type(z),this.set_destructor(P),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var z=F[this.ptr>>2];F[this.ptr>>2]=z+1},this.release_ref=function(){var z=F[this.ptr>>2];return F[this.ptr>>2]=z-1,z===1},this.set_adjusted_ptr=function(z){ae[this.ptr+16>>2]=z},this.get_adjusted_ptr=function(){return ae[this.ptr+16>>2]},this.get_exception_ptr=function(){var z=At(this.get_type());if(z)return ae[this.excPtr>>2];var P=this.get_adjusted_ptr();return P!==0?P:this.excPtr}}function kt(j){throw hn||(hn=j),j}function jt(){var j=hn;if(!j)return Qe(0),0;var z=new ct(j);z.set_adjusted_ptr(j);var P=z.get_type();if(!P)return Qe(0),j;for(var A=0;A<arguments.length;A++){var H=arguments[A];if(H===0||H===P)break;var le=z.ptr+16;if(mt(H,P,le))return Qe(H),j}return Qe(P),j}function gn(){var j=hn;if(!j)return Qe(0),0;var z=new ct(j);z.set_adjusted_ptr(j);var P=z.get_type();if(!P)return Qe(0),j;for(var A=0;A<arguments.length;A++){var H=arguments[A];if(H===0||H===P)break;var le=z.ptr+16;if(mt(H,P,le))return Qe(H),j}return Qe(P),j}function Kn(j,z,P){var A=new ct(j);throw A.init(z,P),hn=j,j}var rn={};function Xt(j){for(;j.length;){var z=j.pop(),P=j.pop();P(z)}}function Un(j){return this.fromWireType(F[j>>2])}var Bn={},pr={},wi={},Vn=48,mr=57;function Dt(j){if(j===void 0)return"_unknown";j=j.replace(/[^a-zA-Z0-9_]/g,"$");var z=j.charCodeAt(0);return z>=Vn&&z<=mr?"_"+j:j}function Gt(j,z){return j=Dt(j),new Function("body","return function "+j+`() {
    "use strict";    return body.apply(this, arguments);
};
`)(z)}function Ut(j,z){var P=Gt(z,function(A){this.name=z,this.message=A;var H=new Error(A).stack;H!==void 0&&(this.stack=this.toString()+`
`+H.replace(/^Error(:[^\n]*)?\n/,""))});return P.prototype=Object.create(j.prototype),P.prototype.constructor=P,P.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},P}var un=void 0;function Zr(j){throw new un(j)}function xo(j,z,P){j.forEach(function(ve){wi[ve]=z});function A(ve){var xe=P(ve);xe.length!==j.length&&Zr("Mismatched type converter count");for(var _e=0;_e<j.length;++_e)Ui(j[_e],xe[_e])}var H=new Array(z.length),le=[],he=0;z.forEach((ve,xe)=>{pr.hasOwnProperty(ve)?H[xe]=pr[ve]:(le.push(ve),Bn.hasOwnProperty(ve)||(Bn[ve]=[]),Bn[ve].push(()=>{H[xe]=pr[ve],++he,he===le.length&&A(H)}))}),le.length===0&&A(H)}function Pl(j){var z=rn[j];delete rn[j];var P=z.rawConstructor,A=z.rawDestructor,H=z.fields,le=H.map(he=>he.getterReturnType).concat(H.map(he=>he.setterArgumentType));xo([j],le,he=>{var ve={};return H.forEach((xe,_e)=>{var ke=xe.fieldName,Xe=he[_e],gt=xe.getter,Nt=xe.getterContext,_t=he[_e+H.length],dn=xe.setter,pn=xe.setterContext;ve[ke]={read:lr=>Xe.fromWireType(gt(Nt,lr)),write:(lr,Gr)=>{var ii=[];dn(pn,lr,_t.toWireType(ii,Gr)),Xt(ii)}}}),[{name:z.name,fromWireType:function(xe){var _e={};for(var ke in ve)_e[ke]=ve[ke].read(xe);return A(xe),_e},toWireType:function(xe,_e){for(var ke in ve)if(!(ke in _e))throw new TypeError('Missing field:  "'+ke+'"');var Xe=P();for(ke in ve)ve[ke].write(Xe,_e[ke]);return xe!==null&&xe.push(A,Xe),Xe},argPackAdvance:8,readValueFromPointer:Un,destructorFunction:A}]})}function os(j,z,P,A,H){}function Uo(j){switch(j){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+j)}}function wo(){for(var j=new Array(256),z=0;z<256;++z)j[z]=String.fromCharCode(z);Fo=j}var Fo=void 0;function zr(j){for(var z="",P=j;Y[P];)z+=Fo[Y[P++]];return z}var ba=void 0;function Zt(j){throw new ba(j)}function Ui(j,z,P={}){if(!("argPackAdvance"in z))throw new TypeError("registerType registeredInstance requires argPackAdvance");var A=z.name;if(j||Zt('type "'+A+'" must have a positive integer typeid pointer'),pr.hasOwnProperty(j)){if(P.ignoreDuplicateRegistrations)return;Zt("Cannot register type '"+A+"' twice")}if(pr[j]=z,delete wi[j],Bn.hasOwnProperty(j)){var H=Bn[j];delete Bn[j],H.forEach(le=>le())}}function kl(j,z,P,A,H){var le=Uo(P);z=zr(z),Ui(j,{name:z,fromWireType:function(he){return!!he},toWireType:function(he,ve){return ve?A:H},argPackAdvance:8,readValueFromPointer:function(he){var ve;if(P===1)ve=U;else if(P===2)ve=J;else if(P===4)ve=F;else throw new TypeError("Unknown boolean type size: "+z);return this.fromWireType(ve[he>>le])},destructorFunction:null})}function Fi(j){if(!(this instanceof aa)||!(j instanceof aa))return!1;for(var z=this.$$.ptrType.registeredClass,P=this.$$.ptr,A=j.$$.ptrType.registeredClass,H=j.$$.ptr;z.baseClass;)P=z.upcast(P),z=z.baseClass;for(;A.baseClass;)H=A.upcast(H),A=A.baseClass;return z===A&&P===H}function Va(j){return{count:j.count,deleteScheduled:j.deleteScheduled,preservePointerOnDelete:j.preservePointerOnDelete,ptr:j.ptr,ptrType:j.ptrType,smartPtr:j.smartPtr,smartPtrType:j.smartPtrType}}function Bo(j){function z(P){return P.$$.ptrType.registeredClass.name}Zt(z(j)+" instance already deleted")}var $a=!1;function Mu(j){}function Gc(j){j.smartPtr?j.smartPtrType.rawDestructor(j.smartPtr):j.ptrType.registeredClass.rawDestructor(j.ptr)}function ja(j){j.count.value-=1;var z=j.count.value===0;z&&Gc(j)}function Wc(j,z,P){if(z===P)return j;if(P.baseClass===void 0)return null;var A=Wc(j,z,P.baseClass);return A===null?null:P.downcast(A)}var bi={};function cc(){return Object.keys(Er).length}function lc(){var j=[];for(var z in Er)Er.hasOwnProperty(z)&&j.push(Er[z]);return j}var ia=[];function Hc(){for(;ia.length;){var j=ia.pop();j.$$.deleteScheduled=!1,j.delete()}}var Ns=void 0;function ss(j){Ns=j,ia.length&&Ns&&Ns(Hc)}function Ru(){a.getInheritedInstanceCount=cc,a.getLiveInheritedInstances=lc,a.flushPendingDeletes=Hc,a.setDelayFunction=ss}var Er={};function bo(j,z){for(z===void 0&&Zt("ptr should not be undefined");j.baseClass;)z=j.upcast(z),j=j.baseClass;return z}function Al(j,z){return z=bo(j,z),Er[z]}function Ps(j,z){(!z.ptrType||!z.ptr)&&Zr("makeClassHandle requires ptr and ptrType");var P=!!z.smartPtrType,A=!!z.smartPtr;return P!==A&&Zr("Both smartPtrType and smartPtr must be specified"),z.count={value:1},So(Object.create(j,{$$:{value:z}}))}function Ll(j){var z=this.getPointee(j);if(!z)return this.destructor(j),null;var P=Al(this.registeredClass,z);if(P!==void 0){if(P.$$.count.value===0)return P.$$.ptr=z,P.$$.smartPtr=j,P.clone();var A=P.clone();return this.destructor(j),A}function H(){return this.isSmartPointer?Ps(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:z,smartPtrType:this,smartPtr:j}):Ps(this.registeredClass.instancePrototype,{ptrType:this,ptr:j})}var le=this.registeredClass.getActualType(z),he=bi[le];if(!he)return H.call(this);var ve;this.isConst?ve=he.constPointerType:ve=he.pointerType;var xe=Wc(z,this.registeredClass,ve.registeredClass);return xe===null?H.call(this):this.isSmartPointer?Ps(ve.registeredClass.instancePrototype,{ptrType:ve,ptr:xe,smartPtrType:this,smartPtr:j}):Ps(ve.registeredClass.instancePrototype,{ptrType:ve,ptr:xe})}function So(j){return typeof FinalizationRegistry>"u"?(So=z=>z,j):($a=new FinalizationRegistry(z=>{ja(z.$$)}),So=z=>{var P=z.$$,A=!!P.smartPtr;if(A){var H={$$:P};$a.register(z,H,z)}return z},Mu=z=>$a.unregister(z),So(j))}function Ud(){if(this.$$.ptr||Bo(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var j=So(Object.create(Object.getPrototypeOf(this),{$$:{value:Va(this.$$)}}));return j.$$.count.value+=1,j.$$.deleteScheduled=!1,j}function Ua(){this.$$.ptr||Bo(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Zt("Object already scheduled for deletion"),Mu(this),ja(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Iu(){return!this.$$.ptr}function Df(){return this.$$.ptr||Bo(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Zt("Object already scheduled for deletion"),ia.push(this),ia.length===1&&Ns&&Ns(Hc),this.$$.deleteScheduled=!0,this}function eo(){aa.prototype.isAliasOf=Fi,aa.prototype.clone=Ud,aa.prototype.delete=Ua,aa.prototype.isDeleted=Iu,aa.prototype.deleteLater=Df}function aa(){}function to(j,z,P){if(j[z].overloadTable===void 0){var A=j[z];j[z]=function(){return j[z].overloadTable.hasOwnProperty(arguments.length)||Zt("Function '"+P+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+j[z].overloadTable+")!"),j[z].overloadTable[arguments.length].apply(this,arguments)},j[z].overloadTable=[],j[z].overloadTable[A.argCount]=A}}function oa(j,z,P){a.hasOwnProperty(j)?((P===void 0||a[j].overloadTable!==void 0&&a[j].overloadTable[P]!==void 0)&&Zt("Cannot register public name '"+j+"' twice"),to(a,j,j),a.hasOwnProperty(P)&&Zt("Cannot register multiple overloads of a function with the same number of arguments ("+P+")!"),a[j].overloadTable[P]=z):(a[j]=z,P!==void 0&&(a[j].numArguments=P))}function ks(j,z,P,A,H,le,he,ve){this.name=j,this.constructor=z,this.instancePrototype=P,this.rawDestructor=A,this.baseClass=H,this.getActualType=le,this.upcast=he,this.downcast=ve,this.pureVirtualFunctions=[]}function uc(j,z,P){for(;z!==P;)z.upcast||Zt("Expected null or instance of "+P.name+", got an instance of "+z.name),j=z.upcast(j),z=z.baseClass;return j}function fc(j,z){if(z===null)return this.isReference&&Zt("null is not a valid "+this.name),0;z.$$||Zt('Cannot pass "'+Kc(z)+'" as a '+this.name),z.$$.ptr||Zt("Cannot pass deleted object as a pointer of type "+this.name);var P=z.$$.ptrType.registeredClass,A=uc(z.$$.ptr,P,this.registeredClass);return A}function ui(j,z){var P;if(z===null)return this.isReference&&Zt("null is not a valid "+this.name),this.isSmartPointer?(P=this.rawConstructor(),j!==null&&j.push(this.rawDestructor,P),P):0;z.$$||Zt('Cannot pass "'+Kc(z)+'" as a '+this.name),z.$$.ptr||Zt("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&z.$$.ptrType.isConst&&Zt("Cannot convert argument of type "+(z.$$.smartPtrType?z.$$.smartPtrType.name:z.$$.ptrType.name)+" to parameter type "+this.name);var A=z.$$.ptrType.registeredClass;if(P=uc(z.$$.ptr,A,this.registeredClass),this.isSmartPointer)switch(z.$$.smartPtr===void 0&&Zt("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:z.$$.smartPtrType===this?P=z.$$.smartPtr:Zt("Cannot convert argument of type "+(z.$$.smartPtrType?z.$$.smartPtrType.name:z.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:P=z.$$.smartPtr;break;case 2:if(z.$$.smartPtrType===this)P=z.$$.smartPtr;else{var H=z.clone();P=this.rawShare(P,qc.toHandle(function(){H.delete()})),j!==null&&j.push(this.rawDestructor,P)}break;default:Zt("Unsupporting sharing policy")}return P}function Vl(j,z){if(z===null)return this.isReference&&Zt("null is not a valid "+this.name),0;z.$$||Zt('Cannot pass "'+Kc(z)+'" as a '+this.name),z.$$.ptr||Zt("Cannot pass deleted object as a pointer of type "+this.name),z.$$.ptrType.isConst&&Zt("Cannot convert argument of type "+z.$$.ptrType.name+" to parameter type "+this.name);var P=z.$$.ptrType.registeredClass,A=uc(z.$$.ptr,P,this.registeredClass);return A}function no(j){return this.rawGetPointee&&(j=this.rawGetPointee(j)),j}function sa(j){this.rawDestructor&&this.rawDestructor(j)}function dc(j){j!==null&&j.delete()}function cs(){Sa.prototype.getPointee=no,Sa.prototype.destructor=sa,Sa.prototype.argPackAdvance=8,Sa.prototype.readValueFromPointer=Un,Sa.prototype.deleteObject=dc,Sa.prototype.fromWireType=Ll}function Sa(j,z,P,A,H,le,he,ve,xe,_e,ke){this.name=j,this.registeredClass=z,this.isReference=P,this.isConst=A,this.isSmartPointer=H,this.pointeeType=le,this.sharingPolicy=he,this.rawGetPointee=ve,this.rawConstructor=xe,this.rawShare=_e,this.rawDestructor=ke,!H&&z.baseClass===void 0?A?(this.toWireType=fc,this.destructorFunction=null):(this.toWireType=Vl,this.destructorFunction=null):this.toWireType=ui}function Co(j,z,P){a.hasOwnProperty(j)||Zr("Replacing nonexistant public symbol"),a[j].overloadTable!==void 0&&P!==void 0?a[j].overloadTable[P]=z:(a[j]=z,a[j].argCount=P)}function As(j,z,P){var A=a["dynCall_"+j];return P&&P.length?A.apply(null,[z].concat(P)):A.call(null,z)}function Nu(j,z,P){if(j.includes("j"))return As(j,z,P);var A=Mn(z).apply(null,P);return A}function hc(j,z){var P=[];return function(){return P.length=0,Object.assign(P,arguments),Nu(j,z,P)}}function jr(j,z){j=zr(j);function P(){return j.includes("j")?hc(j,z):Mn(z)}var A=P();return typeof A!="function"&&Zt("unknown function pointer with signature "+j+": "+z),A}var zo=void 0;function Ur(j){var z=Be(j),P=zr(z);return me(z),P}function Si(j,z){var P=[],A={};function H(le){if(!A[le]&&!pr[le]){if(wi[le]){wi[le].forEach(H);return}P.push(le),A[le]=!0}}throw z.forEach(H),new zo(j+": "+P.map(Ur).join([", "]))}function gc(j,z,P,A,H,le,he,ve,xe,_e,ke,Xe,gt){ke=zr(ke),le=jr(H,le),ve&&(ve=jr(he,ve)),_e&&(_e=jr(xe,_e)),gt=jr(Xe,gt);var Nt=Dt(ke);oa(Nt,function(){Si("Cannot construct "+ke+" due to unbound types",[A])}),xo([j,z,P],A?[A]:[],function(_t){_t=_t[0];var dn,pn;A?(dn=_t.registeredClass,pn=dn.instancePrototype):pn=aa.prototype;var lr=Gt(Nt,function(){if(Object.getPrototypeOf(this)!==Gr)throw new ba("Use 'new' to construct "+ke);if(ii.constructor_body===void 0)throw new ba(ke+" has no accessible constructor");var kh=ii.constructor_body[arguments.length];if(kh===void 0)throw new ba("Tried to invoke ctor of "+ke+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(ii.constructor_body).toString()+") parameters instead!");return kh.apply(this,arguments)}),Gr=Object.create(pn,{constructor:{value:lr}});lr.prototype=Gr;var ii=new ks(ke,lr,Gr,gt,dn,le,ve,_e),ju=new Sa(ke,ii,!0,!1,!1),$s=new Sa(ke+"*",ii,!1,!1,!1),Gl=new Sa(ke+" const*",ii,!1,!0,!1);return bi[j]={pointerType:$s,constPointerType:Gl},Co(Nt,lr),[ju,$s,Gl]})}function Ci(j,z){for(var P=[],A=0;A<j;A++)P.push(ae[z+A*4>>2]);return P}function Pu(j,z){if(!(j instanceof Function))throw new TypeError("new_ called with constructor type "+typeof j+" which is not a function");var P=Gt(j.name||"unknownFunctionName",function(){});P.prototype=j.prototype;var A=new P,H=j.apply(A,z);return H instanceof Object?H:A}function Bi(j,z,P,A,H){var le=z.length;le<2&&Zt("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var he=z[1]!==null&&P!==null,ve=!1,xe=1;xe<z.length;++xe)if(z[xe]!==null&&z[xe].destructorFunction===void 0){ve=!0;break}for(var _e=z[0].name!=="void",ke="",Xe="",xe=0;xe<le-2;++xe)ke+=(xe!==0?", ":"")+"arg"+xe,Xe+=(xe!==0?", ":"")+"arg"+xe+"Wired";var gt="return function "+Dt(j)+"("+ke+`) {
if (arguments.length !== `+(le-2)+`) {
throwBindingError('function `+j+" called with ' + arguments.length + ' arguments, expected "+(le-2)+` args!');
}
`;ve&&(gt+=`var destructors = [];
`);var Nt=ve?"destructors":"null",_t=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],dn=[Zt,A,H,Xt,z[0],z[1]];he&&(gt+="var thisWired = classParam.toWireType("+Nt+`, this);
`);for(var xe=0;xe<le-2;++xe)gt+="var arg"+xe+"Wired = argType"+xe+".toWireType("+Nt+", arg"+xe+"); // "+z[xe+2].name+`
`,_t.push("argType"+xe),dn.push(z[xe+2]);if(he&&(Xe="thisWired"+(Xe.length>0?", ":"")+Xe),gt+=(_e?"var rv = ":"")+"invoker(fn"+(Xe.length>0?", ":"")+Xe+`);
`,ve)gt+=`runDestructors(destructors);
`;else for(var xe=he?1:2;xe<z.length;++xe){var pn=xe===1?"thisWired":"arg"+(xe-2)+"Wired";z[xe].destructorFunction!==null&&(gt+=pn+"_dtor("+pn+"); // "+z[xe].name+`
`,_t.push(pn+"_dtor"),dn.push(z[xe].destructorFunction))}_e&&(gt+=`var ret = retType.fromWireType(rv);
return ret;
`),gt+=`}
`,_t.push(gt);var lr=Pu(Function,_t).apply(null,dn);return lr}function Go(j,z,P,A,H,le){I(z>0);var he=Ci(z,P);H=jr(A,H),xo([],[j],function(ve){ve=ve[0];var xe="constructor "+ve.name;if(ve.registeredClass.constructor_body===void 0&&(ve.registeredClass.constructor_body=[]),ve.registeredClass.constructor_body[z-1]!==void 0)throw new ba("Cannot register multiple constructors with identical number of parameters ("+(z-1)+") for class '"+ve.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return ve.registeredClass.constructor_body[z-1]=()=>{Si("Cannot construct "+ve.name+" due to unbound types",he)},xo([],he,function(_e){return _e.splice(1,0,null),ve.registeredClass.constructor_body[z-1]=Bi(xe,_e,null,H,le),[]}),[]})}function pc(j,z,P,A,H,le,he,ve){var xe=Ci(P,A);z=zr(z),le=jr(H,le),xo([],[j],function(_e){_e=_e[0];var ke=_e.name+"."+z;z.startsWith("@@")&&(z=Symbol[z.substring(2)]),ve&&_e.registeredClass.pureVirtualFunctions.push(z);function Xe(){Si("Cannot call "+ke+" due to unbound types",xe)}var gt=_e.registeredClass.instancePrototype,Nt=gt[z];return Nt===void 0||Nt.overloadTable===void 0&&Nt.className!==_e.name&&Nt.argCount===P-2?(Xe.argCount=P-2,Xe.className=_e.name,gt[z]=Xe):(to(gt,z,ke),gt[z].overloadTable[P-2]=Xe),xo([],xe,function(_t){var dn=Bi(ke,_t,_e,le,he);return gt[z].overloadTable===void 0?(dn.argCount=P-2,gt[z]=dn):gt[z].overloadTable[P-2]=dn,[]}),[]})}var ls=[],Fa=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function zi(j){j>4&&--Fa[j].refcount===0&&(Fa[j]=void 0,ls.push(j))}function Ls(){for(var j=0,z=5;z<Fa.length;++z)Fa[z]!==void 0&&++j;return j}function $l(){for(var j=5;j<Fa.length;++j)if(Fa[j]!==void 0)return Fa[j];return null}function mc(){a.count_emval_handles=Ls,a.get_first_emval=$l}var qc={toValue:j=>(j||Zt("Cannot use deleted val. handle = "+j),Fa[j].value),toHandle:j=>{switch(j){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var z=ls.length?ls.pop():Fa.length;return Fa[z]={refcount:1,value:j},z}}}};function jl(j,z){z=zr(z),Ui(j,{name:z,fromWireType:function(P){var A=qc.toValue(P);return zi(P),A},toWireType:function(P,A){return qc.toHandle(A)},argPackAdvance:8,readValueFromPointer:Un,destructorFunction:null})}function Kc(j){if(j===null)return"null";var z=typeof j;return z==="object"||z==="array"||z==="function"?j.toString():""+j}function Yc(j,z){switch(z){case 2:return function(P){return this.fromWireType(re[P>>2])};case 3:return function(P){return this.fromWireType(te[P>>3])};default:throw new TypeError("Unknown float type: "+j)}}function Ul(j,z,P){var A=Uo(P);z=zr(z),Ui(j,{name:z,fromWireType:function(H){return H},toWireType:function(H,le){return le},argPackAdvance:8,readValueFromPointer:Yc(z,A),destructorFunction:null})}function Mf(j,z,P,A,H,le){var he=Ci(z,P);j=zr(j),H=jr(A,H),oa(j,function(){Si("Cannot call "+j+" due to unbound types",he)},z-1),xo([],he,function(ve){var xe=[ve[0],null].concat(ve.slice(1));return Co(j,Bi(j,xe,null,H,le),z-1),[]})}function Fd(j,z,P){switch(z){case 0:return P?function(H){return U[H]}:function(H){return Y[H]};case 1:return P?function(H){return J[H>>1]}:function(H){return ne[H>>1]};case 2:return P?function(H){return F[H>>2]}:function(H){return ae[H>>2]};default:throw new TypeError("Unknown integer type: "+j)}}function Bd(j,z,P,A,H){z=zr(z);var le=Uo(P),he=Xe=>Xe;if(A===0){var ve=32-8*P;he=Xe=>Xe<<ve>>>ve}var xe=z.includes("unsigned"),_e=(Xe,gt)=>{},ke;xe?ke=function(Xe,gt){return _e(gt,this.name),gt>>>0}:ke=function(Xe,gt){return _e(gt,this.name),gt},Ui(j,{name:z,fromWireType:he,toWireType:ke,argPackAdvance:8,readValueFromPointer:Fd(z,le,A!==0),destructorFunction:null})}function zd(j,z,P){var A=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],H=A[z];function le(he){he=he>>2;var ve=ae,xe=ve[he],_e=ve[he+1];return new H(oe,_e,xe)}P=zr(P),Ui(j,{name:P,fromWireType:le,argPackAdvance:8,readValueFromPointer:le},{ignoreDuplicateRegistrations:!0})}function ku(j,z){z=zr(z);var P=z==="std::string";Ui(j,{name:z,fromWireType:function(A){var H=ae[A>>2],le=A+4,he;if(P)for(var ve=le,xe=0;xe<=H;++xe){var _e=le+xe;if(xe==H||Y[_e]==0){var ke=_e-ve,Xe=L(ve,ke);he===void 0?he=Xe:(he+="\0",he+=Xe),ve=_e+1}}else{for(var gt=new Array(H),xe=0;xe<H;++xe)gt[xe]=String.fromCharCode(Y[le+xe]);he=gt.join("")}return me(A),he},toWireType:function(A,H){H instanceof ArrayBuffer&&(H=new Uint8Array(H));var le,he=typeof H=="string";he||H instanceof Uint8Array||H instanceof Uint8ClampedArray||H instanceof Int8Array||Zt("Cannot pass non-string to std::string"),P&&he?le=G(H):le=H.length;var ve=ee(4+le+1),xe=ve+4;if(ae[ve>>2]=le,P&&he)W(H,xe,le+1);else if(he)for(var _e=0;_e<le;++_e){var ke=H.charCodeAt(_e);ke>255&&(me(xe),Zt("String has UTF-16 code units that do not fit in 8 bits")),Y[xe+_e]=ke}else for(var _e=0;_e<le;++_e)Y[xe+_e]=H[_e];return A!==null&&A.push(me,ve),ve},argPackAdvance:8,readValueFromPointer:Un,destructorFunction:function(A){me(A)}})}var Rf=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Gd(j,z){for(var P=j,A=P>>1,H=A+z/2;!(A>=H)&&ne[A];)++A;if(P=A<<1,P-j>32&&Rf)return Rf.decode(Y.subarray(j,P));for(var le="",he=0;!(he>=z/2);++he){var ve=J[j+he*2>>1];if(ve==0)break;le+=String.fromCharCode(ve)}return le}function If(j,z,P){if(P===void 0&&(P=2147483647),P<2)return 0;P-=2;for(var A=z,H=P<j.length*2?P/2:j.length,le=0;le<H;++le){var he=j.charCodeAt(le);J[z>>1]=he,z+=2}return J[z>>1]=0,z-A}function Nf(j){return j.length*2}function Wd(j,z){for(var P=0,A="";!(P>=z/4);){var H=F[j+P*4>>2];if(H==0)break;if(++P,H>=65536){var le=H-65536;A+=String.fromCharCode(55296|le>>10,56320|le&1023)}else A+=String.fromCharCode(H)}return A}function Fl(j,z,P){if(P===void 0&&(P=2147483647),P<4)return 0;for(var A=z,H=A+P-4,le=0;le<j.length;++le){var he=j.charCodeAt(le);if(he>=55296&&he<=57343){var ve=j.charCodeAt(++le);he=65536+((he&1023)<<10)|ve&1023}if(F[z>>2]=he,z+=4,z+4>H)break}return F[z>>2]=0,z-A}function Pf(j){for(var z=0,P=0;P<j.length;++P){var A=j.charCodeAt(P);A>=55296&&A<=57343&&++P,z+=4}return z}function kf(j,z,P){P=zr(P);var A,H,le,he,ve;z===2?(A=Gd,H=If,he=Nf,le=()=>ne,ve=1):z===4&&(A=Wd,H=Fl,he=Pf,le=()=>ae,ve=2),Ui(j,{name:P,fromWireType:function(xe){for(var _e=ae[xe>>2],ke=le(),Xe,gt=xe+4,Nt=0;Nt<=_e;++Nt){var _t=xe+4+Nt*z;if(Nt==_e||ke[_t>>ve]==0){var dn=_t-gt,pn=A(gt,dn);Xe===void 0?Xe=pn:(Xe+="\0",Xe+=pn),gt=_t+z}}return me(xe),Xe},toWireType:function(xe,_e){typeof _e!="string"&&Zt("Cannot pass non-string to C++ string type "+P);var ke=he(_e),Xe=ee(4+ke+z);return ae[Xe>>2]=ke>>ve,H(_e,Xe+4,ke+z),xe!==null&&xe.push(me,Xe),Xe},argPackAdvance:8,readValueFromPointer:Un,destructorFunction:function(xe){me(xe)}})}function Au(j,z,P,A,H,le){rn[j]={name:zr(z),rawConstructor:jr(P,A),rawDestructor:jr(H,le),fields:[]}}function Hd(j,z,P,A,H,le,he,ve,xe,_e){rn[j].fields.push({fieldName:zr(z),getterReturnType:P,getter:jr(A,H),getterContext:le,setterArgumentType:he,setter:jr(ve,xe),setterContext:_e})}function Bl(j,z){z=zr(z),Ui(j,{isVoid:!0,name:z,argPackAdvance:0,fromWireType:function(){},toWireType:function(P,A){}})}function qd(j){j>4&&(Fa[j].refcount+=1)}function Af(j,z){var P=pr[j];return P===void 0&&Zt(z+" has unknown type "+Ur(j)),P}function Kd(j,z){j=Af(j,"_emval_take_value");var P=j.readValueFromPointer(z);return qc.toHandle(P)}function Lf(){Ke("")}function Yd(j,z,P){Y.copyWithin(j,z,z+P)}function Xd(){return 2147483648}function Lu(j){try{return O.grow(j-oe.byteLength+65535>>>16),ye(O.buffer),1}catch{}}function Vu(j){var z=Y.length;j=j>>>0;var P=Xd();if(j>P)return!1;let A=(xe,_e)=>xe+(_e-xe%_e)%_e;for(var H=1;H<=4;H*=2){var le=z*(1+.2/H);le=Math.min(le,j+100663296);var he=Math.min(P,A(Math.max(j,le),65536)),ve=Lu(he);if(ve)return!0}return!1}function Vs(j){return 52}function vc(j,z,P,A,H){return 70}var Wo=[null,[],[]];function Vf(j,z){var P=Wo[j];z===0||z===10?((j===1?C:_)(k(P,0)),P.length=0):P.push(z)}function $f(j,z,P,A){for(var H=0,le=0;le<P;le++){var he=ae[z>>2],ve=ae[z+4>>2];z+=8;for(var xe=0;xe<ve;xe++)Vf(j,Y[he+xe]);H+=ve}return ae[A>>2]=H,0}function Xc(j){return j}function yc(j){var z=a["_"+j];return z}function zl(j,z){U.set(j,z)}function $u(j,z,P,A,H){var le={string:_t=>{var dn=0;if(_t!=null&&_t!==0){var pn=(_t.length<<2)+1;dn=tt(pn),W(_t,dn,pn)}return dn},array:_t=>{var dn=tt(_t.length);return zl(_t,dn),dn}};function he(_t){return z==="string"?L(_t):z==="boolean"?!!_t:_t}var ve=yc(j),xe=[],_e=0;if(A)for(var ke=0;ke<A.length;ke++){var Xe=le[P[ke]];Xe?(_e===0&&(_e=Je()),xe[ke]=Xe(A[ke])):xe[ke]=A[ke]}var gt=ve.apply(null,xe);function Nt(_t){return _e!==0&&Ge(_e),he(_t)}return gt=Nt(gt),gt}un=a.InternalError=Ut(Error,"InternalError"),wo(),ba=a.BindingError=Ut(Error,"BindingError"),eo(),Ru(),cs(),zo=a.UnboundTypeError=Ut(Error,"UnboundTypeError"),mc();var Q={__assert_fail:Pt,__cxa_begin_catch:Sr,__cxa_end_catch:at,__cxa_find_matching_catch_2:jt,__cxa_find_matching_catch_3:gn,__cxa_throw:Kn,__resumeException:kt,_embind_finalize_value_object:Pl,_embind_register_bigint:os,_embind_register_bool:kl,_embind_register_class:gc,_embind_register_class_constructor:Go,_embind_register_class_function:pc,_embind_register_emval:jl,_embind_register_float:Ul,_embind_register_function:Mf,_embind_register_integer:Bd,_embind_register_memory_view:zd,_embind_register_std_string:ku,_embind_register_std_wstring:kf,_embind_register_value_object:Au,_embind_register_value_object_field:Hd,_embind_register_void:Bl,_emval_decref:zi,_emval_incref:qd,_emval_take_value:Kd,abort:Lf,emscripten_memcpy_big:Yd,emscripten_resize_heap:Vu,fd_close:Vs,fd_seek:vc,fd_write:$f,invoke_i:Ee,invoke_ii:Wt,invoke_iii:ot,invoke_iiii:de,invoke_v:q,invoke_vi:an,invoke_viiii:X,invoke_viiiiii:Ue,llvm_eh_typeid_for:Xc};Re(),a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.__wasm_call_ctors).apply(null,arguments)};var ee=a._malloc=function(){return(ee=a._malloc=a.asm.malloc).apply(null,arguments)},me=a._free=function(){return(me=a._free=a.asm.free).apply(null,arguments)},Pe=a.___cxa_free_exception=function(){return(Pe=a.___cxa_free_exception=a.asm.__cxa_free_exception).apply(null,arguments)},Be=a.___getTypeName=function(){return(Be=a.___getTypeName=a.asm.__getTypeName).apply(null,arguments)};a.__embind_initialize_bindings=function(){return(a.__embind_initialize_bindings=a.asm._embind_initialize_bindings).apply(null,arguments)},a.___errno_location=function(){return(a.___errno_location=a.asm.__errno_location).apply(null,arguments)};var Qe=a.setTempRet0=function(){return(Qe=a.setTempRet0=a.asm.setTempRet0).apply(null,arguments)},Je=a.stackSave=function(){return(Je=a.stackSave=a.asm.stackSave).apply(null,arguments)},Ge=a.stackRestore=function(){return(Ge=a.stackRestore=a.asm.stackRestore).apply(null,arguments)},tt=a.stackAlloc=function(){return(tt=a.stackAlloc=a.asm.stackAlloc).apply(null,arguments)},mt=a.___cxa_can_catch=function(){return(mt=a.___cxa_can_catch=a.asm.__cxa_can_catch).apply(null,arguments)},At=a.___cxa_is_pointer_type=function(){return(At=a.___cxa_is_pointer_type=a.asm.__cxa_is_pointer_type).apply(null,arguments)};a.dynCall_ji=function(){return(a.dynCall_ji=a.asm.dynCall_ji).apply(null,arguments)},a.dynCall_iiji=function(){return(a.dynCall_iiji=a.asm.dynCall_iiji).apply(null,arguments)},a.dynCall_jiji=function(){return(a.dynCall_jiji=a.asm.dynCall_jiji).apply(null,arguments)};function Wt(j,z){var P=Je();try{return Mn(j)(z)}catch(A){if(Ge(P),A!==A+0)throw A;_setThrew(1,0)}}function an(j,z){var P=Je();try{Mn(j)(z)}catch(A){if(Ge(P),A!==A+0)throw A;_setThrew(1,0)}}function X(j,z,P,A,H){var le=Je();try{Mn(j)(z,P,A,H)}catch(he){if(Ge(le),he!==he+0)throw he;_setThrew(1,0)}}function q(j){var z=Je();try{Mn(j)()}catch(P){if(Ge(z),P!==P+0)throw P;_setThrew(1,0)}}function de(j,z,P,A){var H=Je();try{return Mn(j)(z,P,A)}catch(le){if(Ge(H),le!==le+0)throw le;_setThrew(1,0)}}function Ee(j){var z=Je();try{return Mn(j)()}catch(P){if(Ge(z),P!==P+0)throw P;_setThrew(1,0)}}function Ue(j,z,P,A,H,le,he){var ve=Je();try{Mn(j)(z,P,A,H,le,he)}catch(xe){if(Ge(ve),xe!==xe+0)throw xe;_setThrew(1,0)}}function ot(j,z,P){var A=Je();try{return Mn(j)(z,P)}catch(H){if(Ge(A),H!==H+0)throw H;_setThrew(1,0)}}a.ccall=$u;var Ze;ln=function j(){Ze||qe(),Ze||(ln=j)};function qe(j){if(cn>0||(be(),cn>0))return;function z(){Ze||(Ze=!0,a.calledRun=!0,!M&&(Ye(),o(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),ft()))}a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),z()},1)):z()}if(a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return qe(),a.ready})})();t.exports=n})(bI)),bI.exports}var mBt=pBt();const vBt=ka(mBt),yBt=new URL("/assets/openjphjs-C-BUUy4a.wasm",import.meta.url),N5={codec:void 0,decoder:void 0,decodeConfig:{}};function xBt(t,e,n){const r={width:e,height:n};for(;t>0;)r.width=Math.ceil(r.width/2),r.height=Math.ceil(r.height/2),t--;return r}function wBt(t){if(N5.decodeConfig=t,N5.codec)return Promise.resolve();const e=vBt({locateFile:n=>n.endsWith(".wasm")?yBt.toString():n});return new Promise((n,r)=>{e.then(i=>{N5.codec=i,N5.decoder=new i.HTJ2KDecoder,n()},r)})}async function bBt(t,e){await wBt();const n=new N5.codec.HTJ2KDecoder,r=n.getEncodedBuffer(t.length);r.set(t);const i=e.decodeLevel||0;n.decodeSubResolution(i);const a=n.getFrameInfo();if(e.decodeLevel>0){const{width:V,height:k}=xBt(e.decodeLevel,a.width,a.height);a.width=V,a.height=k}const o=n.getDecodedBuffer();new Uint8Array(o.length).set(o);const c=`x: ${n.getImageOffset().x}, y: ${n.getImageOffset().y}`,l=n.getNumDecompositions(),u=n.getNumLayers(),f=["unknown","LRCP","RLCP","RPCL","PCRL","CPRL"][n.getProgressionOrder()+1],d=n.getIsReversible(),h=`${n.getBlockDimensions().width} x ${n.getBlockDimensions().height}`,m=`${n.getTileSize().width} x ${n.getTileSize().height}`,p=`${n.getTileOffset().x}, ${n.getTileOffset().y}`,y=`${o.length.toLocaleString()} bytes`,x=`${(o.length/r.length).toFixed(2)}:1`,S={columns:a.width,rows:a.height,bitsPerPixel:a.bitsPerSample,signed:a.isSigned,bytesPerPixel:e.bytesPerPixel,componentsPerPixel:a.componentCount};let C=SBt(a,o);const{buffer:_,byteOffset:T,byteLength:O}=C,M=_.slice(T,T+O);C=new C.constructor(M);const I={imageOffset:c,numDecompositions:l,numLayers:u,progessionOrder:f,reversible:d,blockDimensions:h,tileSize:m,tileOffset:p,decodedSize:y,compressionRatio:x};return{...e,pixelData:C,imageInfo:S,encodeOptions:I,...I,...S}}function SBt(t,e){return t.bitsPerSample>8?t.isSigned?new Int16Array(e.buffer,e.byteOffset,e.byteLength/2):new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2):t.isSigned?new Int8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function CBt(t,e){const n=t.length,{rescaleSlope:r,rescaleIntercept:i,suvbw:a,doseGridScaling:o}=e;if(e.modality==="PT"&&typeof a=="number"&&!isNaN(a))for(let s=0;s<n;s++)t[s]=a*(t[s]*r+i);else if(e.modality==="RTDOSE"&&typeof o=="number"&&!isNaN(o))for(let s=0;s<n;s++)t[s]=t[s]*o;else for(let s=0;s<n;s++)t[s]=t[s]*r+i;return!0}const _Bt={bilinear:LFt,replicate:VFt},_re={Uint8Array,Uint16Array,Int16Array,Float32Array,Uint32Array};function TBt(t,e,n,r){const i=t.pixelRepresentation!==void 0&&t.pixelRepresentation===1,a=i&&t.bitsStored!==void 0?32-t.bitsStored:void 0;if(i&&a!==void 0)for(let S=0;S<t.pixelData.length;S++)t.pixelData[S]=t.pixelData[S]<<a>>a;let o=t.pixelData;t.pixelDataLength=t.pixelData.length;const{min:s,max:c}=xB(t.pixelData),l=typeof e.allowFloatRendering<"u"?e.allowFloatRendering:!0;let u=nCe(t.photometricInterpretation)&&e.targetBuffer?.offset===void 0;const d=e.preScale?.enabled&&Object.values(e.preScale.scalingParameters).some(S=>typeof S=="number"&&!Number.isInteger(S)),h=!e.preScale.enabled||!l&&d,m=e.targetBuffer?.type;if(m&&e.preScale.enabled&&!h){const S=e.preScale.scalingParameters,C=$k(s,c,S);u=!eFt(C.min,C.max,_re[m])}m&&!u?o=OBt(e,t,_re,o):e.preScale.enabled&&!h?o=DBt(e,s,c,t):o=dCe(s,c,t);let p=s,y=c;if(e.preScale.enabled&&!h){const S=e.preScale.scalingParameters;if(hCe(S),EBt(S)){CBt(o,S),t.preScale={...e.preScale,scaled:!0};const _=$k(s,c,S);p=_.min,y=_.max}}else h&&(t.preScale={enabled:!0,scaled:!1},p=s,y=c);t.pixelData=o,t.smallestPixelValue=p,t.largestPixelValue=y;const x=new Date().getTime();return t.decodeTimeInMS=x-n,t}function EBt(t){const{rescaleSlope:e,rescaleIntercept:n,modality:r,doseGridScaling:i,suvbw:a}=t;return typeof e=="number"&&typeof n=="number"||r==="RTDOSE"&&typeof i=="number"||r==="PT"&&typeof a=="number"}function OBt(t,e,n,r){const{arrayBuffer:i,type:a,offset:o=0,length:s,rows:c}=t.targetBuffer,l=n[a];if(!l)throw new Error(`target array ${a} is not supported, or doesn't exist.`);c&&c!=e.rows&&RBt(e,t.targetBuffer,l);const u=e.pixelDataLength,f=o,d=s??u-f,h=e.pixelData;if(d!==h.length)throw new Error(`target array for image does not have the same length (${d}) as the decoded image length (${h.length}).`);const m=i?new l(i,f,d):new l(d);return m.set(h,0),r=m,r}function DBt(t,e,n,r){const i=t.preScale.scalingParameters;hCe(i);const a=$k(e,n,i);return dCe(a.min,a.max,r)}function dCe(t,e,n){const r=wB(t,e),i=new r(n.pixelData.length);return i.set(n.pixelData,0),i}function $k(t,e,n){const{rescaleSlope:r,rescaleIntercept:i,modality:a,doseGridScaling:o,suvbw:s}=n;return a==="PT"&&typeof s=="number"&&!isNaN(s)?{min:s*(t*r+i),max:s*(e*r+i)}:a==="RTDOSE"&&typeof o=="number"&&!isNaN(o)?{min:t*o,max:e*o}:typeof r=="number"&&typeof i=="number"?{min:r*t+i,max:r*e+i}:{min:t,max:e}}function hCe(t){if(!t)throw new Error("options.preScale.scalingParameters must be defined if preScale.enabled is true, and scalingParameters cannot be derived from the metadata providers.")}function MBt(t,e,n){const{samplesPerPixel:r}=t,{rows:i,columns:a}=e,o=i*a*r,s=new n(o),c=s.byteLength/o;return{pixelData:s,rows:i,columns:a,frameInfo:{...t.frameInfo,rows:i,columns:a},imageInfo:{...t.imageInfo,rows:i,columns:a,bytesPerPixel:c}}}function RBt(t,e,n){const r=MBt(t,e,n),{scalingType:i="replicate"}=e;return _Bt[i](t,r),Object.assign(t,r),t.pixelDataLength=t.pixelData.length,t}async function IBt(t,e,n,r,i,a){const o=new Date().getTime();let s=null,c;switch(e){case"1.2.840.10008.1.2":case"1.2.840.10008.1.2.1":s=pre(t,n);break;case"1.2.840.10008.1.2.2":s=jFt(t,n);break;case"1.2.840.10008.1.2.1.99":s=pre(t,n);break;case"1.2.840.10008.1.2.5":s=UFt(t,n);break;case"1.2.840.10008.1.2.4.50":c={...t},s=YFt(n,c);break;case"1.2.840.10008.1.2.4.51":s=eBt(t,n);break;case"1.2.840.10008.1.2.4.57":s=yre(t,n);break;case"1.2.840.10008.1.2.4.70":s=yre(t,n);break;case"1.2.840.10008.1.2.4.80":c={signed:t.pixelRepresentation===1,bytesPerPixel:t.bitsAllocated<=8?1:2,...t},s=wre(n,c);break;case"1.2.840.10008.1.2.4.81":c={signed:t.pixelRepresentation===1,bytesPerPixel:t.bitsAllocated<=8?1:2,...t},s=wre(n,c);break;case"1.2.840.10008.1.2.4.90":c={...t},s=Sre(n,c);break;case"1.2.840.10008.1.2.4.91":c={...t},s=Sre(n,c);break;case"3.2.840.10008.1.2.4.96":case"1.2.840.10008.1.2.4.201":case"1.2.840.10008.1.2.4.202":case"1.2.840.10008.1.2.4.203":c={...t},s=bBt(n,c);break;default:throw new Error(`no decoder for transfer syntax ${e}`)}if(!s)throw new Error("decodePromise not defined");const l=await s,u=TBt(l,i,o);return a?.(u),u}const NBt={decodeTask({imageFrame:t,transferSyntax:e,decodeConfig:n,options:r,pixelData:i,callbackFn:a}){return IBt(t,e,i,n,r,a)}};bU(NBt);class I1{static async getStudyById(e){const r=(await ni.get(`/studies/${encodeURIComponent(e)}`)).data;return{ID:r.study_id,IsStable:r.is_stable,MainDicomTags:{InstitutionName:r.main_dicom_tags.institution_name,StudyDate:r.main_dicom_tags.study_date,StudyID:r.main_dicom_tags.study_id,StudyInstanceUID:r.main_dicom_tags.study_instance_uid,StudyTime:r.main_dicom_tags.study_time},ParentPatient:r.parent_patient||"",PatientMainDicomTags:{PatientBirthDate:r.patient_main_dicom_tags.patient_birth_date,PatientID:r.patient_main_dicom_tags.patient_id,PatientName:r.patient_main_dicom_tags.patient_name,PatientSex:r.patient_main_dicom_tags.patient_sex},Description:r.description,Series:r.series.map(i=>({uid:i.uid,description:i.description,modality:i.modality})),Type:r.type||"Study"}}static async getSeries(e){const r=(await ni.get(`/series/${encodeURIComponent(e)}`)).data;return{id:r.id,description:r.description,modality:r.modality,instances:r.instances||[]}}static extractSopUIDs(e){return e.instances??[]}static async getSeriesPreview(e){return(await ni.get(`/series/${encodeURIComponent(e)}/preview`,{responseType:"blob",headers:{Accept:"image/*"}})).data}static async getStudyDescription(e){return(await ni.get(`/descriptions/${encodeURIComponent(e)}`)).data}static async updateDescription(e,n){return(await ni.put(`/descriptions/${encodeURIComponent(e)}`,n)).data}static connectToZipStream(e,n){const i=`${ni.defaults.baseURL}/studies/${encodeURIComponent(e)}/zip`,a=new EventSource(i,{withCredentials:!0});return a.addEventListener("progress",o=>{try{const s=JSON.parse(o.data);n.onProgress(s)}catch(s){console.error("Error parsing progress data:",s)}}),a.addEventListener("complete",o=>{try{const s=JSON.parse(o.data);n.onComplete(s),a.close()}catch(s){console.error("Error parsing complete data:",s)}}),a.onerror=()=>{console.error("SSE Connection Error (Network or 4xx/5xx)"),n.onError(),a.close()},a}}const PBt=t=>{const e=Sh({queryKey:["studyById",t],queryFn:()=>I1.getStudyById(t),enabled:!!t,staleTime:6e5,refetchOnWindowFocus:!1,refetchOnMount:!1,retry:!1}),n=e.data?.Series?.[0]?.uid;return{study:e.data,firstSeriesId:n,studyErrorStatus:e.error?.response?.status}},gCe=t=>{const e=Sh({queryKey:["series",t],queryFn:()=>I1.getSeries(t),enabled:!!t,staleTime:6e5,refetchOnWindowFocus:!1,retry:!1}),n=D.useMemo(()=>!e.data||!e.data.instances?[]:e.data.instances.map(r=>`wadouri:${r}`),[e.data]);return{series:e.data,imageIds:n,isSeriesLoading:e.isLoading,isSeriesFetching:e.isFetching,seriesErrorStatus:e.error?.response?.status}},kBt=t=>{const e=Sh({queryKey:["seriesPreview",t],queryFn:()=>I1.getSeriesPreview(t),enabled:!!t,staleTime:6e5,refetchOnWindowFocus:!1,refetchOnMount:!1,retry:!1}),n=D.useMemo(()=>e.data?URL.createObjectURL(e.data):void 0,[e.data]);return D.useEffect(()=>()=>{n&&URL.revokeObjectURL(n)},[n]),{previewUrl:n,isPreviewLoading:e.isLoading,isPreviewError:!!e.error}},ABt=(t,e)=>{const n=Sh({queryKey:["studyDescription",t],queryFn:()=>I1.getStudyDescription(t),enabled:!!t&&e,retry:!1});return{descriptionData:n.data,isDescriptionLoading:n.isLoading,descriptionError:n.error,descriptionErrorStatus:n.error?.response?.status}},LBt=()=>{const{t}=Hn("study"),e=$c(),n=jc({mutationFn:({study_uid:r,data:i})=>I1.updateDescription(r,i),onSuccess:(r,i)=>{e.invalidateQueries({queryKey:["studyDescription",i.study_uid]}),Br.success(t("conclusion.notifications.save_success"))},onError:r=>{if(console.error("Error updating study description:",r),r.response?.status===423){const i=r.response.data?.detail?.locked_by;Br.error(t("conclusion.notifications.locked",{name:i}))}else Br.error(t("conclusion.notifications.save_error"))}});return{updateDescriptionAsync:n.mutateAsync,isUpdating:n.isPending}},VBt=()=>{const[t,e]=D.useState(0),[n,r]=D.useState(!1),i=D.useRef(null),a=o=>{i.current&&i.current.close(),r(!0),e(0),i.current=I1.connectToZipStream(o,{onProgress:s=>{e(s.percent)},onComplete:s=>{if(e(100),r(!1),Br.success("Архив сформирован, начинается скачивание"),s.url){const c=document.createElement("a");c.href=s.url,c.setAttribute("download",""),document.body.appendChild(c),c.click(),document.body.removeChild(c)}},onError:()=>{r(!1),Br.error("Ошибка при формировании архива"),e(0)}})};return D.useEffect(()=>()=>{i.current&&(console.log("Closing Zip SSE stream"),i.current.close())},[]),{startGeneration:a,isGenerating:n,progress:t}},pCe=kse()(Ase(t=>({conclusionModalPosition:{x:0,y:0},isSidebarOpen:!0,preferredLayout:"single",setConclusionModalPosition:e=>t({conclusionModalPosition:e}),toggleSidebar:()=>t(e=>({isSidebarOpen:!e.isSidebarOpen})),setLayout:e=>t({preferredLayout:e})}),{name:"study-settings-storage"})),$Bt="_container_mddtu_1",jBt="_content_mddtu_10",UBt="_icon_mddtu_19",FBt="_title_mddtu_24",BBt="_message_mddtu_31",zBt="_backIcon_mddtu_38",Rv={container:$Bt,content:jBt,icon:UBt,title:FBt,message:BBt,backIcon:zBt},GBt=()=>{const{t}=Hn("study"),e=Sf();return w.jsx("div",{className:Rv.container,children:w.jsxs("div",{className:Rv.content,children:[w.jsx(Yje,{className:Rv.icon,size:64}),w.jsx("h2",{className:Rv.title,children:t("not_found.title")}),w.jsx("p",{className:Rv.message,children:t("not_found.message")}),w.jsxs(bt,{onClick:()=>e(-1),size:"lg",children:[w.jsx(rL,{className:Rv.backIcon}),t("not_found.back_button")]})]})})},WBt="_thumbnailItem_unts3_1",HBt="_active_unts3_19",qBt="_thumbnailWrapper_unts3_23",KBt="_thumbnailLoading_unts3_33",YBt="_thumbnailEmpty_unts3_40",XBt="_thumbnailImage_unts3_51",ZBt="_listMode_unts3_62",QBt="_thumbnailInfo_unts3_82",JBt="_thumbnailDescription_unts3_91",ezt="_thumbnailNumber_unts3_103",tzt="_gridMode_unts3_109",nzt="_tooltipContent_unts3_124",rzt="_tooltipTitle_unts3_128",izt="_tooltipSubtitle_unts3_135",gs={thumbnailItem:WBt,active:HBt,thumbnailWrapper:qBt,thumbnailLoading:KBt,thumbnailEmpty:YBt,thumbnailImage:XBt,listMode:ZBt,thumbnailInfo:QBt,thumbnailDescription:JBt,thumbnailNumber:ezt,gridMode:tzt,tooltipContent:nzt,tooltipTitle:rzt,tooltipSubtitle:izt};var[k9]=Uc("Tooltip",[vp]),A9=vp(),mCe="TooltipProvider",azt=700,jk="tooltip.open",[ozt,CB]=k9(mCe),vCe=t=>{const{__scopeTooltip:e,delayDuration:n=azt,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=t,o=D.useRef(!0),s=D.useRef(!1),c=D.useRef(0);return D.useEffect(()=>{const l=c.current;return()=>window.clearTimeout(l)},[]),w.jsx(ozt,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:D.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:D.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:D.useCallback(l=>{s.current=l},[]),disableHoverableContent:i,children:a})};vCe.displayName=mCe;var ib="Tooltip",[szt,I3]=k9(ib),yCe=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=t,c=CB(ib,t.__scopeTooltip),l=A9(e),[u,f]=D.useState(null),d=No(),h=D.useRef(0),m=o??c.disableHoverableContent,p=s??c.delayDuration,y=D.useRef(!1),[x,S]=xd({prop:r,defaultProp:i??!1,onChange:M=>{M?(c.onOpen(),document.dispatchEvent(new CustomEvent(jk))):c.onClose(),a?.(M)},caller:ib}),C=D.useMemo(()=>x?y.current?"delayed-open":"instant-open":"closed",[x]),_=D.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,S(!0)},[S]),T=D.useCallback(()=>{window.clearTimeout(h.current),h.current=0,S(!1)},[S]),O=D.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,S(!0),h.current=0},p)},[p,S]);return D.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),w.jsx(y8,{...l,children:w.jsx(szt,{scope:e,contentId:d,open:x,stateAttribute:C,trigger:u,onTriggerChange:f,onTriggerEnter:D.useCallback(()=>{c.isOpenDelayedRef.current?O():_()},[c.isOpenDelayedRef,O,_]),onTriggerLeave:D.useCallback(()=>{m?T():(window.clearTimeout(h.current),h.current=0)},[T,m]),onOpen:_,onClose:T,disableHoverableContent:m,children:n})})};yCe.displayName=ib;var Uk="TooltipTrigger",xCe=D.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=I3(Uk,n),a=CB(Uk,n),o=A9(n),s=D.useRef(null),c=$n(e,s,i.onTriggerChange),l=D.useRef(!1),u=D.useRef(!1),f=D.useCallback(()=>l.current=!1,[]);return D.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),w.jsx(kb,{asChild:!0,...o,children:w.jsx(Yt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Et(t.onPointerMove,d=>{d.pointerType!=="touch"&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Et(t.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Et(t.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Et(t.onFocus,()=>{l.current||i.onOpen()}),onBlur:Et(t.onBlur,i.onClose),onClick:Et(t.onClick,i.onClose)})})});xCe.displayName=Uk;var _B="TooltipPortal",[czt,lzt]=k9(_B,{forceMount:void 0}),wCe=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,a=I3(_B,e);return w.jsx(czt,{scope:e,forceMount:n,children:w.jsx(Lo,{present:n||a.open,children:w.jsx(f2,{asChild:!0,container:i,children:r})})})};wCe.displayName=_B;var Qy="TooltipContent",bCe=D.forwardRef((t,e)=>{const n=lzt(Qy,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...a}=t,o=I3(Qy,t.__scopeTooltip);return w.jsx(Lo,{present:r||o.open,children:o.disableHoverableContent?w.jsx(SCe,{side:i,...a,ref:e}):w.jsx(uzt,{side:i,...a,ref:e})})}),uzt=D.forwardRef((t,e)=>{const n=I3(Qy,t.__scopeTooltip),r=CB(Qy,t.__scopeTooltip),i=D.useRef(null),a=$n(e,i),[o,s]=D.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:f}=r,d=D.useCallback(()=>{s(null),f(!1)},[f]),h=D.useCallback((m,p)=>{const y=m.currentTarget,x={x:m.clientX,y:m.clientY},S=gzt(x,y.getBoundingClientRect()),C=pzt(x,S),_=mzt(p.getBoundingClientRect()),T=yzt([...C,..._]);s(T),f(!0)},[f]);return D.useEffect(()=>()=>d(),[d]),D.useEffect(()=>{if(c&&u){const m=y=>h(y,u),p=y=>h(y,c);return c.addEventListener("pointerleave",m),u.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",p)}}},[c,u,h,d]),D.useEffect(()=>{if(o){const m=p=>{const y=p.target,x={x:p.clientX,y:p.clientY},S=c?.contains(y)||u?.contains(y),C=!vzt(x,o);S?d():C&&(d(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[c,u,o,l,d]),w.jsx(SCe,{...t,ref:a})}),[fzt,dzt]=k9(ib,{isInside:!1}),hzt=Moe("TooltipContent"),SCe=D.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=t,c=I3(Qy,n),l=A9(n),{onClose:u}=c;return D.useEffect(()=>(document.addEventListener(jk,u),()=>document.removeEventListener(jk,u)),[u]),D.useEffect(()=>{if(c.trigger){const f=d=>{d.target?.contains(c.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,u]),w.jsx(u2,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:w.jsxs(x8,{"data-state":c.stateAttribute,...l,...s,ref:e,style:{...s.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:[w.jsx(hzt,{children:r}),w.jsx(fzt,{scope:n,isInside:!0,children:w.jsx(C0t,{id:c.contentId,role:"tooltip",children:i||r})})]})})});bCe.displayName=Qy;var CCe="TooltipArrow",_Ce=D.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=A9(n);return dzt(CCe,n).isInside?null:w.jsx(w8,{...i,...r,ref:e})});_Ce.displayName=CCe;function gzt(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),a=Math.abs(e.left-t.x);switch(Math.min(n,r,i,a)){case a:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function pzt(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 mzt(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 vzt(t,e){const{x:n,y:r}=t;let i=!1;for(let a=0,o=e.length-1;a<e.length;o=a++){const s=e[a],c=e[o],l=s.x,u=s.y,f=c.x,d=c.y;u>r!=d>r&&n<(f-l)*(r-u)/(d-u)+l&&(i=!i)}return i}function yzt(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),xzt(e)}function xzt(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 a=e[e.length-1],o=e[e.length-2];if((a.x-o.x)*(i.y-o.y)>=(a.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 a=n[n.length-1],o=n[n.length-2];if((a.x-o.x)*(i.y-o.y)>=(a.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 wzt=vCe,bzt=yCe,Szt=xCe,Czt=wCe,_zt=bCe,Tzt=_Ce;function ab({delayDuration:t=100,...e}){return w.jsx(wzt,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function _i({...t}){return w.jsx(ab,{children:w.jsx(bzt,{"data-slot":"tooltip",...t})})}function Ti({...t}){return w.jsx(Szt,{"data-slot":"tooltip-trigger",...t})}function Ei({className:t,sideOffset:e=0,children:n,...r}){return w.jsx(Czt,{children:w.jsxs(_zt,{"data-slot":"tooltip-content",sideOffset:e,className:rt("bg-popover text-popover-foreground z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance shadow-lg border border-border","animate-in fade-in-0 zoom-in-95 duration-300 ease-out","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:duration-200 data-[state=closed]:ease-in","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",t),...r,children:[n,w.jsx(Tzt,{className:"fill-popover stroke-border stroke-[0.5px] z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Ezt=({series:t,isActive:e,index:n,viewMode:r="list",onDragStart:i})=>{const{previewUrl:a,isPreviewLoading:o}=kBt(t.uid),s=l=>{i(l,t.uid)},c=w.jsx("div",{className:gs.thumbnailWrapper,children:o?w.jsx("div",{className:gs.thumbnailLoading,children:w.jsx(Jo,{size:"sm"})}):a?w.jsx("img",{src:a,alt:`Превью серии ${t.description}`,className:gs.thumbnailImage,loading:"lazy",draggable:!1}):w.jsx("div",{className:gs.thumbnailEmpty,children:"Нет превью"})});return r==="grid"?w.jsx(ab,{delayDuration:300,children:w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx("div",{className:rt(gs.thumbnailItem,gs.gridMode,e&&gs.active),draggable:!0,onDragStart:s,children:c})}),w.jsxs(Ei,{side:"right",className:gs.tooltipContent,children:[t.description&&w.jsx("p",{className:gs.tooltipTitle,children:t.description}),w.jsxs("p",{className:gs.tooltipSubtitle,children:["#",n+1]})]})]})}):w.jsxs("div",{className:rt(gs.thumbnailItem,gs.listMode,e&&gs.active),draggable:!0,onDragStart:s,children:[c,w.jsxs("div",{className:gs.thumbnailInfo,children:[w.jsx("span",{className:gs.thumbnailDescription,title:t.description,children:t.description}),w.jsxs("span",{className:gs.thumbnailNumber,children:["#",n+1]})]})]})};function Kr({className:t,...e}){return w.jsx("kbd",{"data-slot":"kbd",className:rt("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-foreground/15 [[data-slot=tooltip-content]_&]:text-popover-foreground [[data-slot=tooltip-content]_&]:border [[data-slot=tooltip-content]_&]:border-foreground/20",t),...e})}function y0({className:t,...e}){return w.jsx("div",{"data-slot":"kbd-group",className:rt("inline-flex items-center gap-1",t),...e})}const Ozt=({activeTool:t,layout:e,onSetLayout:n,onSetTool:r,onZoomIn:i,onZoomOut:a,onRotate:o,onInvert:s,onReset:c,onClearAnnotations:l,onFullscreen:u,onDownload:f,onOpenConclusion:d})=>{const{t:h}=Hn("study");return w.jsx(ab,{delayDuration:500,children:w.jsxs("div",{className:vt.headerActions,children:[w.jsxs(bl,{children:[w.jsx(Sl,{asChild:!0,children:w.jsx(bt,{variant:"ghost",size:"icon",children:w.jsx(gK,{})})}),w.jsxs(Cl,{className:vt.popoverContent,children:[w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:e==="single"?"secondary":"ghost",size:"icon",onClick:()=>n("single"),children:w.jsx(pK,{})})}),w.jsxs(Ei,{side:"bottom",className:vt.tooltipContent,children:[h("layout.single"),w.jsxs(y0,{children:[w.jsx(Kr,{children:"Ctrl"}),w.jsx(Kr,{children:"1"})]})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:e==="2v"?"secondary":"ghost",size:"icon",onClick:()=>n("2v"),children:w.jsx(gK,{})})}),w.jsxs(Ei,{side:"bottom",className:vt.tooltipContent,children:[h("layout.twoVertical"),w.jsxs(y0,{children:[w.jsx(Kr,{children:"Ctrl"}),w.jsx(Kr,{children:"2"})]})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:e==="2h"?"secondary":"ghost",size:"icon",onClick:()=>n("2h"),children:w.jsx(Aje,{})})}),w.jsxs(Ei,{side:"bottom",className:vt.tooltipContent,children:[h("layout.twoHorizontal"),w.jsxs(y0,{children:[w.jsx(Kr,{children:"Ctrl"}),w.jsx(Kr,{children:"3"})]})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:e==="4"?"secondary":"ghost",size:"icon",onClick:()=>n("4"),children:w.jsx(H$e,{})})}),w.jsxs(Ei,{side:"bottom",className:vt.tooltipContent,children:[h("layout.fourGrid"),w.jsxs(y0,{children:[w.jsx(Kr,{children:"Ctrl"}),w.jsx(Kr,{children:"4"})]})]})]})]})]}),w.jsx("div",{className:vt.divider}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:t===Qf.toolName?"secondary":"ghost",size:"icon",onClick:()=>r(Qf.toolName),children:w.jsx(cL,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.window_level")," ",w.jsx(Kr,{children:"W"})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:t===Og.toolName?"secondary":"ghost",size:"icon",onClick:()=>r(Og.toolName),children:w.jsx(yje,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.pan")," ",w.jsx(Kr,{children:"H"})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:t===N0.toolName?"secondary":"ghost",size:"icon",onClick:()=>r(N0.toolName),children:w.jsx(Vje,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.length")," ",w.jsx(Kr,{children:"L"})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:t===P0.toolName?"secondary":"ghost",size:"icon",onClick:()=>r(P0.toolName),children:w.jsx(M$e,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.probe")," ",w.jsx(Kr,{children:"C"})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:t===I0.toolName?"secondary":"ghost",size:"icon",onClick:()=>r(I0.toolName),children:w.jsx(pK,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.rectangleROI")," ",w.jsx(Kr,{children:"R"})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:t===k0.toolName?"secondary":"ghost",size:"icon",onClick:()=>r(k0.toolName),children:w.jsx(C$e,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.ellipticalROI")," ",w.jsx(Kr,{children:"E"})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:t===Dg.toolName?"secondary":"ghost",size:"icon",onClick:()=>r(Dg.toolName),children:w.jsx(d2,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.magnify")," ",w.jsx(Kr,{children:"M"})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:t===A0.toolName?"secondary":"ghost",size:"icon",onClick:()=>r(A0.toolName),children:w.jsx(k$e,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.angle")," ",w.jsx(Kr,{children:"A"})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:t===L0.toolName?"secondary":"ghost",size:"icon",onClick:()=>r(L0.toolName),children:w.jsx(G$e,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.cobbAngle")," ",w.jsx(Kr,{children:"B"})]})]}),w.jsx("div",{className:vt.divider}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:"ghost",size:"icon",onClick:i,children:w.jsx(hUe,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.zoom_in"),w.jsxs(y0,{children:[w.jsx(Kr,{children:"Ctrl"}),w.jsx(Kr,{children:"+"})]})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:"ghost",size:"icon",onClick:a,children:w.jsx(pUe,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.zoom_out"),w.jsxs(y0,{children:[w.jsx(Kr,{children:"Ctrl"}),w.jsx(Kr,{children:"-"})]})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:"ghost",size:"icon",onClick:o,children:w.jsx(Pje,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.rotate"),w.jsxs(y0,{children:[w.jsx(Kr,{children:"Shift"}),w.jsx(Kr,{children:"→"})]})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:"ghost",size:"icon",onClick:s,children:w.jsx(O$e,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.invert")," ",w.jsx(Kr,{children:"I"})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:"ghost",size:"icon",onClick:c,children:w.jsx(Mje,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.reset"),w.jsxs(y0,{children:[w.jsx(Kr,{children:"Ctrl"}),w.jsx(Kr,{children:"R"})]})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:"ghost",size:"icon",onClick:l,children:w.jsx(V$e,{})})}),w.jsx(Ei,{className:vt.tooltipContent,children:h("tools.clearAnnotations")})]}),w.jsx("div",{className:vt.divider}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:"ghost",size:"icon",onClick:u,children:w.jsx(dje,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.fullscreen")," ",w.jsx(Kr,{children:"F11"})]})]}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:"ghost",size:"icon",onClick:f,children:w.jsx(vb,{})})}),w.jsxs(Ei,{className:vt.tooltipContent,children:[h("tools.download"),w.jsxs(y0,{children:[w.jsx(Kr,{children:"Ctrl"}),w.jsx(Kr,{children:"S"})]})]})]}),w.jsx("div",{className:vt.divider}),w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx(bt,{variant:"default",onClick:d,className:vt.conclusionButton,children:w.jsx(Mse,{size:16})})}),w.jsx(Ei,{className:vt.tooltipContent,children:h("tools.conclusion")})]})]})})},Dzt="_dialogWrapper_d2i8z_1",Mzt="_visualModal_d2i8z_14",Rzt="_dragHandle_d2i8z_32",Izt="_content_d2i8z_40",Nzt="_closeButton_d2i8z_46",Pzt="_meta_d2i8z_64",kzt="_metaRow_d2i8z_69",Azt="_metaLabel_d2i8z_75",Lzt="_metaValue_d2i8z_80",Vzt="_form_d2i8z_86",$zt="_field_d2i8z_93",jzt="_textarea_d2i8z_99",Uzt="_footer_d2i8z_104",Fzt="_loadingState_d2i8z_109",Bzt="_errorState_d2i8z_116",zzt="_errorMessage_d2i8z_124",wr={dialogWrapper:Dzt,visualModal:Mzt,dragHandle:Rzt,content:Izt,closeButton:Nzt,meta:Pzt,metaRow:kzt,metaLabel:Azt,metaValue:Lzt,form:Vzt,field:$zt,textarea:jzt,footer:Uzt,loadingState:Fzt,errorState:Bzt,errorMessage:zzt},Gzt=({initialPosition:t={x:0,y:0},onDragEnd:e}={})=>{const n=D.useRef(null),r=D.useRef(t),i=D.useCallback(s=>{n.current=s,s&&(t.x===0&&t.y===0||(s.style.transform=`translate(${t.x}px, ${t.y}px)`,r.current=t))},[t.x,t.y]),a=D.useCallback(s=>{if(s.button!==0)return;const c=s.clientX-r.current.x,l=s.clientY-r.current.y,u=d=>{d.preventDefault();const h=d.clientX-c,m=d.clientY-l;r.current={x:h,y:m},n.current&&(n.current.style.transform=`translate(${h}px, ${m}px)`)},f=()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",f),e&&e(r.current)};document.addEventListener("mousemove",u),document.addEventListener("mouseup",f)},[e]),o=D.useCallback(s=>{const c=s.touches[0],l=c.clientX-r.current.x,u=c.clientY-r.current.y,f=h=>{h.cancelable&&h.preventDefault();const m=h.touches[0],p=m.clientX-l,y=m.clientY-u;r.current={x:p,y},n.current&&(n.current.style.transform=`translate(${p}px, ${y}px)`)},d=()=>{document.removeEventListener("touchmove",f),document.removeEventListener("touchend",d),e&&e(r.current)};document.addEventListener("touchmove",f,{passive:!1}),document.addEventListener("touchend",d)},[e]);return{nodeRef:i,handleMouseDown:a,handleTouchStart:o}},Wzt=m2({description:Ra().optional(),conclusion:Ra().optional()}),SI=t=>{t&&(t.style.height="auto",t.style.height=`${t.scrollHeight}px`)},Hzt=({isOpen:t,onOpenChange:e,study_uid:n})=>{const{t:r}=Hn("study"),{conclusionModalPosition:i,setConclusionModalPosition:a}=pCe(),{nodeRef:o,handleMouseDown:s,handleTouchStart:c}=Gzt({initialPosition:i,onDragEnd:a}),{descriptionData:l,isDescriptionLoading:u,descriptionError:f}=ABt(n,t),{updateDescriptionAsync:d,isUpdating:h}=LBt(),m=l?.action_status===2,p=!m&&!!l?.description_property_id&&!l?.description,y=!m&&!!l?.conclusion_property_id&&!l?.conclusion,x=p||y,S=c2({resolver:v2(Wzt),defaultValues:{description:"",conclusion:""},mode:"all"});D.useEffect(()=>{if(l){const M=S.formState.isDirty,I=S.getValues(),V=!I.description&&!I.conclusion;(!M||V)&&S.reset({description:l.description||"",conclusion:l.conclusion||""})}},[l,S]),D.useEffect(()=>{if(t){const M=setTimeout(()=>{document.querySelectorAll(`.${wr.textarea}`).forEach(SI)},50);return()=>clearTimeout(M)}},[t,l]);const C=async M=>{if(!l)return;const I={};if(p&&l.description_property_id&&(I.description_property_id=l.description_property_id,I.description=M.description||""),y&&l.conclusion_property_id&&(I.conclusion_property_id=l.conclusion_property_id,I.conclusion=M.conclusion||""),Object.keys(I).length!==0)try{await d({study_uid:n,data:I}),S.reset({description:M.description||"",conclusion:M.conclusion||""}),e(!1)}catch(V){console.error(V)}},_=M=>{e(M)},T=D.useCallback(M=>M===1?r("conclusion.male"):M===2?r("conclusion.female"):"—",[r]),O=l?.client;return w.jsx(dp,{open:t,onOpenChange:_,modal:!1,children:w.jsx(hp,{className:wr.dialogWrapper,onInteractOutside:M=>M.preventDefault(),showCloseButton:!1,children:w.jsxs("div",{ref:o,className:wr.visualModal,children:[w.jsxs("div",{className:wr.dragHandle,onMouseDown:s,onTouchStart:c,children:[w.jsx(gp,{className:"p-6 pb-2 pr-10",children:w.jsx(pp,{children:r("conclusion.title")})}),w.jsx(bt,{variant:"ghost",size:"icon",className:wr.closeButton,onClick:()=>_(!1),onMouseDown:M=>M.stopPropagation(),type:"button",children:w.jsx(Kg,{className:"h-4 w-4"})})]}),w.jsx("div",{className:wr.content,children:u?w.jsx("div",{className:wr.loadingState,children:w.jsx(Jo,{size:"lg"})}):f?w.jsxs("div",{className:wr.errorState,children:[w.jsx("p",{className:wr.errorMessage,children:r("conclusion.notLinked")}),w.jsx(bt,{variant:"outline",onClick:()=>_(!1),children:r("conclusion.cancel")})]}):w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:wr.meta,children:[O&&w.jsxs("div",{className:wr.metaRow,children:[w.jsxs("span",{className:wr.metaLabel,children:[r("conclusion.patient"),":"]}),w.jsxs("span",{className:wr.metaValue,children:[O.last_name," ",O.first_name," ",O.patr_name]})]}),w.jsxs("div",{className:wr.metaRow,children:[w.jsxs("span",{className:wr.metaLabel,children:[r("conclusion.sex"),":"]}),w.jsx("span",{className:wr.metaValue,children:O?T(O.sex):"—"})]}),w.jsxs("div",{className:wr.metaRow,children:[w.jsxs("span",{className:wr.metaLabel,children:[r("conclusion.age"),":"]}),w.jsx("span",{className:wr.metaValue,children:O?mU(O.birth_date):"—"})]}),l?.person&&w.jsxs("div",{className:wr.metaRow,children:[w.jsxs("span",{className:wr.metaLabel,children:[r("conclusion.doctor"),":"]}),w.jsx("span",{className:wr.metaValue,children:l.person})]}),l?.action_status!==void 0&&w.jsxs("div",{className:wr.metaRow,children:[w.jsxs("span",{className:wr.metaLabel,children:[r("conclusion.status.label"),":"]}),w.jsx("span",{className:wr.metaValue,children:r(`conclusion.status.${l.action_status}`)})]}),l?.end_date&&w.jsxs("div",{className:wr.metaRow,children:[w.jsxs("span",{className:wr.metaLabel,children:[r("conclusion.date"),":"]}),w.jsx("span",{className:wr.metaValue,children:n3(l.end_date)})]})]}),w.jsx(l2,{...S,children:w.jsxs("form",{onSubmit:S.handleSubmit(C),className:wr.form,children:[w.jsx(xn,{control:S.control,name:"description",render:({field:M})=>w.jsxs(wn,{className:wr.field,children:[w.jsx(ir,{htmlFor:M.name,children:r("conclusion.description.label")}),w.jsx(bn,{children:w.jsx(LP,{id:M.name,placeholder:r("conclusion.description.placeholder"),className:wr.textarea,disabled:!p,...M,onChange:I=>{M.onChange(I),SI(I.target)}})}),w.jsx(Ig,{})]})}),w.jsx(xn,{control:S.control,name:"conclusion",render:({field:M})=>w.jsxs(wn,{className:wr.field,children:[w.jsx(ir,{htmlFor:M.name,children:r("conclusion.conclusion.label")}),w.jsx(bn,{children:w.jsx(LP,{id:M.name,placeholder:r("conclusion.conclusion.placeholder"),disabled:!y,className:wr.textarea,...M,onChange:I=>{M.onChange(I),SI(I.target)}})}),w.jsx(Ig,{})]})}),w.jsxs(uL,{className:wr.footer,children:[w.jsx(bt,{type:"button",variant:"outline",onClick:()=>_(!1),disabled:h,children:r("conclusion.cancel")}),x&&w.jsxs(bt,{type:"submit",children:[h&&w.jsx(Jo,{size:"sm",className:"mr-2"}),r("conclusion.submit")]})]})]})})]})})]})})})},qzt="_modalContent_1kw5s_1",Kzt="_modalTitle_1kw5s_9",Yzt="_body_1kw5s_18",Xzt="_studyCard_1kw5s_25",Zzt="_studyInfo_1kw5s_35",Qzt="_studyName_1kw5s_42",Jzt="_filesCount_1kw5s_50",eGt="_actionArea_1kw5s_56",tGt="_downloadAllBtn_1kw5s_62",nGt="_progressContainer_1kw5s_71",rGt="_progressHeader_1kw5s_78",iGt="_progressLabel_1kw5s_87",aGt="_progressValue_1kw5s_91",oGt="_progressBarTrack_1kw5s_98",sGt="_progressBarFill_1kw5s_107",cGt="_footerInfo_1kw5s_233",ps={modalContent:qzt,modalTitle:Kzt,body:Yzt,studyCard:Xzt,studyInfo:Zzt,studyName:Qzt,filesCount:Jzt,actionArea:eGt,downloadAllBtn:tGt,progressContainer:nGt,progressHeader:rGt,progressLabel:iGt,progressValue:aGt,progressBarTrack:oGt,progressBarFill:sGt,footerInfo:cGt},lGt=({isOpen:t,onOpenChange:e,StudyUID:n,studyName:r,count:i})=>{const{t:a}=Hn("study"),{startGeneration:o,isGenerating:s,progress:c}=VBt(),l=()=>{n&&o(n)};return w.jsx(dp,{open:t,onOpenChange:e,children:w.jsxs(hp,{className:rt(ps.modalContent,"sm:max-w-[600px]"),children:[w.jsxs(gp,{children:[w.jsxs(pp,{className:ps.modalTitle,children:[w.jsx(vb,{className:"w-5 h-5 mr-2 text-primary"}),a("downloadModal.title")]}),w.jsx(z6,{className:"sr-only",children:a("downloadModal.description")})]}),w.jsxs("div",{className:ps.body,children:[w.jsxs("div",{className:ps.studyCard,children:[w.jsxs("div",{className:ps.studyInfo,children:[w.jsx("h3",{className:ps.studyName,title:r,children:r}),w.jsx("span",{className:ps.filesCount,children:a("downloadModal.imagesCount",{count:i})})]}),w.jsx("div",{className:ps.actionArea,children:s?w.jsxs("div",{className:ps.progressContainer,children:[w.jsxs("div",{className:ps.progressHeader,children:[w.jsx("span",{className:ps.progressLabel,children:a("downloadModal.preparing")}),w.jsxs("span",{className:ps.progressValue,children:[c,"%"]})]}),w.jsx("div",{className:ps.progressBarTrack,children:w.jsx("div",{className:ps.progressBarFill,style:{width:`${c}%`}})})]}):w.jsxs(bt,{className:ps.downloadAllBtn,onClick:l,children:[w.jsx(r$e,{className:"w-4 h-4 mr-2"}),a("downloadModal.downloadZip")]})})]}),w.jsxs("div",{className:ps.footerInfo,children:[a("downloadModal.studyId")," ",w.jsx("span",{className:"font-mono",children:n})]})]})]})})},uGt=({loadedSlices:t,totalSlices:e,loadingProgress:n})=>{const{t:r}=Hn("study");return w.jsxs("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-black/85 backdrop-blur-md overflow-hidden z-10 border-t border-white/5",children:[w.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary via-primary/90 to-primary/80 transition-all duration-500 ease-out",style:{width:`${n}%`}}),w.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:w.jsx("div",{className:"flex items-center justify-center gap-2.5",children:w.jsxs("span",{className:"text-white/90 text-sm font-medium tracking-wide",children:[r("loading.slices")," ",w.jsx("span",{className:"font-semibold",children:t})," /"," ",e]})})}),w.jsx("div",{className:"absolute right-4 top-1/2 -translate-y-1/2",children:w.jsx("div",{className:"px-3 py-1.5 rounded-full bg-primary/10 backdrop-blur-sm border border-primary/20",children:w.jsxs("span",{className:"text-primary text-xs font-semibold",children:[Math.round(n),"%"]})})})]})},fGt=({viewportId:t,renderingEngine:e,toolGroupId:n,imageIds:r,hasSeries:i,isActiveViewport:a=!1,isSeriesLoading:o,seriesDescription:s,onClick:c})=>{const{t:l}=Hn("study"),[u,f]=D.useState(!1),[d,h]=D.useState(0),[m,p]=D.useState(new Set),[y,x]=D.useState(null),[S,C]=D.useState(100),_=D.useRef(null),T=D.useRef(null),O=D.useRef(null),M=D.useMemo(()=>new Set(r),[r]),I=m.size,V=r.length>0?I/r.length*100:0,k=D.useMemo(()=>s&&s.trim()?s:null,[s]);return D.useEffect(()=>!_.current||!e?void 0:((async()=>{e.enableElement({viewportId:t,type:Rr.STACK,element:_.current});const $=e.getViewport(t);T.current=$,qy(n)?.addViewport(t,e.id)})(),()=>{qy(n)?.removeViewports(e.id,t);try{e.disableElement(t)}catch{}}),[e,t,n]),D.useEffect(()=>{const L=_.current;if(!L)return;const $=U=>{const{parallelScale:Y}=U.detail.camera;if(O.current&&Y){const J=O.current/Y*100;C(Math.round(J))}},W=U=>{const{imageIdIndex:Y}=U.detail;h(Y)},G=U=>{const{range:Y}=U.detail,{lower:J,upper:ne}=Y,F=Math.round(ne-J),ae=Math.round((ne+J)/2);x({windowWidth:F,windowCenter:ae})},oe=U=>{const{imageId:Y}=U.detail.image;M.has(Y)&&p(J=>{if(J.has(Y))return J;const ne=new Set(J);return ne.add(Y),ne})};return L.addEventListener(it.CAMERA_MODIFIED,$),L.addEventListener(it.STACK_NEW_IMAGE,W),L.addEventListener(it.VOI_MODIFIED,G),pt.addEventListener(it.IMAGE_LOADED,oe),()=>{L.removeEventListener(it.CAMERA_MODIFIED,$),L.removeEventListener(it.STACK_NEW_IMAGE,W),L.removeEventListener(it.VOI_MODIFIED,G),pt.removeEventListener(it.IMAGE_LOADED,oe)}},[M]),D.useEffect(()=>{const L=new AbortController,$=L.signal;return(async()=>{const G=T.current;if(!G||!r.length||!i)return;const oe=G.getImageIds();if(!(oe.length>0&&oe[0]===r[0])){p(new Set),f(!0);try{if(await G.setStack(r,0),$.aborted)return;const U=G.getProperties();if(U.voiRange){const{lower:ae,upper:re}=U.voiRange,te=Math.round(re-ae),ye=Math.round((re+ae)/2);x({windowWidth:te,windowCenter:ye})}else x(null);h(0),G.resetCamera();const Y=G.getCamera();Y.parallelScale&&(O.current=Y.parallelScale),C(100),G.render();const J=r.slice(1),ne={priority:0,requestType:In.Interaction},F=ae=>{if(ae>=J.length||$.aborted)return;const re=J[ae];d1(re,ne).catch(te=>{$.aborted||console.warn(`Не удалось загрузить ${re}`,te)}).finally(()=>{$.aborted||F(ae+1)})};F(0)}catch(U){$.aborted||console.error("Ошибка при установке стека:",U)}finally{$.aborted||f(!1)}}})(),()=>{L.abort()}},[r,i]),D.useEffect(()=>{const L=_.current;if(!L)return;const $=W=>{W.preventDefault();const G=T.current;if(!G)return;const oe=W.deltaY>0?1:-1,U=G.getCurrentImageIdIndex(),Y=m.size>0?m.size-1:0;let J=U+oe;J>Y&&(J=Y),J<0&&(J=0),J!==U&&G.setImageIdIndex(J)};return L.addEventListener("wheel",$,{passive:!1}),()=>L.removeEventListener("wheel",$)},[m]),w.jsxs("div",{ref:_,className:rt(vt.viewportCanvas,a&&vt.activeViewport),style:{width:"100%",height:"100%",position:"relative"},onClick:c,children:[k&&w.jsx("div",{className:vt.viewportLabel,children:k}),r.length===0&&!o&&w.jsxs("div",{className:vt.emptyViewportPlaceholder,children:[" ",w.jsx(iUe,{})," ",w.jsx("span",{children:l("viewport.dragDropPlaceholder")})," "]}),u&&w.jsxs("div",{className:vt.loadingOverlay,children:[" ",w.jsx(Jo,{size:"lg"})," ",w.jsx("span",{children:l("viewport.loadingImage")})," "]}),r.length>1&&w.jsxs("div",{className:vt.frameCounter,children:[" ",d+1,"/",r.length," "]}),r.length>1&&I<r.length&&!u&&w.jsx(uGt,{loadedSlices:I,totalSlices:r.length,loadingProgress:V}),!u&&w.jsxs("div",{className:vt.wwcOverlay,children:[" ",y&&w.jsxs(w.Fragment,{children:[" ",w.jsx("span",{children:`WW: ${y.windowWidth} / WC: ${y.windowCenter}`})," ",w.jsx("span",{className:"mx-2",children:"|"})," ",w.jsx("span",{children:`Zoom: ${S}%`})," "]})," "]})]})},dGt=({renderingEngine:t,viewportIndex:e,seriesUid:n,isActive:r,toolGroupId:i,onDrop:a,onDragOver:o,onClick:s})=>{const{t:c}=Hn("study"),{imageIds:l,series:u,isSeriesLoading:f}=gCe(n),[d,h]=D.useState(!1),m=u?.description,p=!!n&&(f||l.length===0),y=C=>{C.preventDefault(),h(!0)},x=C=>{C.preventDefault(),!C.currentTarget.contains(C.relatedTarget)&&h(!1)},S=C=>{C.preventDefault(),h(!1),a(C,e)};return w.jsxs("div",{className:rt(vt.viewportItem,{[vt.dragOver]:d}),onDragEnter:y,onDragLeave:x,onDragOver:o,onDrop:S,onClick:s,children:[p&&w.jsxs("div",{className:vt.loadingOverlay,children:[w.jsx(Jo,{size:"lg"}),w.jsx("span",{children:c("loading.series")})]}),t&&w.jsx(fGt,{viewportId:`viewport-${e}`,renderingEngine:t,toolGroupId:i,imageIds:l,hasSeries:!!n,isActiveViewport:r,isSeriesLoading:p,seriesDescription:m,onClick:s})]})};let Tre=!1;const hGt=()=>{const{id:t}=mMe(),{theme:e,setTheme:n}=Xk(),{t:r}=Hn("study"),i=Sf(),{isSidebarOpen:a,toggleSidebar:o}=pCe(),[s,c]=D.useState(Qf.toolName),[l,u]=D.useState("viewport-0"),[f,d]=D.useState([]),[h,m]=D.useState("single"),[p,y]=D.useState(!1),[x,S]=D.useState(!1),[C,_]=D.useState({0:""}),T=D.useRef(null),O="myRenderingEngine",M="stackToolGroup",[I,V]=D.useState(void 0),[k,L]=D.useState("list"),{study:$,studyErrorStatus:W}=PBt(t),{seriesErrorStatus:G}=gCe(I),{studies:oe,isStudiesLoading:U}=e2e({patient_id:$?.PatientMainDicomTags.PatientID}),Y=tDe({queries:f.map(Ke=>({queryKey:["studyById",Ke],queryFn:()=>I1.getStudyById(Ke),enabled:!!Ke,staleTime:600*1e3,refetchOnWindowFocus:!1}))}),J=Y.reduce((Ke,ue)=>Ke+(ue.data?.Series.length||0),0),ne=D.useMemo(()=>Y.flatMap(Ke=>Ke.data?.Series||[]),[Y]),F=Y.some(Ke=>Ke.isLoading);D.useEffect(()=>{t&&oe.length>0&&f.length===0&&d([t])},[t,oe,f.length]);const ae=$?.Series?.[0]?.modality;D.useEffect(()=>{const Ke=ne[0]?.uid;Ke&&!I&&(V(Ke),_(ue=>({...ue,0:Ke})))},[ne,I]),D.useEffect(()=>{let Ke=!0;(async()=>{try{if(Tre||(await Kwt(),await Mjt(),kFt({maxWebWorkers:navigator.hardwareConcurrency||4}),zu(Qf),zu(Og),zu(JC),zu(N0),zu(P0),zu(I0),zu(k0),zu(Dg),zu(A0),zu(L0),Tre=!0),!Ke)return;const K=new hIt(O);T.current=K,qy(M)&&Xte(M);const fe=GNt(M);fe&&(fe.addTool(Qf.toolName),fe.addTool(Og.toolName),fe.addTool(JC.toolName),fe.addTool(N0.toolName),fe.setToolPassive(N0.toolName),fe.addTool(P0.toolName),fe.setToolPassive(P0.toolName),fe.addTool(I0.toolName),fe.setToolPassive(I0.toolName),fe.addTool(k0.toolName),fe.setToolPassive(k0.toolName),fe.addTool(Dg.toolName),fe.setToolPassive(Dg.toolName),fe.addTool(A0.toolName),fe.setToolPassive(A0.toolName),fe.addTool(L0.toolName),fe.setToolPassive(L0.toolName),fe.setToolActive(Qf.toolName,{bindings:[{mouseButton:ud.Primary}]}),fe.setToolActive(Og.toolName,{bindings:[{mouseButton:ud.Auxiliary}]}),fe.setToolActive(JC.toolName,{bindings:[{mouseButton:ud.Secondary}]}))}catch(K){console.error("Ошибка инициализации Cornerstone:",K)}})();const B=()=>{T.current?.resize()};return document.addEventListener("fullscreenchange",B),()=>{Ke=!1,document.removeEventListener("fullscreenchange",B);try{Xte(M)}catch{}T.current?.destroy(),T.current=null}},[]),D.useEffect(()=>{const Ke=e;return Ke!=="dark"&&n("dark"),()=>{Ke!=="dark"&&n(Ke)}},[]),D.useEffect(()=>{if(!T.current)return;const Ke=setTimeout(()=>{T.current?.resize();const ue=tr(h);for(let B=0;B<ue;B++){const K=T.current?.getViewport(`viewport-${B}`);K&&K.render()}},0);return()=>clearTimeout(Ke)},[h,a]);const re=Ke=>{d(ue=>ue.includes(Ke)?ue.length===1?ue:ue.filter(B=>B!==Ke):[...ue,Ke])},te=()=>{const Ke=window.history.state?.idx>0;i(Ke?-1:"/studies")},ye=D.useCallback(Ke=>{try{const ue=T.current?.getViewport(l);if(!ue)return;const K=ue.getCamera().parallelScale??1,fe=Math.max(K*Ke,1e-4);ue.setCamera({parallelScale:fe}),ue.render()}catch(ue){console.error("Ошибка при зуме:",ue)}},[l]),we=D.useCallback(()=>ye(.9),[ye]),Oe=D.useCallback(()=>ye(1.1),[ye]),Te=D.useCallback(()=>{try{const Ke=T.current?.getViewport(l);if(!Ke)return;const B=((typeof Ke.getRotation=="function"?Ke.getRotation():Ke.getProperties?.().rotation??0)+90)%360;typeof Ke.setRotation=="function"?Ke.setRotation(B):typeof Ke.setProperties=="function"&&Ke.setProperties({rotation:B}),Ke.render()}catch(Ke){console.error("Ошибка при вращении:",Ke)}},[l]),Me=D.useCallback(()=>{try{const Ke=T.current?.getViewport(l);if(!Ke)return;const ue=Ke.getProperties?.()??{},B=ue.invert??ue.inversion??!1;Ke.setProperties?.({invert:!B,inversion:!B}),Ke.render()}catch(Ke){console.error("Ошибка при инверсии:",Ke)}},[l]),be=D.useCallback(()=>{try{const Ke=T.current?.getViewport(l);if(!Ke)return;Ke.resetCamera(),Ke.resetProperties(),Ke.render()}catch(Ke){console.error("Ошибка при сбросе:",Ke)}ft(Qf.toolName)},[l]),Ye=(Ke,ue)=>{u(`viewport-${Ke}`),ue&&V(ue)},ft=D.useCallback(Ke=>{const ue=qy(M);ue&&(ue.setToolPassive(Qf.toolName),ue.setToolPassive(N0.toolName),ue.setToolPassive(P0.toolName),ue.setToolPassive(I0.toolName),ue.setToolPassive(k0.toolName),ue.setToolPassive(Og.toolName),ue.setToolPassive(Dg.toolName),ue.setToolPassive(A0.toolName),ue.setToolPassive(L0.toolName),ue.setToolActive(Ke,{bindings:[{mouseButton:ud.Primary}]}),c(Ke))},[]),je=D.useCallback(async()=>{const Ke=document.querySelector(`.${vt.viewerContainer}`);Ke&&(document.fullscreenElement?await document.exitFullscreen():await Ke.requestFullscreen(),setTimeout(()=>{T.current?.resize()},0))},[]),It=D.useCallback(()=>{y(!0)},[]),Rt=D.useCallback(()=>{v1.removeAllAnnotations(),T.current?.render()},[]),cn=D.useCallback((Ke,ue)=>{Ke.dataTransfer.setData("seriesId",ue),Ke.dataTransfer.effectAllowed="copy"},[]),ln=D.useCallback(Ke=>{Ke.preventDefault(),Ke.dataTransfer.dropEffect="copy"},[]),en=D.useCallback((Ke,ue)=>{Ke.preventDefault();const B=Ke.dataTransfer.getData("seriesId");B&&(_(K=>({...K,[ue]:B})),u(`viewport-${ue}`),V(B))},[]);D.useEffect(()=>{const Ke=ue=>{if(ue.target instanceof HTMLInputElement||ue.target instanceof HTMLTextAreaElement)return;const B=ue.ctrlKey||ue.metaKey,K=ue.shiftKey;switch(ue.key.toLowerCase()){case"1":B&&(ue.preventDefault(),m("single"));break;case"2":B&&(ue.preventDefault(),m("2v"));break;case"3":B&&(ue.preventDefault(),m("2h"));break;case"4":B&&(ue.preventDefault(),m("4"));break;case"w":!B&&!K&&(ue.preventDefault(),ft(Qf.toolName));break;case"h":!B&&!K&&(ue.preventDefault(),ft(Og.toolName));break;case"l":!B&&!K&&(ue.preventDefault(),ft(N0.toolName));break;case"c":!B&&!K&&(ue.preventDefault(),ft(P0.toolName));break;case"e":!B&&!K&&(ue.preventDefault(),ft(k0.toolName));break;case"m":!B&&!K&&(ue.preventDefault(),ft(Dg.toolName));break;case"i":!B&&!K&&(ue.preventDefault(),Me());break;case"f11":ue.preventDefault(),je();break;case"r":ue.preventDefault(),B?be():ft(I0.toolName);break;case"a":!B&&!K&&(ue.preventDefault(),ft(A0.toolName));break;case"b":!B&&!K&&(ue.preventDefault(),ft(L0.toolName));break;case"=":case"+":B&&(ue.preventDefault(),we());break;case"-":B&&(ue.preventDefault(),Oe());break;case"s":B&&(ue.preventDefault(),It());break;case"arrowright":K&&(ue.preventDefault(),Te());break}};return document.addEventListener("keydown",Ke),()=>{document.removeEventListener("keydown",Ke)}},[ft,we,Oe,Te,Me,be,je,It]);const tr=Ke=>{switch(Ke){case"single":return 1;case"2v":return 2;case"2h":return 2;case"4":return 4;default:return 1}};return G==404||W==404?w.jsx(GBt,{}):w.jsxs("div",{className:vt.container,onContextMenu:Ke=>Ke.preventDefault(),children:[w.jsxs("header",{className:vt.header,children:[w.jsxs("div",{className:vt.headerLeft,children:[w.jsx(bt,{onClick:te,children:w.jsx(rL,{className:vt.backIcon})}),w.jsxs("div",{className:vt.info,children:[w.jsx("h1",{className:vt.title,children:r("title")}),$?w.jsxs("div",{className:vt.metadata,children:[w.jsx("span",{className:rt(vt.studyName,"truncate max-w-[450px]"),children:$?.Description||r("fallbackDescription")}),w.jsx("span",{className:vt.separator,children:"•"}),$?.PatientMainDicomTags.PatientName&&w.jsx("span",{className:vt.patientName,children:Jye($.PatientMainDicomTags.PatientName)}),w.jsx("span",{className:vt.separator,children:"•"}),w.jsxs("span",{className:vt.date,children:[CJ($?.MainDicomTags.StudyDate)," ","|"," ",Xmt($?.MainDicomTags.StudyTime)]}),ae&&w.jsx(w.Fragment,{children:w.jsx("span",{className:vt.modalityBadge,children:ae})})]}):w.jsx(An,{className:"h-5 w-3xl mt-2.5"})]})]}),w.jsx(Ozt,{activeTool:s,layout:h,onSetLayout:m,onSetTool:ft,onZoomIn:we,onZoomOut:Oe,onRotate:Te,onInvert:Me,onReset:be,onClearAnnotations:Rt,onFullscreen:je,onDownload:It,onOpenConclusion:()=>S(!0)})]}),w.jsxs("div",{className:vt.viewerContainer,children:[a&&w.jsxs("aside",{className:vt.sidebar,children:[w.jsx("button",{className:vt.sidebarToggle,onClick:o,title:r(a?"sidebar.toggle.hide":"sidebar.toggle.show"),children:a?w.jsx(aL,{size:18}):w.jsx(qg,{size:18})}),w.jsx("div",{className:vt.studiesSection,children:w.jsxs(wwt,{children:[w.jsx(bwt,{asChild:!0,children:w.jsxs("div",{className:vt.studiesSectionHeader,children:[w.jsx("h3",{className:vt.studiesSectionTitle,children:r("sidebar.studies.title")}),w.jsxs("div",{className:vt.studiesHeaderRight,children:[!U&&$&&w.jsxs("span",{className:vt.studiesCount,children:[f.length,"/",oe.length]}),w.jsx(Ese,{size:18,color:"white"})]})]})}),w.jsx(Swt,{className:vt.studiesList,children:U?w.jsxs("div",{className:vt.prewiewLoading,children:[w.jsx(Jo,{}),w.jsx("p",{children:r("sidebar.studies.loading")})]}):oe.length===0?w.jsx("div",{className:vt.studiesEmpty,children:w.jsx("p",{children:r("sidebar.studies.empty")})}):oe.map(Ke=>{const ue=Ke.uid===t;return w.jsxs("div",{className:rt(vt.studyItem,{[vt.currentStudy]:ue,[vt.selectedStudy]:f.includes(Ke.uid)}),children:[w.jsx(Am,{id:`study-${Ke.uid}`,checked:f.includes(Ke.uid),onCheckedChange:()=>re(Ke.uid),className:vt.studyCheckbox}),w.jsxs("label",{htmlFor:`study-${Ke.uid}`,className:vt.studyLabel,children:[w.jsxs("div",{className:vt.studyDescription,children:[Ke.description,ue&&w.jsx("span",{className:vt.currentBadge,children:r("sidebar.studies.currentBadge")})]}),w.jsx("div",{className:vt.studyDate,children:n3(Ke.date)})]})]},Ke.uid)})})]})}),w.jsxs("div",{className:vt.seriesSection,children:[w.jsxs("div",{className:vt.sidebarHeader,children:[w.jsx("h3",{className:vt.sidebarTitle,children:r("sidebar.title")}),w.jsxs("div",{className:vt.sidebarHeaderActions,children:[w.jsx("span",{className:vt.imageCount,children:ne.length||0}),w.jsxs("div",{className:vt.viewModeToggle,children:[w.jsx(bt,{variant:k==="list"?"secondary":"ghost",size:"icon",className:vt.viewModeButton,onClick:()=>L("list"),title:r("sidebar.viewMode.list"),children:w.jsx(Ise,{size:14})}),w.jsx(bt,{variant:k==="grid"?"secondary":"ghost",size:"icon",className:vt.viewModeButton,onClick:()=>L("grid"),title:r("sidebar.viewMode.grid"),children:w.jsx(nje,{size:14})})]})]})]}),w.jsx("div",{className:vt.thumbnailList,children:F&&J===0?w.jsxs("div",{className:vt.prewiewLoading,children:[w.jsx(Jo,{})," ",w.jsx("p",{children:r("loading.preview")})]}):J===0?w.jsx("div",{className:vt.thumbnailEmpty,children:r("sidebar.empty")}):Y.map(Ke=>{if(!Ke.isSuccess||!Ke.data)return null;const ue=Ke.data,B=ue.ID===t;return w.jsxs(Ce.Fragment,{children:[w.jsxs("div",{className:vt.seriesGroupHeader,children:[w.jsxs("span",{className:vt.seriesGroupTitle,title:ue.Description,children:[B&&w.jsx("span",{className:vt.currentBadgeSmall,children:r("sidebar.studies.currentBadge")}),ue.Description||r("fallbackDescription")]}),w.jsx("span",{className:vt.seriesGroupDate,children:CJ(ue.MainDicomTags.StudyDate)})]}),ue.Series.map((K,fe)=>w.jsx(Ezt,{series:K,index:fe,isActive:K.uid===I,onDragStart:ie=>cn(ie,K.uid),viewMode:k},K.uid))]},ue.ID)})})]})]}),!a&&w.jsx("button",{className:vt.sidebarToggleClosed,onClick:o,title:r("sidebar.toggle.show"),children:w.jsx(qg,{size:18})}),w.jsx("main",{className:vt.viewer,children:w.jsx("div",{className:vt.imageContainer,children:w.jsx("div",{className:rt(vt.viewportGrid,{[vt.single]:h==="single",[vt.twoVertical]:h==="2v",[vt.twoHorizontal]:h==="2h",[vt.fourGrid]:h==="4"}),children:Array.from({length:tr(h)}).map((Ke,ue)=>{const B=C[ue];return w.jsx(dGt,{viewportIndex:ue,seriesUid:B||"",isActive:l===`viewport-${ue}`,renderingEngine:T.current,toolGroupId:M,onDrop:en,onDragOver:ln,onClick:()=>Ye(ue,B)},ue)})})})})]}),t&&w.jsx(Hzt,{isOpen:x,onOpenChange:S,study_uid:t},t),t&&w.jsx(lGt,{isOpen:p,onOpenChange:y,StudyUID:t,studyName:$?.Description||r("fallbackDescription"),count:$?.Series?.length??0})]})},gGt="_container_z71j4_1",pGt="_errorContainer_z71j4_8",mGt="_headerSection_z71j4_15",vGt="_title_z71j4_22",yGt="_description_z71j4_29",xGt="_filterCard_z71j4_35",wGt="_filterContent_z71j4_41",bGt="_searchGroup_z71j4_47",SGt="_searchDivider_z71j4_59",CGt="_searchWrapper_z71j4_86",_Gt="_searchIcon_z71j4_92",TGt="_searchInput_z71j4_103",EGt="_searchActionWrapper_z71j4_122",OGt="_searchButton_z71j4_132",DGt="_filtersContainer_z71j4_152",MGt="_dateButton_z71j4_158",RGt="_dateIcon_z71j4_173",IGt="_datePopover_z71j4_178",NGt="_filterButton_z71j4_182",PGt="_outline_z71j4_189",kGt="_ghost_z71j4_196",AGt="_filterIcon_z71j4_204",LGt="_filterBadge_z71j4_210",VGt="_exportWrapper_z71j4_224",$Gt="_exportButton_z71j4_228",jGt="_popoverContent_z71j4_240",UGt="_wide_z71j4_246",FGt="_popoverSpace_z71j4_250",BGt="_popoverTitle_z71j4_256",zGt="_checkboxWrapper_z71j4_262",GGt="_checkboxLabel_z71j4_268",WGt="_loading_z71j4_274",HGt="_tableRow_z71j4_282",qGt="_patientInfo_z71j4_286",KGt="_patientName_z71j4_292",YGt="_patientMeta_z71j4_298",XGt="_birthDate_z71j4_305",ZGt="_clientIdValue_z71j4_305",QGt="_metaDivider_z71j4_309",JGt="_sexBadge_z71j4_313",eWt="_sexM_z71j4_319",tWt="_sexF_z71j4_323",nWt="_sexUndefined_z71j4_327",rWt="_sexNull_z71j4_328",iWt="_actionId_z71j4_332",_n={container:gGt,errorContainer:pGt,headerSection:mGt,title:vGt,description:yGt,filterCard:xGt,filterContent:wGt,searchGroup:bGt,searchDivider:SGt,searchWrapper:CGt,searchIcon:_Gt,searchInput:TGt,searchActionWrapper:EGt,searchButton:OGt,filtersContainer:DGt,dateButton:MGt,dateIcon:RGt,datePopover:IGt,filterButton:NGt,outline:PGt,ghost:kGt,filterIcon:AGt,filterBadge:LGt,exportWrapper:VGt,exportButton:$Gt,popoverContent:jGt,wide:UGt,popoverSpace:FGt,popoverTitle:BGt,checkboxWrapper:zGt,checkboxLabel:GGt,loading:WGt,tableRow:HGt,patientInfo:qGt,patientName:KGt,patientMeta:YGt,birthDate:XGt,clientIdValue:ZGt,metaDivider:QGt,sexBadge:JGt,sexM:eWt,sexF:tWt,sexUndefined:nWt,sexNull:rWt,actionId:iWt},aWt="_content_uetwz_1",oWt="_header_uetwz_12",sWt="_form_uetwz_24",cWt="_formContent_uetwz_32",lWt="_section_uetwz_40",uWt="_sectionTitle_uetwz_46",fWt="_gridSection_uetwz_58",dWt="_selectFull_uetwz_69",hWt="_footer_uetwz_73",ms={content:aWt,header:oWt,form:sWt,formContent:cWt,section:lWt,sectionTitle:uWt,gridSection:fWt,selectFull:dWt,footer:hWt},TCe={DX:"DX",MG:"MG"},gWt=t=>t in TCe,pWt=()=>{const{t}=Hn("common");return{getModalityName:n=>!n||!gWt(n)?n||t("modalities.unknown"):t(`modalities.${n}`)}};class N1{static async getWorklist(e){return(await ni.get("/worklist",{params:{station_aet:e.station_aet,pat_id:e.pat_id,pat_name:`${e.pat_name}*`,from_date:e.from_date,till_date:e.till_date,limit:e.limit,offset:e.offset}})).data}static async createStudy(e){return(await ni.post("/worklist",e)).data}static async uploadFile(e){const n=new FormData;return n.append("file",e.file),(await ni.post(`/worklist/${e.item_id}/upload`,n,{headers:{"Content-Type":"multipart/form-data"}})).data}static async startCapture(e){return(await ni.post("/temp-capture/start",e)).data}static async cancelCapture(e){return(await ni.post(`/temp-capture/cancel/${e.session_id}`)).data}static async confirmCapture(e){const{session_id:n,...r}=e;return(await ni.post(`/temp-capture/confirm/${n}`,r)).data}static connectToCaptureStream(e,n){const i=`${ni.defaults.baseURL}/temp-capture/stream/${e}`,a=new EventSource(i,{withCredentials:!0});return a.onmessage=o=>{try{const s=JSON.parse(o.data);n(s)}catch(s){console.error("Ошибка парсинга SSE сообщения:",s)}},a.onerror=o=>{console.error("SSE Error:",o)},a}}const mWt=t=>{const e=Sh({queryKey:["worklist",t],queryFn:()=>N1.getWorklist(t),enabled:!!t.from_date&&!!t.till_date,refetchInterval:6e4});return{worklist:e.data||[],isWorklistLoading:e.isLoading,isWorklistFetching:e.isFetching,isWorklistError:e.isError,worklistRefetch:e.refetch}},vWt=()=>{const{t}=Hn("worklist"),e=$c(),n=jc({mutationFn:r=>N1.createStudy(r),onSuccess:()=>{Br.success(t("notifications.create_success")),e.invalidateQueries({queryKey:["worklist"]})},onError:r=>{console.error("Failed to create study:",r),Br.error(t("notifications.create_error"))}});return{createStudy:n.mutate,createStudyAsync:n.mutateAsync,isCreating:n.isPending}},yWt=()=>{const t=$c(),e=jc({mutationFn:n=>N1.uploadFile(n),onSuccess:()=>{t.invalidateQueries({queryKey:["worklist"]})},onError:n=>{console.error("Failed to upload file:",n),Br.error("Ошибка загрузки файла")}});return{uploadFile:e.mutate,uploadFileAsync:e.mutateAsync,isUploading:e.isPending}},xWt=()=>{const{t}=Hn("worklist"),e=jc({mutationFn:n=>N1.startCapture(n),onSuccess:n=>{console.log("Session started:",n.session_id)},onError:n=>{console.error("Failed to start capture:",n),Br.error(t("notifications.start_error"))}});return{startCaptureAsync:e.mutateAsync,isStarting:e.isPending}},wWt=()=>{const{t}=Hn("worklist"),e=jc({mutationFn:n=>N1.cancelCapture(n),onSuccess:()=>{Br.success(t("notifications.cancel_success"))},onError:n=>{console.error("Failed to cancel capture:",n),Br.error(t("notifications.cancel_error"))}});return{cancelCaptureAsync:e.mutateAsync,isCancelling:e.isPending}},bWt=(t,e)=>{const n=D.useRef(e);D.useEffect(()=>{n.current=e},[e]),D.useEffect(()=>{if(!t)return;const r=N1.connectToCaptureStream(t,i=>{n.current?.(i)});return()=>{console.log("Closing SSE stream"),r.close()}},[t])},SWt=()=>{const{t}=Hn("worklist"),e=Sf(),n=$c(),r=jc({mutationFn:i=>N1.confirmCapture(i),onSuccess:i=>{Br.success(t("notifications.finish_success")),e(`/studies/${i.study_uid}`),n.invalidateQueries({queryKey:["worklist"]})},onError:i=>{console.error("Failed to confirm capture:",i),Br.error(t("notifications.finish_error"))}});return{confirmCaptureAsync:r.mutateAsync,isConfirming:r.isPending}},CWt=({isOpen:t,onOpenChange:e,devices:n})=>{const{t:r}=Hn("worklist"),i=o3(),{getModalityName:a}=pWt(),[o,s]=D.useState(!1),{createStudyAsync:c,isCreating:l}=vWt(),u=m2({acc_num:Ra().optional(),pat_name:Ra().min(1,r("create_new_study.validation.pat_name_required")),pat_id:Ra().min(1,r("create_new_study.validation.pat_id_required")),pat_birth:oy({message:r("create_new_study.validation.pat_birth_required")}),pat_sex:Ra().min(1,r("create_new_study.validation.pat_sex_required")),modality:Ra().optional(),sched_date:oy({message:r("create_new_study.validation.sched_date_required")}),sched_time:Ra().optional(),station_aet:Ra().optional(),req_desc:Ra().optional()}),f=c2({resolver:v2(u),defaultValues:{acc_num:"",pat_name:"",pat_id:"",pat_birth:void 0,pat_sex:"",modality:"",sched_date:void 0,sched_time:"",station_aet:"",req_desc:""}});gU(o,f.formState.errors,s);const d=Object.keys(TCe),h=async p=>{const y={pat_name:p.pat_name,pat_id:p.pat_id,pat_birth:Ji(p.pat_birth,"yyyy-MM-dd"),pat_sex:p.pat_sex,sched_date:Ji(p.sched_date,"yyyy-MM-dd"),...p.acc_num&&{acc_num:p.acc_num},...p.modality&&{modality:p.modality},...p.sched_time&&{sched_time:`${p.sched_time}:00`},...p.station_aet&&{station_aet:p.station_aet},...p.req_desc&&{req_desc:p.req_desc}};try{await c(y),f.reset(),e(!1)}catch{}},m=()=>{s(!0)};return w.jsx(dp,{open:t,onOpenChange:e,children:w.jsxs(hp,{className:ms.content,children:[w.jsx(gp,{className:ms.header,children:w.jsx(pp,{children:r("create_new_study.title")})}),w.jsx(l2,{...f,children:w.jsxs("form",{onSubmit:f.handleSubmit(h,m),className:ms.form,children:[w.jsxs("div",{className:ms.formContent,children:[w.jsxs("div",{className:ms.section,children:[w.jsxs("div",{className:ms.sectionTitle,children:[w.jsx(Pse,{className:"w-5 h-5 text-primary"}),r("create_new_study.patient_section")]}),w.jsx(xn,{control:f.control,name:"pat_name",render:({field:p})=>w.jsxs(wn,{children:[w.jsxs(ir,{children:[r("create_new_study.pat_name")," *"]}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:r("create_new_study.pat_name_placeholder"),disabled:l,...p})})]})}),w.jsxs("div",{className:ms.gridSection,children:[w.jsx(xn,{control:f.control,name:"pat_id",render:({field:p})=>w.jsxs(wn,{children:[w.jsxs(ir,{children:[r("create_new_study.pat_id")," *"]}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:r("create_new_study.pat_id_placeholder"),disabled:l,...p})})]})}),w.jsx(xn,{control:f.control,name:"pat_sex",render:({field:p,fieldState:y})=>w.jsxs(wn,{children:[w.jsxs(ir,{children:[r("create_new_study.pat_sex")," *"]}),w.jsxs(F5,{onValueChange:p.onChange,value:p.value,disabled:l,children:[w.jsx(bn,{children:w.jsx(z5,{className:rt("w-full",y.error&&"border-destructive"),children:w.jsx(B5,{placeholder:r("create_new_study.pat_sex_placeholder")})})}),w.jsxs(G5,{children:[w.jsx(tf,{value:"M",children:r("create_new_study.sex_m")}),w.jsx(tf,{value:"F",children:r("create_new_study.sex_f")}),w.jsx(tf,{value:"O",children:r("create_new_study.sex_o")})]})]})]})})]}),w.jsx(xn,{control:f.control,name:"pat_birth",render:({field:p,fieldState:y})=>w.jsxs(wn,{children:[w.jsxs(ir,{children:[r("create_new_study.pat_birth")," *"]}),w.jsxs(bl,{children:[w.jsx(Sl,{asChild:!0,children:w.jsx(bn,{children:w.jsxs(bt,{variant:"outline",disabled:l,className:rt("w-full justify-start text-left font-normal",!p.value&&"text-muted-foreground",y.error&&"border-destructive"),children:[w.jsx(K0,{className:"mr-2 h-4 w-4"}),p.value?Ji(p.value,"dd.MM.yyyy"):w.jsx("span",{children:r("create_new_study.select_date")})]})})}),w.jsx(Cl,{className:"w-auto p-0",align:"start",side:"bottom",children:w.jsx($g,{mode:"single",selected:p.value,onSelect:p.onChange,captionLayout:"dropdown",disabled:x=>x>new Date||x<new Date("1900-01-01"),locale:i,fixedWeeks:!0})})]})]})})]}),w.jsxs("div",{className:ms.section,children:[w.jsxs("div",{className:ms.sectionTitle,children:[w.jsx(j6,{className:"w-5 h-5 text-primary"}),r("create_new_study.study_section")]}),w.jsxs("div",{className:ms.gridSection,children:[w.jsx(xn,{control:f.control,name:"modality",render:({field:p})=>w.jsxs(wn,{children:[w.jsx(ir,{children:r("create_new_study.modality")}),w.jsxs(F5,{onValueChange:p.onChange,value:p.value,disabled:l,children:[w.jsx(bn,{children:w.jsx(z5,{className:ms.selectFull,children:w.jsx(B5,{placeholder:r("create_new_study.modality_placeholder")})})}),w.jsx(G5,{children:d.map(y=>w.jsx(tf,{value:y,children:a(y)},y))})]})]})}),w.jsx(xn,{control:f.control,name:"station_aet",render:({field:p})=>w.jsxs(wn,{children:[w.jsx(ir,{children:r("create_new_study.station_aet")}),w.jsxs(F5,{onValueChange:p.onChange,value:p.value,disabled:l,children:[w.jsx(bn,{children:w.jsx(z5,{className:ms.selectFull,children:w.jsx(B5,{placeholder:r("create_new_study.station_aet_placeholder")})})}),w.jsx(G5,{children:n.map(y=>w.jsxs(tf,{value:y.aetitle,children:[y.name," (",y.aetitle,")"]},y.aetitle))})]})]})})]}),w.jsx(xn,{control:f.control,name:"acc_num",render:({field:p})=>w.jsxs(wn,{children:[w.jsx(ir,{children:r("create_new_study.acc_num")}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:r("create_new_study.acc_num_placeholder"),disabled:l,...p})})]})}),w.jsx(xn,{control:f.control,name:"req_desc",render:({field:p})=>w.jsxs(wn,{children:[w.jsx(ir,{children:r("create_new_study.req_desc")}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:r("create_new_study.req_desc_placeholder"),disabled:l,...p})})]})})]}),w.jsxs("div",{className:ms.section,children:[w.jsxs("div",{className:ms.sectionTitle,children:[w.jsx(Ose,{className:"w-5 h-5 text-primary"}),r("create_new_study.schedule_section")]}),w.jsxs("div",{className:ms.gridSection,children:[w.jsx(xn,{control:f.control,name:"sched_date",render:({field:p,fieldState:y})=>w.jsxs(wn,{children:[w.jsxs(ir,{children:[r("create_new_study.sched_date")," *"]}),w.jsxs(bl,{children:[w.jsx(Sl,{asChild:!0,children:w.jsx(bn,{children:w.jsxs(bt,{variant:"outline",disabled:l,className:rt("w-full justify-start text-left font-normal",!p.value&&"text-muted-foreground",y.error&&"border-destructive"),children:[w.jsx(K0,{className:"mr-2 h-4 w-4"}),p.value?Ji(p.value,"dd.MM.yyyy"):w.jsx("span",{children:r("create_new_study.select_date")})]})})}),w.jsx(Cl,{className:"w-auto p-0",align:"start",side:"bottom",children:w.jsx($g,{mode:"single",selected:p.value,onSelect:p.onChange,captionLayout:"dropdown",disabled:x=>{const S=new Date;return S.setHours(0,0,0,0),x<S},locale:i,fixedWeeks:!0})})]})]})}),w.jsx(xn,{control:f.control,name:"sched_time",render:({field:p})=>w.jsxs(wn,{children:[w.jsx(ir,{children:r("create_new_study.sched_time")}),w.jsx(bn,{children:w.jsx(Ar,{type:"time",disabled:l,...p})})]})})]})]})]}),w.jsxs("div",{className:ms.footer,children:[w.jsx(bt,{variant:"outline",type:"button",onClick:()=>e(!1),disabled:l,children:r("create_new_study.cancel")}),w.jsxs(bt,{type:"submit",disabled:l,children:[l?w.jsx(U6,{className:"h-4 w-4 animate-spin"}):w.jsx(F6,{className:"h-4 w-4"}),r(l?"create_new_study.creating":"create_new_study.create")]})]})]})})]})})},_Wt="_dialogContent_sk5qm_1",TWt="_header_sk5qm_11",EWt="_body_sk5qm_16",OWt="_patientSection_sk5qm_24",DWt="_patientName_sk5qm_32",MWt="_metaGrid_sk5qm_38",RWt="_fullWidth_sk5qm_44",IWt="_metaItem_sk5qm_48",NWt="_metaLabel_sk5qm_54",PWt="_metaValue_sk5qm_61",kWt="_previewHeader_sk5qm_68",AWt="_previewSection_sk5qm_74",LWt="_previewTitle_sk5qm_80",VWt="_waitingBlock_sk5qm_87",$Wt="_waitingIcon_sk5qm_97",jWt="_waitingContent_sk5qm_111",UWt="_waitingTitle_sk5qm_117",FWt="_waitingText_sk5qm_124",BWt="_imageGrid_sk5qm_130",zWt="_empty_sk5qm_136",GWt="_imageWrapper_sk5qm_140",WWt="_few_sk5qm_145",HWt="_pending_sk5qm_160",qWt="_pendingContent_sk5qm_165",KWt="_pendingText_sk5qm_174",YWt="_imageCount_sk5qm_179",XWt="_footer_sk5qm_192",ZWt="_tooltipContent_sk5qm_201",QWt="_tooltipTitle_sk5qm_205",JWt="_uploadedSection_sk5qm_212",eHt="_uploadedHeader_sk5qm_222",tHt="_uploadedTitle_sk5qm_228",nHt="_uploadedCount_sk5qm_235",rHt="_filesList_sk5qm_248",iHt="_fileItem_sk5qm_254",aHt="_removeFileBtn_sk5qm_267",oHt="_fileIcon_sk5qm_271",sHt="_fileInfo_sk5qm_278",cHt="_fileName_sk5qm_286",lHt="_fileSize_sk5qm_295",uHt="_buttonWrapper_sk5qm_324",fn={dialogContent:_Wt,header:TWt,body:EWt,patientSection:OWt,patientName:DWt,metaGrid:MWt,fullWidth:RWt,metaItem:IWt,metaLabel:NWt,metaValue:PWt,previewHeader:kWt,previewSection:AWt,previewTitle:LWt,waitingBlock:VWt,waitingIcon:$Wt,waitingContent:jWt,waitingTitle:UWt,waitingText:FWt,imageGrid:BWt,empty:zWt,imageWrapper:GWt,few:WWt,pending:HWt,pendingContent:qWt,pendingText:KWt,imageCount:YWt,footer:XWt,tooltipContent:ZWt,tooltipTitle:QWt,uploadedSection:JWt,uploadedHeader:eHt,uploadedTitle:tHt,uploadedCount:nHt,filesList:rHt,fileItem:iHt,removeFileBtn:aHt,fileIcon:oHt,fileInfo:sHt,fileName:cHt,fileSize:lHt,buttonWrapper:uHt},fHt=({isOpen:t,onOpenChange:e,onConfirm:n,isCancelling:r})=>{const{t:i}=Hn("worklist");return w.jsx(yE,{open:t,onOpenChange:e,children:w.jsxs(xE,{className:"max-w-sm",children:[w.jsxs(wE,{children:[w.jsx(SE,{children:i("confirm_close.title")}),w.jsx(CE,{children:i("confirm_close.description")})]}),w.jsxs(bE,{children:[w.jsx(_E,{disabled:r,children:i("confirm_close.cancel")}),w.jsxs(iU,{onClick:a=>{a.preventDefault(),n()},disabled:r,className:"bg-destructive hover:bg-destructive/90 text-destructive-foreground",children:[r?w.jsx(Jo,{size:"sm",className:"mr-2"}):null,i("confirm_close.confirm")]})]})]})})},dHt="_imageWrapper_zqmlk_1",hHt="_image_zqmlk_1",gHt="_seriesCount_zqmlk_20",CI={imageWrapper:dHt,image:hHt,seriesCount:gHt},pHt=({src:t,alt:e,count:n})=>{const[r,i]=D.useState(!1);return w.jsxs(ho.div,{className:CI.imageWrapper,layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.3},children:[w.jsx(yd,{children:!r&&w.jsx(ho.div,{className:"absolute inset-0 z-10",initial:{opacity:1},exit:{opacity:0},transition:{duration:.5},children:w.jsx(An,{className:"w-full h-full"})},"skeleton")}),w.jsx(ho.img,{src:t,alt:e,className:rt(CI.image,!r&&"opacity-0"),onLoad:()=>i(!0),loading:"lazy",initial:{opacity:0},animate:{opacity:r?1:0},transition:{duration:.5}}),r&&n!==void 0&&w.jsx("div",{className:CI.seriesCount,children:w.jsx(yd,{mode:"popLayout",initial:!1,children:w.jsx(ho.span,{initial:{y:10,opacity:0},animate:{y:0,opacity:1},exit:{y:-10,opacity:0},transition:{type:"spring",stiffness:300,damping:30},style:{display:"block"},children:n},n)})})]})},mHt=({isOpen:t,onClose:e,data:n})=>{const{t:r}=Hn("worklist"),[i,a]=D.useState(null),[o,s]=D.useState(!1),[c,l]=D.useState([]),[u,f]=D.useState(!1),d=D.useRef(null),[h,m]=D.useState([]),{startCaptureAsync:p,isStarting:y}=xWt(),{cancelCaptureAsync:x,isCancelling:S}=wWt(),{confirmCaptureAsync:C,isConfirming:_}=SWt(),{uploadFileAsync:T}=yWt(),O=D.useCallback(te=>{te.event==="series_preview"&&m(ye=>{const we=ye.findIndex(Oe=>Oe.series_uid===te.data.series_uid);if(we!==-1){const Oe=[...ye];return Oe[we]={...te.data,preview_url:ye[we].preview_url},Oe}return[...ye,te.data]})},[]);if(bWt(i,O),!n)return null;const M=async()=>{if(!n.station_aet){console.error("No AETitle found for this worklist item");return}try{m([]);const te=await p({equipment_aet:n.station_aet});a(te.session_id)}catch(te){console.log(te)}},I=()=>{i?s(!0):(m([]),l([]),e())},V=async()=>{if(i)try{await x({session_id:i}),a(null),m([]),l([]),s(!1),e()}catch(te){console.error("Error cancelling session:",te),s(!1),e()}},k=async()=>{if(!i)return;const te={session_id:i,patient_info:{pat_name:n.pat_name,birth_date:n.pat_birth,sex:n.pat_sex,patient_id:n.pat_id},accession_number:n.acc_num,req_desc:n.req_desc};try{await C(te),a(null),m([]),l([]),e()}catch(ye){console.log(ye)}},L=()=>{d.current?.click()},$=te=>{const ye=te.target.files;if(!ye)return;const we=Array.from(ye).map(Oe=>({file:Oe,id:Math.random().toString(36).substr(2,9)}));l(Oe=>[...Oe,...we]),d.current&&(d.current.value="")},W=te=>{l(ye=>ye.filter(we=>we.id!==te))},G=async()=>{if(!(c.length===0||!n.id)){f(!0);try{for(const te of c)await T({item_id:n.id,file:te.file});Br.success(`Загружено файлов: ${c.length}`),l([]),e()}catch(te){console.error("Upload error:",te)}finally{f(!1)}}},oe=te=>{if(te===0)return"0 Bytes";const ye=1024,we=["Bytes","KB","MB","GB"],Oe=Math.floor(Math.log(te)/Math.log(ye));return Math.round(te/Math.pow(ye,Oe)*100)/100+" "+we[Oe]},U=rt(fn.imageGrid,{[fn.empty]:h.length===0,[fn.few]:h.length>0&&h.length<4}),Y=!!i,J=h.length>0,ne=c.length>0,F=y||S||_||u,ae=F||ne,re=F||!!i;return w.jsxs(w.Fragment,{children:[w.jsx(dp,{open:t,onOpenChange:te=>{if(!te){if(F)return;I()}},children:w.jsxs(hp,{className:fn.dialogContent,onInteractOutside:te=>te.preventDefault(),showCloseButton:!1,children:[w.jsx(gp,{className:fn.header,children:w.jsx(pp,{children:r("launch_study.title")})}),w.jsxs("div",{className:fn.body,children:[w.jsxs("div",{className:fn.patientSection,children:[w.jsx("div",{className:fn.patientName,children:n.pat_name}),w.jsxs("div",{className:fn.metaGrid,children:[w.jsxs("div",{className:fn.metaItem,children:[w.jsx("span",{className:fn.metaLabel,children:r("launch_study.patient_age")}),w.jsx("span",{className:fn.metaValue,children:n.pat_birth?mU(n.pat_birth):"—"})]}),w.jsxs("div",{className:fn.metaItem,children:[w.jsx("span",{className:fn.metaLabel,children:r("launch_study.sex")}),w.jsx("span",{className:fn.metaValue,children:n.pat_sex==="M"?r("launch_study.sex_m"):n.pat_sex==="F"?r("launch_study.sex_f"):"—"})]}),w.jsxs("div",{className:fn.metaItem,children:[w.jsx("span",{className:fn.metaLabel,children:r("launch_study.patient_id")}),w.jsxs("span",{className:fn.metaValue,children:["#",n.pat_id]})]}),w.jsxs("div",{className:rt(fn.metaItem,fn.fullWidth),children:[w.jsx("span",{className:fn.metaLabel,children:r("launch_study.study")}),w.jsx("span",{className:fn.metaValue,children:n.req_desc||"—"})]})]})]}),ne&&w.jsxs("div",{className:fn.uploadedSection,children:[w.jsxs("div",{className:fn.uploadedHeader,children:[w.jsx("h3",{className:fn.uploadedTitle,children:"Загруженные файлы"}),w.jsx("span",{className:fn.uploadedCount,children:c.length})]}),w.jsx("div",{className:fn.filesList,children:w.jsx(yd,{mode:"popLayout",children:c.map(te=>w.jsxs(ho.div,{className:fn.fileItem,initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,x:-20},layout:!0,children:[w.jsx(F$e,{className:fn.fileIcon}),w.jsxs("div",{className:fn.fileInfo,children:[w.jsx("span",{className:fn.fileName,children:te.file.name}),w.jsx("span",{className:fn.fileSize,children:oe(te.file.size)})]}),w.jsx("button",{className:fn.removeFileBtn,onClick:()=>W(te.id),type:"button",disabled:u,children:w.jsx(Sw,{className:"w-4 h-4"})})]},te.id))})}),w.jsx(bt,{onClick:G,disabled:u,className:"w-full mt-3",children:u?w.jsxs(w.Fragment,{children:[w.jsx(Jo,{size:"sm",className:"mr-2"}),"Загрузка..."]}):w.jsxs(w.Fragment,{children:[w.jsx(F6,{className:"w-4 h-4 mr-2"}),"Сохранить (",c.length,")"]})})]}),Y&&w.jsxs("div",{className:fn.previewSection,children:[w.jsxs("div",{className:fn.previewHeader,children:[w.jsx("h3",{className:fn.previewTitle,children:J?`${r("launch_study.received_images")}`:r("launch_study.waiting_images_title")}),J&&w.jsx("span",{className:fn.imageCount,children:h.length})]}),!J&&w.jsxs("div",{className:fn.waitingBlock,children:[w.jsx("div",{className:fn.waitingIcon,children:w.jsx(Oje,{className:"w-6 h-6"})}),w.jsxs("div",{className:fn.waitingContent,children:[w.jsx("p",{className:fn.waitingTitle,children:r("launch_study.study_started")}),w.jsx("p",{className:fn.waitingText,children:r("launch_study.images_auto_appear")})]})]}),w.jsxs(ho.div,{className:U,layout:!0,children:[w.jsx(yd,{mode:"popLayout",children:h.map(te=>w.jsx(pHt,{src:te.preview_url,alt:te.series_description||"Preview",count:te.instance_count},te.series_uid))}),w.jsxs(ho.div,{className:rt(fn.imageWrapper,fn.pending),layout:!0,transition:{duration:.3},children:[w.jsx(An,{className:"absolute inset-0 w-full h-full"}),w.jsxs("div",{className:fn.pendingContent,children:[w.jsx(Jo,{size:"lg",className:"text-primary"}),w.jsx("span",{className:fn.pendingText,children:r("launch_study.waiting")})]})]})]})]})]}),w.jsxs(uL,{className:fn.footer,children:[w.jsxs(bt,{variant:"outline",onClick:I,disabled:F,children:[w.jsx(Kg,{className:"w-4 h-4 mr-2"}),r("launch_study.close")]}),!i&&w.jsx(ab,{delayDuration:300,children:w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx("span",{className:fn.buttonWrapper,children:w.jsxs(bt,{onClick:M,disabled:ae,children:[y?w.jsx(Jo,{size:"sm",className:"mr-2"}):w.jsx(_je,{className:"w-4 h-4 mr-2"}),r("launch_study.start")]})})}),ne&&w.jsx(Ei,{side:"top",className:fn.tooltipContent,children:w.jsx("p",{className:fn.tooltipTitle,children:"Удалите загруженные файлы, чтобы начать захват с оборудования"})})]})}),i&&!J&&w.jsxs(bt,{size:"lg",disabled:!0,variant:"secondary",children:[w.jsx(Jo,{size:"sm",className:"mr-2"}),r("launch_study.waiting_btn")]}),i&&J&&w.jsx(bt,{onClick:k,size:"lg",className:"bg-green-600 hover:bg-green-700 text-white",disabled:F,children:_?w.jsxs(w.Fragment,{children:[w.jsx(Jo,{size:"sm",className:"mr-2 text-white"}),r("launch_study.finishing")]}):w.jsxs(w.Fragment,{children:[w.jsx($6,{className:"mr-1 h-4 w-4"}),r("launch_study.finish")]})}),w.jsx(ab,{delayDuration:300,children:w.jsxs(_i,{children:[w.jsx(Ti,{asChild:!0,children:w.jsx("span",{className:fn.buttonWrapper,children:w.jsx(bt,{variant:"outline",onClick:L,disabled:re,children:w.jsx(vb,{})})})}),w.jsx(Ei,{side:"top",className:fn.tooltipContent,children:w.jsx("p",{className:fn.tooltipTitle,children:i?"Загрузка файлов недоступна во время захвата с оборудования":"Загрузка исследования (DICOM)"})})]})}),w.jsx("input",{ref:d,type:"file",multiple:!0,accept:".dcm,.dicom,*",onChange:$,style:{display:"none"}})]})]})}),w.jsx(fHt,{isOpen:o,onOpenChange:s,onConfirm:V,isCancelling:S})]})},vHt=()=>w.jsxs(PE,{children:[w.jsx(kE,{children:w.jsxs(ip,{children:[w.jsx(Ts,{className:"w-[30%] pl-5",children:w.jsx(An,{className:"h-4 w-20"})}),w.jsx(Ts,{className:"w-[35%]",children:w.jsx(An,{className:"h-4 w-24"})}),w.jsx(Ts,{className:"w-[15%]",children:w.jsx(An,{className:"h-4 w-12"})}),w.jsx(Ts,{className:"w-[20%]",children:w.jsx(An,{className:"h-4 w-28"})})]})}),w.jsx(AE,{children:[...Array(15)].map((t,e)=>w.jsxs(ip,{style:{animationDelay:`${e*.05}s`},children:[w.jsx(Es,{className:"pl-5",children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(An,{className:"h-4 w-[75%]"}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(An,{className:"h-3 w-24"}),w.jsx("span",{className:"text-muted-foreground opacity-30",children:"•"}),w.jsx(An,{className:"h-3 w-4"})]})]})}),w.jsx(Es,{children:w.jsx(An,{className:"h-4 w-[85%]"})}),w.jsx(Es,{children:w.jsx(An,{className:"h-4 w-16"})}),w.jsx(Es,{children:w.jsx(An,{className:"h-3.5 w-24"})})]},e))})]}),ZS={initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.7}},yHt=()=>{const{t}=Hn("worklist"),e=o3(),[n,r]=D.useState(!1),[i,a]=D.useState(""),[o,s]=D.useState(""),[c,l]=D.useState(""),[u,f]=D.useState(""),[d,h]=D.useState(null),[m,p]=D.useState([]),y=m.length>0?m.join(","):void 0,[x,S]=D.useState(()=>{const F=new Date;return{from:F,to:F}}),{regularAetitles:C,regularDevices:_,isDeviceLoading:T}=aU(),{worklist:O,isWorklistLoading:M,isWorklistError:I,worklistRefetch:V}=mWt({from_date:x?.from?Ji(x.from,"yyyy-MM-dd"):void 0,till_date:x?.to?Ji(x.to,"yyyy-MM-dd"):void 0,station_aet:y,pat_name:o,pat_id:u}),k=()=>{i.trim()&&s(i.trim())},L=F=>{const ae=F.target.value;a(ae),ae===""&&s("")},$=()=>{a(""),s("")},W=F=>{F.key==="Enter"&&k()},G=()=>{c.trim()&&f(c.trim())},oe=F=>{const ae=F.target.value;l(ae),ae===""&&f("")},U=()=>{l(""),f("")},Y=F=>{F.key==="Enter"&&G()},J=F=>{p(ae=>ae.includes(F)?ae.filter(re=>re!==F):[...ae,F])},ne=()=>{p([]),$(),U(),S({from:new Date,to:new Date})};return I?w.jsx("div",{className:_n.errorContainer,children:w.jsx(e3,{variant:"card",description:t("errors.description"),onRetry:V})}):w.jsxs("div",{className:_n.container,children:[w.jsxs("div",{className:_n.headerSection,children:[w.jsx("h1",{className:_n.title,children:t("title")}),w.jsx("p",{className:_n.description,children:t("description")})]}),w.jsx("div",{className:_n.filterContent,children:w.jsxs("div",{className:_n.filtersContainer,children:[w.jsxs("div",{className:_n.searchGroup,children:[w.jsxs("div",{className:_n.searchWrapper,children:[w.jsx(d2,{className:_n.searchIcon}),w.jsx(Ar,{placeholder:t("search_placeholder"),value:i,onChange:L,onKeyDown:W,className:_n.searchInput}),w.jsx("div",{className:_n.searchActionWrapper,children:w.jsx(yd,{mode:"wait",initial:!1,children:o?w.jsx(ho.div,{variants:ZS,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15,ease:Rg},children:w.jsx(bt,{type:"button",variant:"ghost",size:"icon",className:_n.searchButton,onClick:$,children:w.jsx(Kg,{})})},"clear"):w.jsx(ho.div,{variants:ZS,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15,ease:Rg},children:w.jsx(bt,{type:"button",variant:"ghost",size:"icon",className:_n.searchButton,onClick:k,disabled:!i.trim(),children:w.jsx(qg,{})})},"search")})})]}),w.jsx("div",{className:_n.searchDivider,children:w.jsx("span",{children:t("or")})}),w.jsxs("div",{className:_n.searchWrapper,children:[w.jsx(Y$e,{className:_n.searchIcon}),w.jsx(Ar,{placeholder:t("search_placeholder_id"),value:c,onChange:oe,onKeyDown:Y,className:_n.searchInput}),w.jsx("div",{className:_n.searchActionWrapper,children:w.jsx(yd,{mode:"wait",initial:!1,children:u?w.jsx(ho.div,{variants:ZS,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15,ease:Rg},children:w.jsx(bt,{type:"button",variant:"ghost",size:"icon",className:_n.searchButton,onClick:U,children:w.jsx(Kg,{})})},"clear-id"):w.jsx(ho.div,{variants:ZS,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15,ease:Rg},children:w.jsx(bt,{type:"button",variant:"ghost",size:"icon",className:_n.searchButton,onClick:G,disabled:!c.trim(),children:w.jsx(qg,{})})},"search-id")})})]})]}),w.jsxs(bl,{children:[w.jsx(Sl,{asChild:!0,children:w.jsxs(bt,{variant:"outline",className:_n.dateButton,children:[w.jsx(K0,{className:_n.dateIcon}),w.jsx("span",{children:tU(x?.from,x?.to)})]})}),w.jsx(Cl,{className:_n.datePopover,align:"start",children:w.jsx($g,{mode:"range",selected:x,onSelect:S,locale:e})})]}),w.jsxs(bl,{children:[w.jsx(Sl,{asChild:!0,children:w.jsxs(bt,{variant:"outline",className:`${_n.filterButton} ${_n.outline}`,children:[w.jsx(j6,{className:_n.filterIcon}),t("equipment")]})}),w.jsx(Cl,{className:`${_n.popoverContent} ${_n.wide}`,align:"start",children:w.jsxs("div",{className:_n.popoverSpace,children:[w.jsx("h4",{className:_n.popoverTitle,children:t("select_equipment")}),T?w.jsx("div",{className:_n.loading,children:w.jsx(Jo,{size:"md"})}):C.map(F=>w.jsxs("div",{className:_n.checkboxWrapper,children:[w.jsx(Am,{id:`aetitle-${F}`,checked:m.includes(F),onCheckedChange:()=>J(F)}),w.jsx("label",{htmlFor:`aetitle-${F}`,className:_n.checkboxLabel,children:F})]},F))]})})]}),w.jsx("div",{className:_n.exportWrapper,children:w.jsxs(bt,{variant:"outline",className:_n.exportButton,children:[w.jsx(vb,{className:_n.filterIcon}),t("export_excel")]})}),w.jsxs(bt,{onClick:()=>r(!0),children:[w.jsx(bw,{className:"h-4 w-4"}),t("create_btn")]})]})}),w.jsx(Oc,{children:M?w.jsx(vHt,{}):O.length===0?w.jsx(Qye,{onReset:ne,title:t("empty_state.title"),description:t("empty_state.description")}):w.jsxs(PE,{children:[w.jsx(kE,{children:w.jsxs(ip,{children:[w.jsx(Ts,{className:"w-[30%] pl-5",children:t("table.patient")}),w.jsx(Ts,{className:"w-[35%]",children:t("table.study")}),w.jsx(Ts,{className:"w-[15%]",children:"Accession number"}),w.jsx(Ts,{className:"w-[20%]",children:t("table.ticket_date")})]})}),w.jsx(AE,{children:O.map(F=>w.jsxs(ip,{onClick:()=>h(F),className:_n.tableRow,children:[w.jsx(Es,{className:"pl-5",children:w.jsxs("div",{className:_n.patientInfo,children:[w.jsx("span",{className:_n.patientName,children:F.pat_name}),w.jsxs("div",{className:_n.patientMeta,children:[w.jsx("span",{className:_n.birthDate,children:F.pat_birth?mU(F.pat_birth):t("table.no_data")}),w.jsx("span",{className:_n.metaDivider,children:"•"}),w.jsxs("span",{className:_n.clientIdValue,children:["ID: ",F.pat_id]}),F.pat_sex&&w.jsxs(w.Fragment,{children:[w.jsx("span",{className:_n.metaDivider,children:"•"}),w.jsx("span",{className:`${_n.sexBadge} ${_n[`sex${F.pat_sex}`]}`,children:F.pat_sex==="M"?t("table.male"):F.pat_sex==="F"?t("table.female"):"—"})]})]})]})}),w.jsx(Es,{children:w.jsx("div",{className:"font-medium truncate max-w-[650px]",children:F.req_desc||t("table.no_data")})}),w.jsx(Es,{children:w.jsx("span",{className:_n.actionId,children:F.acc_num?`#${F.acc_num}`:"—"})}),w.jsx(Es,{children:w.jsxs("span",{className:"text-muted-foreground text-sm",children:[F.sched_date," "," ",F.sched_time&&F.sched_time.slice(0,5)]})})]},F.id))})]})}),w.jsx(mHt,{isOpen:!!d,onClose:()=>h(null),data:d}),w.jsx(CWt,{isOpen:n,onOpenChange:r,devices:_}),w.jsx(lU,{})]})},xHt="_container_13rjk_1",wHt="_headerSection_13rjk_7",bHt="_left_13rjk_15",SHt="_title_13rjk_21",CHt="_description_13rjk_27",_Ht="_right_13rjk_32",THt="_searchWrapper_13rjk_38",EHt="_searchIcon_13rjk_48",OHt="_searchInput_13rjk_59",DHt="_searchActionWrapper_13rjk_74",MHt="_searchButton_13rjk_84",RHt="_filters_13rjk_103",IHt="_filterItem_13rjk_112",NHt="_filterLabel_13rjk_117",PHt="_divider_13rjk_131",kHt="_dateButton_13rjk_142",AHt="_clearButton_13rjk_149",LHt="_clearIcon_13rjk_152",Wi={container:xHt,headerSection:wHt,left:bHt,title:SHt,description:CHt,right:_Ht,searchWrapper:THt,searchIcon:EHt,searchInput:OHt,searchActionWrapper:DHt,searchButton:MHt,filters:RHt,filterItem:IHt,filterLabel:NHt,divider:PHt,dateButton:kHt,clearButton:AHt,clearIcon:LHt};class ECe{static async getLogsHistory(e){return(await ni.get("/logs/history",{params:e})).data}static connectToLogsStream(e,n){const r=ni.defaults.baseURL||"",i=new URLSearchParams;e.serverDebug&&i.append("serverDebug","true"),e.sqlDebug&&i.append("sqlDebug","true");const a=`${r}/logs/stream?${i.toString()}`,o=new EventSource(a,{withCredentials:!0});return o.onmessage=s=>{try{const c=JSON.parse(s.data);n(c)}catch(c){console.error("Ошибка при получении логов:",c)}},o}}const VHt=100,$Ht=({params:t,onLogReceived:e,onReconnect:n,enabled:r})=>{const i=D.useRef(e),a=D.useRef(n);D.useEffect(()=>{i.current=e,a.current=n},[e,n]),D.useEffect(()=>{if(!r)return;a.current?.();const o=ECe.connectToLogsStream(t,s=>{i.current?.(s)});return()=>{o.close()}},[t.serverDebug,t.sqlDebug,r])},jHt=t=>{const e=nDe({queryKey:["logs-history",t],queryFn:async({pageParam:r=0})=>{if(!t)throw new Error("Params required");return ECe.getLogsHistory({...t,offset:r,limit:VHt})},getNextPageParam:r=>{if(r.pagination.has_more)return r.pagination.offset+r.pagination.limit},initialPageParam:0,enabled:!!t});return{logs:e.data?.pages.flatMap(r=>r.logs)||[],isLoading:e.isLoading,isError:e.isError,error:e.error,fetchNextPage:e.fetchNextPage,hasNextPage:e.hasNextPage,isFetchingNextPage:e.isFetchingNextPage}},UHt="_wrapper_14dsm_2",FHt="_header_14dsm_16",BHt="_headerLeft_14dsm_27",zHt="_controls_14dsm_33",GHt="_dot_14dsm_37",WHt="_title_14dsm_54",HHt="_headerRight_14dsm_61",qHt="_countBadge_14dsm_67",KHt="_statusIndicator_14dsm_76",YHt="_active_14dsm_90",XHt="_pulse_14dsm_1",ZHt="_paused_14dsm_103",QHt="_console_14dsm_115",JHt="_logList_14dsm_142",eqt="_logEntry_14dsm_147",tqt="_info_14dsm_161",nqt="_sourceTag_14dsm_164",rqt="_success_14dsm_169",iqt="_warning_14dsm_177",aqt="_error_14dsm_185",oqt="_timestamp_14dsm_194",sqt="_message_14dsm_220",cqt="_emptyState_14dsm_226",lqt="_inputLine_14dsm_226",uqt="_prompt_14dsm_234",fqt="_cursor_14dsm_239",dqt="_blink_14dsm_1",hqt="_historyBadge_14dsm_247",Fr={wrapper:UHt,header:FHt,headerLeft:BHt,controls:zHt,dot:GHt,title:WHt,headerRight:HHt,countBadge:qHt,statusIndicator:KHt,active:YHt,pulse:XHt,paused:ZHt,console:QHt,logList:JHt,logEntry:eqt,info:tqt,sourceTag:nqt,success:rqt,warning:iqt,error:aqt,timestamp:oqt,message:sqt,emptyState:cqt,inputLine:lqt,prompt:uqt,cursor:fqt,blink:dqt,historyBadge:hqt};var Fk=new Map,QS=new WeakMap,Ere=0,gqt;function pqt(t){return t?(QS.has(t)||(Ere+=1,QS.set(t,Ere.toString())),QS.get(t)):"0"}function mqt(t){return Object.keys(t).sort().filter(e=>t[e]!==void 0).map(e=>`${e}_${e==="root"?pqt(t.root):t[e]}`).toString()}function vqt(t){const e=mqt(t);let n=Fk.get(e);if(!n){const r=new Map;let i;const a=new IntersectionObserver(o=>{o.forEach(s=>{var c;const l=s.isIntersecting&&i.some(u=>s.intersectionRatio>=u);t.trackVisibility&&typeof s.isVisible>"u"&&(s.isVisible=l),(c=r.get(s.target))==null||c.forEach(u=>{u(l,s)})})},t);i=a.thresholds||(Array.isArray(t.threshold)?t.threshold:[t.threshold||0]),n={id:e,observer:a,elements:r},Fk.set(e,n)}return n}function yqt(t,e,n={},r=gqt){if(typeof window.IntersectionObserver>"u"&&r!==void 0){const c=t.getBoundingClientRect();return e(r,{isIntersecting:r,target:t,intersectionRatio:typeof n.threshold=="number"?n.threshold:0,time:0,boundingClientRect:c,intersectionRect:c,rootBounds:c}),()=>{}}const{id:i,observer:a,elements:o}=vqt(n),s=o.get(t)||[];return o.has(t)||o.set(t,s),s.push(e),a.observe(t),function(){s.splice(s.indexOf(e),1),s.length===0&&(o.delete(t),a.unobserve(t)),o.size===0&&(a.disconnect(),Fk.delete(i))}}function xqt({threshold:t,delay:e,trackVisibility:n,rootMargin:r,root:i,triggerOnce:a,skip:o,initialInView:s,fallbackInView:c,onChange:l}={}){var u;const[f,d]=D.useState(null),h=D.useRef(l),m=D.useRef(s),[p,y]=D.useState({inView:!!s,entry:void 0});h.current=l,D.useEffect(()=>{if(m.current===void 0&&(m.current=s),o||!f)return;let _;return _=yqt(f,(T,O)=>{const M=m.current;m.current=T,!(M===void 0&&!T)&&(y({inView:T,entry:O}),h.current&&h.current(T,O),O.isIntersecting&&a&&_&&(_(),_=void 0))},{root:i,rootMargin:r,threshold:t,trackVisibility:n,delay:e},c),()=>{_&&_()}},[Array.isArray(t)?t.toString():t,f,i,r,a,o,n,c,e]);const x=(u=p.entry)==null?void 0:u.target,S=D.useRef(void 0);!f&&x&&!a&&!o&&S.current!==x&&(S.current=x,y({inView:!!s,entry:void 0}),m.current=s);const C=[d,p.inView,p.entry];return C.ref=C[0],C.inView=C[1],C.entry=C[2],C}function wqt({logs:t,isHistoryMode:e,isLoading:n,hasMore:r,isLoadingMore:i,onLoadMore:a}){const o=D.useRef(null),[s,c]=D.useState(!0),l=D.useRef(0),{ref:u,inView:f}=xqt({threshold:.1,root:o.current});D.useEffect(()=>{f&&r&&!i&&e&&a?.()},[f,r,i,e,a]),D.useEffect(()=>{o.current&&t.length>0&&!e&&s&&(o.current.scrollTop=o.current.scrollHeight)},[t,s,e]);const d=h=>{const m=h.currentTarget,p=Math.abs(m.scrollHeight-m.scrollTop-m.clientHeight)<20,y=m.scrollTop<l.current;p?c(!0):y&&c(!1),l.current=m.scrollTop};return w.jsxs("div",{className:Fr.wrapper,children:[w.jsxs("div",{className:Fr.header,children:[w.jsxs("div",{className:Fr.headerLeft,children:[w.jsxs("div",{className:Fr.controls,children:[w.jsx("span",{className:Fr.dot}),w.jsx("span",{className:Fr.dot}),w.jsx("span",{className:Fr.dot})]}),w.jsx("span",{className:Fr.title,children:e?"Log History":"System Logs"})]}),w.jsxs("div",{className:Fr.headerRight,children:[w.jsx("span",{className:Fr.countBadge,children:t.length}),!e&&w.jsx("button",{onClick:()=>c(!s),className:rt(Fr.statusIndicator,s?Fr.active:Fr.paused),children:s?"LIVE":"PAUSED"}),e&&w.jsx("span",{className:Fr.historyBadge,children:"HISTORY"})]})]}),w.jsx("div",{ref:o,onScroll:d,className:Fr.console,children:n?w.jsxs("div",{className:Fr.emptyState,children:[w.jsx("span",{className:Fr.prompt,children:"➜"})," Loading history...",w.jsx("span",{className:Fr.cursor})]}):t.length===0?w.jsxs("div",{className:Fr.emptyState,children:[w.jsx("span",{className:Fr.prompt,children:"➜"})," Waiting for logs...",w.jsx("span",{className:Fr.cursor})]}):w.jsxs("div",{className:Fr.logList,children:[t.map(h=>w.jsxs("div",{onClick:()=>console.log(h),className:rt(Fr.logEntry,Fr[h.level.toLowerCase()]),children:[w.jsx("span",{className:Fr.timestamp,children:n3(new Date(h.timestamp))}),w.jsx("div",{className:Fr.sourceTag,children:h.module}),w.jsx("span",{className:Fr.message,children:h.message})]},`${h.id}:${h.process}`)),e&&w.jsx("div",{ref:u,className:"w-full flex justify-center py-2 min-h-[20px]",children:i?w.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[w.jsx(U6,{className:"h-3 w-3 animate-spin"}),w.jsx("span",{children:"Loading more logs..."})]}):r?w.jsx("div",{style:{height:"1px"}}):w.jsx("div",{className:"text-xs text-muted-foreground opacity-50 pb-2",children:"-- End of history --"})}),!e&&w.jsxs("div",{className:Fr.inputLine,children:[w.jsx("span",{className:Fr.prompt,children:"➜"})," ",w.jsx("span",{className:Fr.cursor})]})]})})]})}function Ore({value:t,onChange:e,placeholder:n="Выберите время",disabled:r=!1,className:i}){const[a,o]=D.useState(!1),s=D.useRef(null),c=D.useMemo(()=>Array.from({length:24},(f,d)=>d),[]),l=f=>{e?.(f),o(!1)},u=f=>`${f.toString().padStart(2,"0")}:00`;return D.useEffect(()=>{a&&t!==void 0&&s.current&&setTimeout(()=>{s.current?.querySelector(`[data-hour="${t}"]`)?.scrollIntoView({block:"center"})},0)},[a,t]),w.jsxs(bl,{open:a,onOpenChange:o,children:[w.jsx(Sl,{asChild:!0,children:w.jsxs(bt,{variant:"outline",disabled:r,className:rt("justify-start text-left font-normal",t===void 0&&"text-muted-foreground",i),children:[w.jsx(Ose,{className:"mr-2 h-4 w-4 text-foreground"}),w.jsx("span",{children:t!==void 0?u(t):n})]})}),w.jsx(Cl,{className:"w-auto p-0",align:"start",children:w.jsx(Aye,{className:"h-64",ref:s,children:w.jsx("div",{className:"flex flex-col p-2",children:c.map(f=>w.jsx("button",{"data-hour":f,onClick:()=>l(f),className:rt("flex h-9 w-full items-center justify-center rounded-md px-8 text-sm font-medium transition-colors","hover:bg-accent hover:text-accent-foreground","focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",t===f&&"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground"),children:u(f)},f))})})})]})}const Dre={initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8}},bqt=()=>{const{t}=Hn("logs"),e=o3(),[n,r]=D.useState(),[i,a]=D.useState(),[o,s]=D.useState(),[c,l]=D.useState(""),[u,f]=D.useState(""),[d,h]=D.useState(!1),[m,p]=D.useState(!1),y=500,[x,S]=D.useState([]),C=D.useRef(new Set),_=D.useCallback(ae=>`${ae.id}:${ae.process}`,[]),T=!!(n?.from&&n?.to)||!!u,O=D.useMemo(()=>{if(!T)return null;const ae={};if(n?.from&&n?.to){let re=Ji(n.from,"yyyy-MM-dd"),te=Ji(n.to,"yyyy-MM-dd");i!==void 0&&(re=`${re}T${i.toString().padStart(2,"0")}:00`),o!==void 0&&(te=`${te}T${o.toString().padStart(2,"0")}:00`),ae.date_from=re,ae.date_to=te}return u&&(ae.search=u),ae},[n,i,o,u,T]),{logs:M,isLoading:I,fetchNextPage:V,hasNextPage:k,isFetchingNextPage:L}=jHt(O),$=D.useCallback(ae=>{const re=_(ae);C.current.has(re)||(C.current.add(re),S(te=>{const ye=[...te,ae];return ye.length>y?(ye.slice(0,ye.length-y).forEach(Oe=>C.current.delete(_(Oe))),ye.slice(-y)):ye}))},[_]),W=D.useCallback(()=>{S([]),C.current.clear()},[]);$Ht({params:{serverDebug:d,sqlDebug:m},onLogReceived:$,onReconnect:W,enabled:!T});const G=T?M:x,oe=()=>{r(void 0),a(void 0),s(void 0),l(""),f("")},U=ae=>{l(ae.target.value)},Y=()=>{l(""),f("")},J=()=>{c.trim()&&f(c)},ne=ae=>{ae.key==="Enter"&&J()},F=!!u&&c===u;return w.jsxs("div",{className:Wi.container,children:[w.jsxs("div",{className:Wi.headerSection,children:[w.jsxs("div",{className:Wi.left,children:[w.jsx("h1",{className:Wi.title,children:t("title")}),w.jsx("p",{className:Wi.description,children:t("description")})]}),w.jsxs("div",{className:Wi.right,children:[w.jsxs("div",{className:Wi.searchWrapper,children:[w.jsx(d2,{className:Wi.searchIcon}),w.jsx(Ar,{placeholder:t("search_placeholder"),value:c,onChange:U,onKeyDown:ne,className:Wi.searchInput}),w.jsx("div",{className:Wi.searchActionWrapper,children:w.jsx(yd,{mode:"wait",initial:!1,children:F?w.jsx(ho.div,{variants:Dre,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15},children:w.jsx(bt,{type:"button",variant:"ghost",size:"icon",className:Wi.searchButton,onClick:Y,children:w.jsx(Kg,{})})},"clear"):w.jsx(ho.div,{variants:Dre,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15},children:w.jsx(bt,{type:"button",variant:"ghost",size:"icon",className:Wi.searchButton,onClick:J,disabled:!c.trim(),children:w.jsx(qg,{})})},"search")})})]}),w.jsxs("div",{className:Wi.filters,children:[w.jsxs("div",{className:Wi.filterItem,children:[w.jsx(Am,{id:"server-debug",checked:d,onCheckedChange:ae=>h(ae),disabled:T}),w.jsx(hN,{htmlFor:"server-debug",className:Wi.filterLabel,children:"Server Debug"})]}),w.jsxs("div",{className:Wi.filterItem,children:[w.jsx(Am,{id:"sql-debug",checked:m,onCheckedChange:ae=>p(ae),disabled:T}),w.jsx(hN,{htmlFor:"sql-debug",className:Wi.filterLabel,children:"SQL Debug"})]})]}),w.jsx("div",{className:Wi.divider}),w.jsxs(bl,{children:[w.jsx(Sl,{asChild:!0,children:w.jsxs(bt,{variant:"outline",className:Wi.dateButton,children:[w.jsx(K0,{className:Wi.dateIcon}),w.jsx("span",{children:n?.from?tU(n.from,n.to):t("select_period")})]})}),w.jsx(Cl,{className:Wi.datePopover,align:"start",children:w.jsx($g,{mode:"range",selected:n,onSelect:r,locale:e,disabled:[{after:new Date},{before:x5(new Date,7)}]})})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Ore,{value:i,onChange:a,placeholder:t("from"),className:"w-28",disabled:!T}),w.jsx("span",{className:"text-muted-foreground",children:"—"}),w.jsx(Ore,{value:o,onChange:s,placeholder:t("to"),className:"w-28",disabled:!T})]}),T&&w.jsxs(bt,{variant:"default",className:Wi.clearButton,onClick:oe,children:[t("reset"),w.jsx(Kg,{className:Wi.clearIcon})]})]})]}),w.jsx(wqt,{logs:G,isLoading:I,isHistoryMode:T,onLoadMore:V,hasMore:k,isLoadingMore:L})]})},Sqt="_wrapper_tx9jm_1",Cqt="_errorContainer_tx9jm_8",_qt="_header_tx9jm_15",Tqt="_headerInfo_tx9jm_28",Eqt="_title_tx9jm_34",Oqt="_description_tx9jm_41",Dqt="_headerActions_tx9jm_47",Mqt="_badgeContainer_tx9jm_59",Rqt="_toolbar_tx9jm_73",Iqt="_searchWrapper_tx9jm_79",Nqt="_searchIcon_tx9jm_90",Pqt="_searchInput_tx9jm_101",kqt="_list_tx9jm_105",Aqt="_emptyState_tx9jm_121",Lqt="_emptyIcon_tx9jm_133",Vqt="_emptyTitle_tx9jm_149",$qt="_emptyDescription_tx9jm_156",jqt="_emptyButton_tx9jm_163",Uqt="_skeletonCard_tx9jm_167",Fqt="_skeletonContent_tx9jm_173",Bqt="_skeletonInfo_tx9jm_181",zqt="_skeletonName_tx9jm_188",Gqt="_skeletonLogin_tx9jm_202",Wqt="_skeletonBadge_tx9jm_216",Hqt="_skeletonButton_tx9jm_225",di={wrapper:Sqt,errorContainer:Cqt,header:_qt,headerInfo:Tqt,title:Eqt,description:Oqt,headerActions:Dqt,badgeContainer:Mqt,toolbar:Rqt,searchWrapper:Iqt,searchIcon:Nqt,searchInput:Pqt,list:kqt,emptyState:Aqt,emptyIcon:Lqt,emptyTitle:Vqt,emptyDescription:$qt,emptyButton:jqt,skeletonCard:Uqt,skeletonContent:Fqt,skeletonInfo:Bqt,skeletonName:zqt,skeletonLogin:Gqt,skeletonBadge:Wqt,skeletonButton:Hqt},qqt="_card_11t5s_1",Kqt="_adminCard_11t5s_18",Yqt="_mainInfo_11t5s_26",Xqt="_name_11t5s_34",Zqt="_login_11t5s_43",Qqt="_rightSection_11t5s_52",Jqt="_adminBadge_11t5s_59",eKt="_youBadge_11t5s_67",tKt="_menuButton_11t5s_73",nKt="_menuIcon_11t5s_81",Kf={card:qqt,adminCard:Kqt,mainInfo:Yqt,name:Xqt,login:Zqt,rightSection:Qqt,adminBadge:Jqt,youBadge:eKt,menuButton:tKt,menuIcon:nKt},rKt=Roe("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>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-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Mre({className:t,variant:e,asChild:n=!1,...r}){const i=n?BA:"span";return w.jsx(i,{"data-slot":"badge",className:rt(rKt({variant:e}),t),...r})}class L9{static async getUsers(){return(await ni.get("/users")).data}static async createUser(e){return(await ni.post("/users",e)).data}static async updateUser(e){const{id:n}=e;return(await ni.put(`/users/${n}`,e)).data}static async deleteUser(e){return(await ni.delete(`/users/${e}`)).data}}const iKt=()=>{const t=Sh({queryKey:["users"],queryFn:()=>L9.getUsers()});return{users:t.data??[],isUsersLoading:t.isLoading,isUsersError:t.isError,error:t.error,refetchUsers:t.refetch}},aKt=()=>{const t=$c(),e=jc({mutationFn:n=>L9.createUser(n),onSuccess:()=>{t.invalidateQueries({queryKey:["users"]})}});return{createUserAsync:e.mutateAsync,isCreating:e.isPending}},oKt=()=>{const t=$c(),e=jc({mutationFn:n=>L9.updateUser(n),onSuccess:()=>{t.invalidateQueries({queryKey:["users"]})}});return{updateUserAsync:e.mutateAsync,isUpdating:e.isPending}},sKt=()=>{const t=$c(),e=jc({mutationFn:n=>L9.deleteUser(n),onSuccess:()=>{t.invalidateQueries({queryKey:["users"]})}});return{deleteUserAsync:e.mutateAsync,isDeleting:e.isPending}},cKt=({user:t,onEdit:e,currentUserId:n})=>{const r=n===t.id,[i,a]=D.useState(!1),{deleteUserAsync:o,isDeleting:s}=sKt(),c=async()=>{try{await o(t.id),Br.success(`Пользователь @${t.login} успешно удалён`),a(!1)}catch(l){console.error(l),Br.error("Ошибка при удалении пользователя")}};return w.jsxs("div",{className:`${Kf.card} ${t.is_admin?Kf.adminCard:""}`,children:[w.jsxs("div",{className:Kf.mainInfo,children:[w.jsxs("span",{className:Kf.name,children:[t.last_name," ",t.first_name," ",t?.patr_name]}),w.jsxs("span",{className:Kf.login,children:["@",t.login]})]}),w.jsxs("div",{className:Kf.rightSection,children:[t.is_admin&&w.jsx(Mre,{variant:"default",className:Kf.adminBadge,children:"Админ"}),r&&w.jsx(Mre,{variant:"secondary",className:Kf.youBadge,children:"Вы"}),w.jsxs(_8,{children:[w.jsx(T8,{asChild:!0,children:w.jsx(bt,{variant:"ghost",size:"icon",className:Kf.menuButton,children:w.jsx(Dse,{className:Kf.menuIcon})})}),w.jsxs(E8,{align:"end",children:[w.jsxs(Qu,{className:"cursor-pointer",onClick:()=>e(t),children:[w.jsx(sL,{className:"mr-2 h-4 w-4 text-muted-foreground"}),"Редактировать"]}),!r&&w.jsxs(w.Fragment,{children:[w.jsx(PN,{}),w.jsxs(yE,{open:i,onOpenChange:a,children:[w.jsx(rU,{asChild:!0,children:w.jsxs(Qu,{onSelect:l=>l.preventDefault(),className:"cursor-pointer text-destructive focus:text-destructive focus:bg-destructive/10",children:[w.jsx(Sw,{className:"mr-2 h-4 w-4"}),"Удалить"]})}),w.jsxs(xE,{children:[w.jsxs(wE,{children:[w.jsx(SE,{children:"Удаление пользователя"}),w.jsxs(CE,{children:["Вы уверены, что хотите удалить пользователя"," ",w.jsxs("strong",{children:[t.last_name," ",t.first_name," ",t?.patr_name," (",t.login,")"]}),"? Это действие нельзя отменить."]})]}),w.jsxs(bE,{children:[w.jsx(_E,{disabled:s,children:"Отмена"}),w.jsx(bt,{variant:"destructive",onClick:c,loading:s,disabled:s,children:"Удалить"})]})]})]})]})]})]})]})]})},lKt=()=>w.jsx("div",{className:di.list,children:Array.from({length:8}).map((t,e)=>w.jsx("div",{className:di.skeletonCard,children:w.jsxs("div",{className:di.skeletonContent,children:[w.jsxs("div",{className:di.skeletonInfo,children:[w.jsx("div",{className:di.skeletonName}),w.jsx("div",{className:di.skeletonLogin})]}),w.jsx("div",{className:di.skeletonBadge}),w.jsx("div",{className:di.skeletonButton})]})},e))}),uKt="_dialog_ojzx3_1",fKt="_header_ojzx3_8",dKt="_iconWrapper_ojzx3_16",hKt="_headerIcon_ojzx3_27",gKt="_headerText_ojzx3_33",pKt="_title_ojzx3_39",mKt="_description_ojzx3_46",vKt="_form_ojzx3_53",yKt="_section_ojzx3_60",xKt="_sectionHeader_ojzx3_66",wKt="_sectionIcon_ojzx3_72",bKt="_sectionTitle_ojzx3_78",SKt="_separator_ojzx3_86",CKt="_fieldsRow_ojzx3_90",_Kt="_fieldsGrid_ojzx3_101",TKt="_field_ojzx3_90",EKt="_optional_ojzx3_121",OKt="_switchField_ojzx3_127",DKt="_switchContent_ojzx3_134",MKt="_switchInfo_ojzx3_141",RKt="_switchLabel_ojzx3_147",IKt="_switchDescription_ojzx3_154",NKt="_footer_ojzx3_160",rr={dialog:uKt,header:fKt,iconWrapper:dKt,headerIcon:hKt,headerText:gKt,title:pKt,description:mKt,form:vKt,section:yKt,sectionHeader:xKt,sectionIcon:wKt,sectionTitle:bKt,separator:SKt,fieldsRow:CKt,fieldsGrid:_Kt,field:TKt,optional:EKt,switchField:OKt,switchContent:DKt,switchInfo:MKt,switchLabel:RKt,switchDescription:IKt,footer:NKt},OCe=m2({login:Ra().min(3,"Логин должен содержать минимум 3 символа").max(50,"Логин не должен превышать 50 символов").regex(/^[a-zA-Z0-9_]+$/,"Логин может содержать только латинские буквы, цифры и _"),password:Ra().max(100,"Пароль не должен превышать 100 символов"),first_name:Ra().min(1,"Имя обязательно для заполнения").max(50,"Имя не должно превышать 50 символов"),last_name:Ra().min(1,"Фамилия обязательна для заполнения").max(50,"Фамилия не должна превышать 50 символов"),patr_name:Ra().max(50,"Отчество не должно превышать 50 символов").optional().or(wde("")),is_admin:jV()}),PKt=OCe.refine(t=>t.password.length>=6,{message:"Пароль должен содержать минимум 6 символов",path:["password"]}),kKt=OCe.refine(t=>t.password.length===0||t.password.length>=6,{message:"Пароль должен содержать минимум 6 символов",path:["password"]}),AKt=({isOpen:t,onClose:e,initialData:n})=>{const r=!!n,[i,a]=D.useState(!1),{createUserAsync:o,isCreating:s}=aKt(),{updateUserAsync:c,isUpdating:l}=oKt(),u=s||l,f=c2({resolver:v2(r?kKt:PKt),defaultValues:{login:"",password:"",first_name:"",last_name:"",patr_name:"",is_admin:!1},mode:"onChange"});gU(i,f.formState.errors,a),D.useEffect(()=>{t&&(n?f.reset({login:n.login,password:"",first_name:n.first_name,last_name:n.last_name,patr_name:n.patr_name||"",is_admin:n.is_admin}):f.reset({login:"",password:"",first_name:"",last_name:"",patr_name:"",is_admin:!1}))},[t,n,f]);const d=async p=>{try{r&&n?(await c({id:n.id,password:p.password?p.password:null,first_name:p.first_name,last_name:p.last_name,patr_name:p.patr_name??"",is_admin:p.is_admin}),Br.success(`Данные пользователя ${n.login} обновлены`)):(await o({login:p.login,password:p.password,first_name:p.first_name,last_name:p.last_name,patr_name:p.patr_name||"",is_admin:p.is_admin}),Br.success(`Пользователь ${p.login} успешно создан`)),e()}catch(y){console.error(y),Br.error(r?"Ошибка при обновлении пользователя":"Ошибка при создании пользователя")}},h=()=>{a(!0)},m=()=>{f.reset(),e()};return w.jsx(dp,{open:t,onOpenChange:p=>!p&&m(),children:w.jsxs(hp,{className:rr.dialog,children:[w.jsxs(gp,{className:rr.header,children:[w.jsx("div",{className:rr.iconWrapper,children:r?w.jsx(hK,{className:rr.headerIcon}):w.jsx(Pse,{className:rr.headerIcon})}),w.jsxs("div",{className:rr.headerText,children:[w.jsx(pp,{className:rr.title,children:r?"Редактирование пользователя":"Новый пользователь"}),w.jsx(z6,{className:rr.description,children:r?"Измените данные пользователя. Оставьте поле пароля пустым, чтобы сохранить текущий.":"Заполните форму для создания нового пользователя в системе."})]})]}),w.jsx(l2,{...f,children:w.jsxs("form",{onSubmit:f.handleSubmit(d,h),className:rr.form,children:[w.jsxs("div",{className:rr.section,children:[w.jsxs("div",{className:rr.sectionHeader,children:[w.jsx(cje,{className:rr.sectionIcon}),w.jsx("span",{className:rr.sectionTitle,children:"Данные для входа"})]}),w.jsxs("div",{className:rr.fieldsRow,children:[w.jsx(xn,{control:f.control,name:"login",render:({field:p})=>w.jsxs(wn,{className:rr.field,children:[w.jsx(ir,{children:"Логин"}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:"Введите логин",onKeyDown:y_,disabled:r,...p})})]})}),w.jsx(xn,{control:f.control,name:"password",render:({field:p})=>w.jsxs(wn,{className:rr.field,children:[w.jsxs(ir,{children:["Пароль ",r&&w.jsx("span",{className:rr.optional,children:"(необязательно)"})]}),w.jsx(bn,{children:w.jsx(Ar,{type:"password",placeholder:r?"Оставьте пустым для сохранения":"Введите пароль",onKeyDown:y_,...p})})]})})]})]}),w.jsx(kP,{className:rr.separator}),w.jsxs("div",{className:rr.section,children:[w.jsxs("div",{className:rr.sectionHeader,children:[w.jsx(hK,{className:rr.sectionIcon}),w.jsx("span",{className:rr.sectionTitle,children:"Личные данные"})]}),w.jsxs("div",{className:rr.fieldsGrid,children:[w.jsx(xn,{control:f.control,name:"last_name",render:({field:p})=>w.jsxs(wn,{className:rr.field,children:[w.jsx(ir,{children:"Фамилия"}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:"Введите фамилию",...p})})]})}),w.jsx(xn,{control:f.control,name:"first_name",render:({field:p})=>w.jsxs(wn,{className:rr.field,children:[w.jsx(ir,{children:"Имя"}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:"Введите имя",...p})})]})}),w.jsx(xn,{control:f.control,name:"patr_name",render:({field:p})=>w.jsxs(wn,{className:rr.field,children:[w.jsxs(ir,{children:["Отчество ",w.jsx("span",{className:rr.optional,children:"(необязательно)"})]}),w.jsx(bn,{children:w.jsx(Ar,{placeholder:"Введите отчество",...p})})]})})]})]}),w.jsx(kP,{className:rr.separator}),w.jsxs("div",{className:rr.section,children:[w.jsxs("div",{className:rr.sectionHeader,children:[w.jsx(Hje,{className:rr.sectionIcon}),w.jsx("span",{className:rr.sectionTitle,children:"Права доступа"})]}),w.jsx(xn,{control:f.control,name:"is_admin",render:({field:p})=>w.jsx(wn,{className:rr.switchField,children:w.jsxs("div",{className:rr.switchContent,children:[w.jsxs("div",{className:rr.switchInfo,children:[w.jsx(ir,{className:rr.switchLabel,children:"Права администратора"}),w.jsx(x0,{className:rr.switchDescription,children:"Администратор имеет полный доступ к управлению системой"})]}),w.jsx(bn,{children:w.jsx(au,{checked:p.value,onCheckedChange:p.onChange})})]})})})]}),w.jsxs(uL,{className:rr.footer,children:[w.jsx(bt,{type:"button",variant:"outline",onClick:m,disabled:u,children:"Отмена"}),w.jsx(bt,{type:"submit",loading:u,disabled:u,children:r?"Сохранить":"Создать"})]})]})})]})})},LKt=()=>{const{users:t,isUsersLoading:e,isUsersError:n,refetchUsers:r}=iKt(),{user:i}=Lse(),[a,o]=D.useState(!1),[s,c]=D.useState(null),[l,u]=D.useState(""),f=i?.id,d=D.useMemo(()=>{if(!l.trim())return t;const y=l.toLowerCase();return t.filter(x=>x.login.toLowerCase().includes(y)||x.first_name.toLowerCase().includes(y)||x.last_name.toLowerCase().includes(y)||x.patr_name?.toLowerCase().includes(y))},[t,l]),h=()=>{c(null),o(!0)},m=y=>{c(y),o(!0)},p=()=>{o(!1),setTimeout(()=>c(null),300)};return n?w.jsx("div",{className:di.errorContainer,children:w.jsx(e3,{variant:"card",description:"Не удалось загрузить список пользователей",onRetry:r})}):w.jsxs("div",{className:di.wrapper,children:[w.jsxs("div",{className:di.header,children:[w.jsxs("div",{className:di.headerInfo,children:[w.jsx("h1",{className:di.title,children:"Управление пользователями"}),w.jsx("p",{className:di.description,children:"Создавайте и управляйте учетными записями пользователей системы"})]}),w.jsxs("div",{className:di.headerActions,children:[w.jsx("div",{className:di.badgeContainer,children:w.jsxs("span",{children:["Всего пользователей: ",e?"...":t.length]})}),w.jsxs(bt,{onClick:h,children:[w.jsx(bw,{className:"h-4 w-4"}),"Добавить пользователя"]})]})]}),w.jsx("div",{className:di.toolbar,children:w.jsxs("div",{className:di.searchWrapper,children:[w.jsx(d2,{className:di.searchIcon}),w.jsx(Ar,{placeholder:"Поиск по имени или логину...",value:l,onChange:y=>u(y.target.value),className:di.searchInput})]})}),e?w.jsx(lKt,{}):d.length===0?w.jsxs("div",{className:di.emptyState,children:[w.jsx("div",{className:di.emptyIcon,children:w.jsx(oUe,{})}),w.jsx("h3",{className:di.emptyTitle,children:l?"Пользователи не найдены":"Нет пользователей"}),w.jsx("p",{className:di.emptyDescription,children:l?"Попробуйте изменить параметры поиска":"Добавьте первого пользователя в систему"}),!l&&w.jsxs(bt,{onClick:h,className:di.emptyButton,children:[w.jsx(bw,{className:"h-4 w-4"}),"Добавить пользователя"]})]}):w.jsx("div",{className:di.list,children:d.map(y=>w.jsx(cKt,{user:y,onEdit:m,currentUserId:f},y.id))}),w.jsx(AKt,{isOpen:a,onClose:p,initialData:s})]})},VKt="_layout_e4fsf_1",$Kt="_sidebar_e4fsf_8",jKt="_collapsed_e4fsf_21",UKt="_header_e4fsf_25",FKt="_top_e4fsf_35",BKt="_title_e4fsf_42",zKt="_collapseBtn_e4fsf_49",GKt="_nav_e4fsf_66",WKt="_navList_e4fsf_74",HKt="_link_e4fsf_83",qKt="_linkLabel_e4fsf_94",KKt="_active_e4fsf_105",YKt="_linkCollapsed_e4fsf_115",XKt="_icon_e4fsf_121",ZKt="_footer_e4fsf_125",QKt="_userInfo_e4fsf_135",JKt="_userName_e4fsf_144",eYt="_themeSwitcher_e4fsf_153",tYt="_themeBtn_e4fsf_161",nYt="_themeActive_e4fsf_179",rYt="_logoutBtn_e4fsf_189",iYt="_content_e4fsf_209",aYt="_languageSelector_e4fsf_217",oYt="_languageTrigger_e4fsf_221",sYt="_languageIcon_e4fsf_244",cYt="_languageOption_e4fsf_248",lYt="_languageLabel_e4fsf_254",uYt="_separator_e4fsf_259",Mr={layout:VKt,sidebar:$Kt,collapsed:jKt,header:UKt,top:FKt,title:BKt,collapseBtn:zKt,nav:GKt,navList:WKt,link:HKt,linkLabel:qKt,active:KKt,linkCollapsed:YKt,icon:XKt,footer:ZKt,userInfo:QKt,userName:JKt,themeSwitcher:eYt,themeBtn:tYt,themeActive:nYt,logoutBtn:rYt,content:iYt,languageSelector:aYt,languageTrigger:oYt,languageIcon:sYt,languageOption:cYt,languageLabel:lYt,separator:uYt},fYt=({children:t})=>{const{t:e}=Hn("login"),{logout:n,isLoggingOut:r}=nBe();return w.jsxs(yE,{children:[w.jsx(rU,{asChild:!0,children:t}),w.jsxs(xE,{className:"max-w-xs",children:[w.jsxs(wE,{children:[w.jsx(SE,{children:e("logout.title")}),w.jsx(CE,{children:e("logout.description")})]}),w.jsxs(bE,{children:[w.jsx(_E,{children:e("logout.cancel")}),w.jsx(iU,{onClick:n,disabled:r,children:e(r?"logout.loading":"logout.confirm")})]})]})]})},Iv=({children:t,className:e})=>{const{t:n,i18n:r}=Hn("sidebar"),{collapsed:i,toggleCollapsed:a}=oDe(),{theme:o,setTheme:s}=Xk(),{user:c}=Lse(),l=[{name:n("analytics"),to:"/",Icon:Tse,key:"dashboard"},{name:n("devices"),to:"/devices",Icon:B6,key:"devices"},{name:n("studies"),to:"/studies",Icon:Mse,key:"studies"},{name:n("worklist"),to:"/worklist",Icon:ije,key:"worklist"},...c?.is_admin?[{isSeparator:!0,key:"sep-1"},{name:n("logs"),to:"/logs",Icon:Z$e,key:"logs"},{isSeparator:!0,key:"sep-2"},{name:"Список пользователей",to:"/users",Icon:lUe,key:"users"},{isSeparator:!0,key:"sep-3"}]:[]],u=[{value:"ru",label:"Русский"},{value:"en",label:"English"},{value:"vi",label:"Tiếng Việt"}],f=n(i?"toggle_expand":"toggle_collapse");return w.jsxs("div",{className:`${Mr.layout} ${e??""}`,children:[w.jsxs("aside",{className:`${Mr.sidebar} ${i?Mr.collapsed:""}`,children:[w.jsxs("div",{className:Mr.top,children:[w.jsxs("div",{className:Mr.header,children:[!i&&w.jsx("h1",{className:Mr.title,children:n("title")}),w.jsx("button",{type:"button",className:Mr.collapseBtn,onClick:a,"aria-label":f,children:i?w.jsx(qg,{size:18}):w.jsx(aL,{size:18})})]}),w.jsx("nav",{className:Mr.nav,children:w.jsx("ul",{className:Mr.navList,children:l.map(d=>{if("isSeparator"in d)return w.jsx("li",{className:Mr.separator},d.key);const{name:h,to:m,Icon:p,key:y}=d;return w.jsx("li",{children:w.jsxs(Oie,{to:m,className:({isActive:x})=>[Mr.link,x?Mr.active:"",i?Mr.linkCollapsed:""].filter(Boolean).join(" "),children:[p&&w.jsx(p,{size:18,className:Mr.icon}),!i&&w.jsx("span",{className:Mr.linkLabel,children:h})]})},y)})})})]}),w.jsxs("div",{className:Mr.footer,children:[!i&&w.jsxs(w.Fragment,{children:[c&&w.jsx("div",{className:Mr.userInfo,children:w.jsxs("div",{className:Mr.userName,children:[c.last_name," ",c.first_name," ",c.patr_name]})}),w.jsx("div",{className:Mr.languageSelector,children:w.jsxs(F5,{value:r.language,onValueChange:d=>r.changeLanguage(d),children:[w.jsxs(z5,{className:Mr.languageTrigger,children:[w.jsx(Rse,{size:20,className:Mr.languageIcon}),w.jsx(B5,{})]}),w.jsx(G5,{children:u.map(d=>w.jsx(tf,{value:d.value,children:w.jsx("span",{className:Mr.languageOption,children:w.jsx("span",{className:Mr.languageLabel,children:d.label})})},d.value))})]})}),w.jsxs("div",{className:Mr.themeSwitcher,children:[w.jsx("button",{type:"button",className:`${Mr.themeBtn} ${o==="light"?Mr.themeActive:""}`,onClick:()=>s("light"),"aria-label":n("light_theme"),title:n("light_theme"),children:w.jsx(cL,{size:16})}),w.jsx("button",{type:"button",className:`${Mr.themeBtn} ${o==="dark"?Mr.themeActive:""}`,onClick:()=>s("dark"),"aria-label":n("dark_theme"),title:n("dark_theme"),children:w.jsx(Nse,{size:16})}),w.jsx("button",{type:"button",className:`${Mr.themeBtn} ${o==="system"?Mr.themeActive:""}`,onClick:()=>s("system"),"aria-label":n("system_theme"),title:n("system_theme"),children:w.jsx(gje,{size:16})})]})]}),w.jsx(fYt,{children:w.jsxs("button",{type:"button",className:Mr.logoutBtn,"aria-label":n("logout"),title:n("logout"),children:[w.jsx(uje,{size:18}),!i&&w.jsx("span",{children:n("logout")})]})})]})]}),w.jsx("main",{className:Mr.content,children:t})]})},dYt="_container_ybz0b_1",hYt="_actionBtns_ybz0b_9",gYt="_card_ybz0b_18",pYt="_content_ybz0b_37",mYt="_errorCode_ybz0b_42",vYt="_title_ybz0b_53",yYt="_description_ybz0b_60",xYt="_actions_ybz0b_70",wYt="_backButton_ybz0b_77",bYt="_homeButton_ybz0b_78",ru={container:dYt,actionBtns:hYt,card:gYt,content:pYt,errorCode:mYt,title:vYt,description:yYt,actions:xYt,backButton:wYt,homeButton:bYt},SYt=()=>{const{t}=Hn(""),e=Sf(),n=()=>{e(-1)},r=()=>{e(ws.DASHBOARD)};return w.jsxs("div",{className:ru.container,children:[w.jsxs("div",{className:ru.actionBtns,children:[w.jsx(q0e,{}),w.jsx(K0e,{})]}),w.jsx(Oc,{className:ru.card,children:w.jsxs("div",{className:ru.content,children:[w.jsx("h1",{className:ru.errorCode,children:"404"}),w.jsx("h2",{className:ru.title,children:t("not_found_page.title")}),w.jsx("p",{className:ru.description,children:t("not_found_page.description")}),w.jsxs("div",{className:ru.actions,children:[w.jsxs(bt,{variant:"outline",onClick:n,className:ru.backButton,children:[w.jsx(rL,{className:ru.buttonIcon}),t("not_found_page.back_button")]}),w.jsxs(bt,{onClick:r,className:ru.homeButton,children:[w.jsx(J$e,{className:ru.buttonIcon}),t("not_found_page.home_button")]})]})]})})]})},ws={LOGIN:"/login",DEVICES:"/devices",STUDIES:"/studies",STUDY:"/studies/:id",WORKLIST:"/worklist",DASHBOARD:"/",LOGS:"/logs",USERS:"/users",NOT_FOUND:"*"},CYt=[{path:ws.LOGIN,variant:"auth",element:w.jsx(DYe,{}),label:"Вход"},{path:ws.DASHBOARD,variant:"private",element:w.jsx(a1t,{}),layout:Iv,label:"Главная"},{path:ws.DEVICES,variant:"private",element:w.jsx(wxt,{}),layout:Iv,label:"Список устройств"},{path:ws.STUDIES,variant:"private",element:w.jsx(r5t,{}),layout:Iv,label:"Список исследований"},{path:ws.STUDY,variant:"private",element:w.jsx(hGt,{}),label:"Исследование"},{path:ws.WORKLIST,variant:"private",element:w.jsx(yHt,{}),layout:Iv,label:"Очередь исследований"},{path:ws.LOGS,variant:"private",element:w.jsx(bqt,{}),layout:Iv,label:"Логи",onlyAdmin:!0},{path:ws.USERS,variant:"private",element:w.jsx(LKt,{}),layout:Iv,label:"Список пользователей",onlyAdmin:!0},{path:ws.NOT_FOUND,variant:"public",element:w.jsx(SYt,{}),label:"Не найдено"}],_Yt=({variant:t,children:e,onlyAdmin:n})=>{const r=Yg(a=>a.isAuth),i=Yg(a=>a.user);return t==="public"?w.jsx(w.Fragment,{children:e}):t==="auth"?r?w.jsx(PO,{to:ws.DASHBOARD,replace:!0}):e:t==="private"?r?n&&!i?.is_admin?w.jsx(PO,{to:"/404",replace:!0}):w.jsx(w.Fragment,{children:e}):w.jsx(PO,{to:ws.LOGIN,replace:!0}):null},TYt=()=>w.jsx(yd,{mode:"wait",children:w.jsx(tRe,{children:w.jsx(IMe,{children:CYt.map(t=>w.jsx(bie,{path:t.path,element:w.jsx(_Yt,{variant:t.variant,onlyAdmin:t.onlyAdmin,children:t.layout?w.jsx(t.layout,{children:w.jsx(D.Suspense,{fallback:w.jsx("p",{children:"Загрузка..."}),children:t.element})}):t.element})},t.path))})})});nTe.createRoot(document.getElementById("root")).render(w.jsx(UDe,{children:w.jsx(TYt,{})}));
